diff --git a/backend/src/fhir_service.py b/backend/src/fhir_service.py index ed1969e17..efe915d18 100644 --- a/backend/src/fhir_service.py +++ b/backend/src/fhir_service.py @@ -87,12 +87,9 @@ def get_immunization_by_id(self, imms_id: str, imms_vax_type_perms: str) -> Opti # Returns the Immunisation full resource with no obfuscation resource = imms_resp.get("Resource", {}) - imms_filtered_for_read = Filter.read(resource) if resource else {} - - return { "Version": imms_resp.get("Version", ""), - "Resource": Immunization.parse_obj(imms_filtered_for_read), + "Resource": Immunization.parse_obj(resource), } def get_immunization_by_id_all(self, imms_id: str, imms: dict) -> Optional[dict]: diff --git a/backend/src/filter.py b/backend/src/filter.py index a1197b852..5e3268bac 100644 --- a/backend/src/filter.py +++ b/backend/src/filter.py @@ -94,13 +94,6 @@ def add_use_to_identifier(imms: dict) -> dict: class Filter: """Functions for filtering a FHIR Immunization Resource""" - - @staticmethod - def read(imms: dict) -> dict: - """Apply filtering for READ request""" - imms.pop("identifier") - return imms - @staticmethod def search(imms: dict, patient_full_url: str, bundle_patient: dict = None) -> dict: """Apply filtering for an individual FHIR Immunization Resource as part of SEARCH request""" diff --git a/backend/tests/sample_data/completed_covid19_immunization_event_filtered_for_read.json b/backend/tests/sample_data/completed_covid19_immunization_event_for_read.json similarity index 93% rename from backend/tests/sample_data/completed_covid19_immunization_event_filtered_for_read.json rename to backend/tests/sample_data/completed_covid19_immunization_event_for_read.json index f4af45889..3bbcde8bf 100644 --- a/backend/tests/sample_data/completed_covid19_immunization_event_filtered_for_read.json +++ b/backend/tests/sample_data/completed_covid19_immunization_event_for_read.json @@ -7,7 +7,9 @@ "name": [ { "family": "Nightingale", - "given": ["Florence"] + "given": [ + "Florence" + ] } ] }, @@ -23,7 +25,9 @@ "name": [ { "family": "Taylor", - "given": ["Sarah"] + "given": [ + "Sarah" + ] } ], "gender": "unknown", @@ -48,6 +52,12 @@ ] } } + ], + "identifier": [ + { + "system": "https://supplierABC/identifiers/vacc", + "value": "ACME-vacc123456" + } ], "status": "completed", "vaccineCode": { @@ -143,4 +153,4 @@ "doseNumberPositiveInt": 1 } ] -} +} \ No newline at end of file diff --git a/backend/tests/test_fhir_service.py b/backend/tests/test_fhir_service.py index 2e55fc483..0dd03e4ae 100644 --- a/backend/tests/test_fhir_service.py +++ b/backend/tests/test_fhir_service.py @@ -187,8 +187,8 @@ def test_immunization_not_found(self): def test_get_immunization_by_id_patient_not_restricted(self): """ - Test that get_immunization_by_id returns a FHIR Immunization Resource which has been filtered for read, - but not for s-flag, when patient is not restricted + Test that get_immunization_by_id returns a FHIR Immunization Resource which has not been filtered for read, + and also dropped obfuscation for s-flag, when patient is not restricted """ imms_id = "non_restricted_id" @@ -196,7 +196,7 @@ def test_get_immunization_by_id_patient_not_restricted(self): self.imms_repo.get_immunization_by_id.return_value = {"Resource": immunization_data} self.fhir_service.pds_service.get_patient_details.return_value = {"meta": {"security": [{"code": "U"}]}} - expected_imms = load_json_data("completed_covid19_immunization_event_filtered_for_read.json") + expected_imms = load_json_data("completed_covid19_immunization_event_for_read.json") expected_output = Immunization.parse_obj(expected_imms) # When diff --git a/backend/tests/test_filter.py b/backend/tests/test_filter.py index 61a29301d..ee82d9531 100644 --- a/backend/tests/test_filter.py +++ b/backend/tests/test_filter.py @@ -145,12 +145,6 @@ def test_replace_organization_values(self): del expected_output_data["performer"][1]["actor"]["identifier"] self.assertEqual(replace_organization_values(input_imms_data), expected_output_data) - def test_filter_read(self): - """Tests to ensure Filter.read appropriately filters a FHIR Immunization Resource""" - unfiltered_imms = deepcopy(self.covid_19_immunization_event) - expected_output = load_json_data("completed_covid19_immunization_event_filtered_for_read.json") - self.assertEqual(Filter.read(unfiltered_imms), expected_output) - def test_filter_search(self): """Tests to ensure Filter.search appropriately filters a FHIR Immunization Resource""" bundle_patient = deepcopy(self.bundle_patient_resource)