Skip to content

Commit

Permalink
Deprecate dataset_references
Browse files Browse the repository at this point in the history
This field is obsolete with the addition of `egress` and `ingress`.
  • Loading branch information
PSalant726 committed Sep 19, 2022
1 parent 36638c3 commit 6e03b27
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 16 deletions.
5 changes: 4 additions & 1 deletion demo_resources/demo_system.yml
Expand Up @@ -12,6 +12,9 @@ system:
is_required: True
progress: Complete
link: https://example.org/analytics_system_data_protection_impact_assessment
ingress:
- fides_key: demo_users_dataset
type: dataset
privacy_declarations:
- name: Analyze customer behaviour for improvements.
data_categories:
Expand All @@ -21,7 +24,7 @@ system:
data_subjects:
- customer
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
dataset_references:
ingress:
- demo_users_dataset

- fides_key: demo_marketing_system
Expand Down
5 changes: 0 additions & 5 deletions mkdocs/docs/resources/system.md
Expand Up @@ -115,8 +115,6 @@ system:
data_subjects:
- customer
data_qualifier: identified_data
dataset_references:
- demo_users_dataset
egress:
- another_demo_system
ingress:
Expand Down Expand Up @@ -169,9 +167,6 @@ system:
"customer"
],
"data_qualifier": "identified_data",
"dataset_references": [
"demo_users_dataset"
],
"egress": ["another_demo_system"],
"ingress": ["yet_another_demo_system"]
}
Expand Down
15 changes: 15 additions & 0 deletions src/fideslang/models.py
Expand Up @@ -653,6 +653,21 @@ class PrivacyDeclaration(BaseModel):
description="The resources from which data is received. Any `fides_key`s included in this list reference `DataFlow` entries in the `ingress` array of any `System` resources to which this `PrivacyDeclaration` is applied."
)

@validator("dataset_references")
@classmethod
def deprecate_dataset_references(cls, value: List[FidesKey]) -> List[FidesKey]:
"""
Warn that the `dataset_references` field is deprecated, if set.
"""

if value is not None:
warn(
"The dataset_references field is deprecated, and will be removed in a future version of fideslang. Use the 'egress' and 'ingress` fields instead.",
DeprecationWarning,
)

return value


class SystemMetadata(BaseModel):
"""
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Expand Up @@ -118,7 +118,6 @@ def resources_dict():
data_use="provide",
data_subjects=[],
data_qualifier="aggregated_data",
dataset_references=[],
)
],
),
Expand Down
5 changes: 4 additions & 1 deletion tests/data/failing_dataset_collection_taxonomy.yml
Expand Up @@ -20,6 +20,9 @@ system:
name: Customer Data Sharing System
description: Share data about our users with third-parties for advertising
system_type: Service
ingress:
- fides_key: test_db_dataset_failing_dataset
type: dataset
privacy_declarations:
- name: Share Political Opinions
data_categories:
Expand All @@ -28,7 +31,7 @@ system:
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
data_subjects:
- customer
dataset_references:
ingress:
- test_db_dataset_failing_dataset

policy:
Expand Down
5 changes: 4 additions & 1 deletion tests/data/failing_dataset_field_taxonomy.yml
Expand Up @@ -21,6 +21,9 @@ system:
name: Customer Data Sharing System
description: Share data about our users with third-parties for advertising
system_type: Service
ingress:
- fides_key: test_db_dataset_failing_dataset
type: dataset
privacy_declarations:
- name: Share Political Opinions
data_categories:
Expand All @@ -29,7 +32,7 @@ system:
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
data_subjects:
- customer
dataset_references:
ingress:
- test_db_dataset_failing_dataset

policy:
Expand Down
5 changes: 4 additions & 1 deletion tests/data/failing_dataset_taxonomy.yml
Expand Up @@ -20,6 +20,9 @@ system:
name: Customer Data Sharing System
description: Share data about our users with third-parties for advertising
system_type: Service
ingress:
- fides_key: test_db_dataset_failing_dataset
type: dataset
privacy_declarations:
- name: Share Political Opinions
data_categories:
Expand All @@ -28,7 +31,7 @@ system:
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
data_subjects:
- customer
dataset_references:
ingress:
- test_db_dataset_failing_dataset

policy:
Expand Down
5 changes: 4 additions & 1 deletion tests/data/failing_nested_dataset.yml
Expand Up @@ -24,6 +24,9 @@ system:
name: Client Usage Analytics
description: Use aggregated and anonymous data to measure usage
system_type: Service
ingress:
- fides_key: test_failing_nested_dataset_field
type: dataset
privacy_declarations:
- name: Mesaure usage of users
data_categories:
Expand All @@ -32,7 +35,7 @@ system:
data_subjects:
- customer
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
dataset_references:
ingress:
- test_failing_nested_dataset_field

policy:
Expand Down
32 changes: 27 additions & 5 deletions tests/fideslang/test_models.py
Expand Up @@ -3,6 +3,33 @@
from fideslang import DataFlow, PrivacyDeclaration, System


@pytest.mark.unit
class TestPrivacyDeclaration:
def test_privacydeclaration_valid(self) -> None:
assert PrivacyDeclaration(
data_categories=[],
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
egress=[],
ingress=[],
name="declaration-name",
)

def test_dataset_references_deprecation(self) -> None:
with pytest.deprecated_call(match="dataset_references"):
assert PrivacyDeclaration(
data_categories=[],
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
egress=["test_system_2"],
ingress=["test_system_3"],
name="declaration-name",
)


@pytest.mark.unit
class TestSystem:
def test_system_valid(self) -> None:
Expand Down Expand Up @@ -32,7 +59,6 @@ def test_system_valid(self) -> None:
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
egress=["test_system_2"],
ingress=["test_system_3"],
name="declaration-name",
Expand Down Expand Up @@ -71,7 +97,6 @@ def test_system_dependencies_deprecation(self) -> None:
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
egress=["test_system_2"],
ingress=["test_system_3"],
name="declaration-name",
Expand All @@ -96,7 +121,6 @@ def test_system_valid_no_egress_or_ingress(self) -> None:
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
name="declaration-name",
)
],
Expand Down Expand Up @@ -126,7 +150,6 @@ def test_system_no_egress(self) -> None:
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
egress=["test_system_2"],
ingress=["test_system_3"],
name="declaration-name",
Expand Down Expand Up @@ -158,7 +181,6 @@ def test_system_no_ingress(self) -> None:
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
egress=["test_system_2"],
ingress=["test_system_3"],
name="declaration-name",
Expand Down

0 comments on commit 6e03b27

Please sign in to comment.