Skip to content

Commit cbb2782

Browse files
committed
return response identifier
1 parent 07d66f8 commit cbb2782

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

backend/src/fhir_service.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,9 @@ def get_immunization_by_id(self, imms_id: str, imms_vax_type_perms: str) -> Opti
8787

8888
# Returns the Immunisation full resource with no obfuscation
8989
resource = imms_resp.get("Resource", {})
90-
imms_filtered_for_read = Filter.read(resource) if resource else {}
91-
92-
9390
return {
9491
"Version": imms_resp.get("Version", ""),
95-
"Resource": Immunization.parse_obj(imms_filtered_for_read),
92+
"Resource": Immunization.parse_obj(resource),
9693
}
9794

9895
def get_immunization_by_id_all(self, imms_id: str, imms: dict) -> Optional[dict]:

backend/src/filter.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,6 @@ def add_use_to_identifier(imms: dict) -> dict:
9494

9595
class Filter:
9696
"""Functions for filtering a FHIR Immunization Resource"""
97-
98-
@staticmethod
99-
def read(imms: dict) -> dict:
100-
"""Apply filtering for READ request"""
101-
imms.pop("identifier")
102-
return imms
103-
10497
@staticmethod
10598
def search(imms: dict, patient_full_url: str, bundle_patient: dict = None) -> dict:
10699
"""Apply filtering for an individual FHIR Immunization Resource as part of SEARCH request"""

backend/tests/sample_data/completed_covid19_immunization_event_filtered_for_read.json renamed to backend/tests/sample_data/completed_covid19_immunization_event_for_read.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"name": [
88
{
99
"family": "Nightingale",
10-
"given": ["Florence"]
10+
"given": [
11+
"Florence"
12+
]
1113
}
1214
]
1315
},
@@ -23,7 +25,9 @@
2325
"name": [
2426
{
2527
"family": "Taylor",
26-
"given": ["Sarah"]
28+
"given": [
29+
"Sarah"
30+
]
2731
}
2832
],
2933
"gender": "unknown",
@@ -48,6 +52,12 @@
4852
]
4953
}
5054
}
55+
],
56+
"identifier": [
57+
{
58+
"system": "https://supplierABC/identifiers/vacc",
59+
"value": "ACME-vacc123456"
60+
}
5161
],
5262
"status": "completed",
5363
"vaccineCode": {
@@ -143,4 +153,4 @@
143153
"doseNumberPositiveInt": 1
144154
}
145155
]
146-
}
156+
}

backend/tests/test_fhir_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,16 @@ def test_immunization_not_found(self):
187187

188188
def test_get_immunization_by_id_patient_not_restricted(self):
189189
"""
190-
Test that get_immunization_by_id returns a FHIR Immunization Resource which has been filtered for read,
191-
but not for s-flag, when patient is not restricted
190+
Test that get_immunization_by_id returns a FHIR Immunization Resource which has not been filtered for read,
191+
and also dropped obfuscation for s-flag, when patient is not restricted
192192
"""
193193
imms_id = "non_restricted_id"
194194

195195
immunization_data = load_json_data("completed_covid19_immunization_event.json")
196196
self.imms_repo.get_immunization_by_id.return_value = {"Resource": immunization_data}
197197
self.fhir_service.pds_service.get_patient_details.return_value = {"meta": {"security": [{"code": "U"}]}}
198198

199-
expected_imms = load_json_data("completed_covid19_immunization_event_filtered_for_read.json")
199+
expected_imms = load_json_data("completed_covid19_immunization_event_for_read.json")
200200
expected_output = Immunization.parse_obj(expected_imms)
201201

202202
# When

backend/tests/test_filter.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ def test_replace_organization_values(self):
145145
del expected_output_data["performer"][1]["actor"]["identifier"]
146146
self.assertEqual(replace_organization_values(input_imms_data), expected_output_data)
147147

148-
def test_filter_read(self):
149-
"""Tests to ensure Filter.read appropriately filters a FHIR Immunization Resource"""
150-
unfiltered_imms = deepcopy(self.covid_19_immunization_event)
151-
expected_output = load_json_data("completed_covid19_immunization_event_filtered_for_read.json")
152-
self.assertEqual(Filter.read(unfiltered_imms), expected_output)
153-
154148
def test_filter_search(self):
155149
"""Tests to ensure Filter.search appropriately filters a FHIR Immunization Resource"""
156150
bundle_patient = deepcopy(self.bundle_patient_resource)

0 commit comments

Comments
 (0)