@@ -76,7 +76,7 @@ def get_immunization_by_identifier(
7676 base_url = f"{ get_service_url ()} /Immunization"
7777 response = form_json (imms_resp , element , identifier , base_url )
7878 return response
79-
79+
8080 def get_immunization_by_id (self , imms_id : str , imms_vax_type_perms : str ) -> Optional [dict ]:
8181 """
8282 Get an Immunization by its ID. Return None if not found. If the patient doesn't have an NHS number,
@@ -85,26 +85,19 @@ def get_immunization_by_id(self, imms_id: str, imms_vax_type_perms: str) -> Opti
8585 if not (imms_resp := self .immunization_repo .get_immunization_by_id (imms_id , imms_vax_type_perms )):
8686 return None
8787
88- # Remove fields rom the imms resource which are not to be returned for read
89- imms_filtered_for_read = Filter .read (imms_resp .get ("Resource" , {}))
88+ # Returns the Immunisation full resource with no obfuscation
89+ resource = imms_resp .get ("Resource" , {})
90+ imms_filtered_for_read = Filter .read (resource ) if resource else {}
9091
91- # Handle s-flag filtering, where applicable
92- if not (nhs_number := obtain_field_value (imms_filtered_for_read , FieldNames .patient_identifier_value )):
93- imms_filtered_for_read_and_s_flag = imms_filtered_for_read
94- else :
95- if patient := self .pds_service .get_patient_details (nhs_number ):
96- imms_filtered_for_read_and_s_flag = handle_s_flag (imms_filtered_for_read , patient )
97- else :
98- raise UnhandledResponseError ("unable to validate NHS number with downstream service" )
9992
10093 return {
10194 "Version" : imms_resp .get ("Version" , "" ),
102- "Resource" : Immunization .parse_obj (imms_filtered_for_read_and_s_flag ),
95+ "Resource" : Immunization .parse_obj (imms_filtered_for_read ),
10396 }
10497
10598 def get_immunization_by_id_all (self , imms_id : str , imms : dict ) -> Optional [dict ]:
10699 """
107- Get an Immunization by its ID. Return None if not found. If the patient doesn't have an NHS number,
100+ Get an Immunization by its ID. Return None if it is not found. If the patient doesn't have an NHS number,
108101 return the Immunization without calling PDS or checking S flag.
109102 """
110103 imms ["id" ] = imms_id
0 commit comments