File tree Expand file tree Collapse file tree 2 files changed +3
-22
lines changed
Expand file tree Collapse file tree 2 files changed +3
-22
lines changed Original file line number Diff line number Diff line change @@ -55,22 +55,3 @@ def pds_get_patient_id(nhs_number: str) -> str:
5555 logger .exception (msg )
5656 raise IdSyncException (message = msg , exception = e )
5757
58-
59- def normalize_name_from_pds (pds_get_patient_details : dict ) -> str | None :
60- """Return a normalized full name (given + family) from PDS patient details or None."""
61- try :
62- name = pds_get_patient_details .get ("name" )
63- if not name :
64- return None
65- name_entry = name [0 ] if isinstance (name , list ) else name
66- given = name_entry .get ("given" )
67- given_str = None
68- if isinstance (given , list ) and given :
69- given_str = given [0 ]
70- elif isinstance (given , str ):
71- given_str = given
72- family = name_entry .get ("family" )
73- parts = [p for p in [given_str , family ] if p ]
74- return " " .join (parts ).strip ().lower () if parts else None
75- except Exception :
76- return None
Original file line number Diff line number Diff line change 11from common .clients import logger
22from typing import Dict , Any
3- from pds_details import pds_get_patient_id , pds_get_patient_details , normalize_name_from_pds
3+ from pds_details import pds_get_patient_id , pds_get_patient_details
44from ieds_db_operations import (
55 ieds_check_exist ,
66 ieds_update_patient_id ,
@@ -138,7 +138,7 @@ def normalize_strings(item: Any) -> str | None:
138138 return str (item ).strip ().lower () if item else None
139139
140140 # Retrieve patient resource from PDS
141- pds_name = normalize_strings (normalize_name_from_pds (pds_details ))
141+ pds_name = normalize_strings (extract_normalized_name_from_patient (pds_details ))
142142 pds_gender = normalize_strings (pds_details .get ("gender" ))
143143 pds_birth = normalize_strings (pds_details .get ("birthDate" ))
144144
@@ -149,7 +149,7 @@ def normalize_strings(item: Any) -> str | None:
149149 return False
150150
151151 # normalize patient name
152- ieds_name = extract_normalized_name_from_patient (patient )
152+ ieds_name = normalize_strings ( extract_normalized_name_from_patient (patient ) )
153153
154154 ieds_gender = normalize_strings (patient .get ("gender" ))
155155 ieds_birth = patient .get ("birthDate" )
You can’t perform that action at this time.
0 commit comments