Skip to content

Commit 3081b06

Browse files
committed
change debug logs
1 parent 1c3eb9c commit 3081b06

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lambdas/id_sync/src/record_processor.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ def process_nhs_number(nhs_number: str) -> Dict[str, Any]:
6868
# Compare demographics from PDS to each IEDS item, keep only matching records
6969
matching_records = []
7070
discarded_count = 0
71+
discarded_records = []
7172
for detail in ieds_resources:
7273
if demographics_match(pds_patient_resource, detail):
7374
matching_records.append(detail)
7475
else:
7576
discarded_count += 1
77+
discarded_records.append(detail)
7678

7779
if not matching_records:
7880
logger.info("No records matched PDS demographics: %d", discarded_count)
@@ -144,39 +146,39 @@ def normalize_strings(item: Any) -> str | None:
144146
pds_name = normalize_strings(extract_normalized_name_from_patient(pds_details))
145147
pds_gender = normalize_strings(pds_details.get("gender"))
146148
pds_birth = normalize_strings(pds_details.get("birthDate"))
147-
logger.debug("demographics_match: demographics match for %s", pds_name, pds_gender, pds_birth)
149+
logger.info("demographics_match: demographics match for %s", pds_name, pds_gender, pds_birth)
148150

149151
# Retrieve patient resource from IEDS item
150152
patient = extract_patient_resource_from_item(ieds_item)
151153
if not patient:
152-
logger.debug("demographics_match: no patient resource in IEDS table item")
154+
logger.info("demographics_match: no patient resource in IEDS table item")
153155
return False
154156

155157
# normalize patient fields from IEDS
156158
ieds_name = normalize_strings(extract_normalized_name_from_patient(patient))
157159
ieds_gender = normalize_strings(patient.get("gender"))
158160
ieds_birth = normalize_strings(patient.get("birthDate"))
159-
logger.debug("demographics_match: demographics match for %s", patient)
161+
logger.info("demographics_match: demographics match for %s", patient)
160162

161163
# All required fields must be present
162164
if not all([pds_name, pds_gender, pds_birth, ieds_name, ieds_gender, ieds_birth]):
163-
logger.debug("demographics_match: missing required demographics")
165+
logger.info("demographics_match: missing required demographics")
164166
return False
165167

166168
# Compare fields
167169
if pds_birth != ieds_birth:
168-
logger.debug("demographics_match: birthDate mismatch %s != %s", pds_birth, ieds_birth)
170+
logger.info("demographics_match: birthDate mismatch %s != %s", pds_birth, ieds_birth)
169171
return False
170172

171173
if pds_gender != ieds_gender:
172-
logger.debug("demographics_match: gender mismatch %s != %s", pds_gender, ieds_gender)
174+
logger.info("demographics_match: gender mismatch %s != %s", pds_gender, ieds_gender)
173175
return False
174176

175177
if pds_name != ieds_name:
176-
logger.debug("demographics_match: name mismatch %s != %s", pds_name, ieds_name)
178+
logger.info("demographics_match: name mismatch %s != %s", pds_name, ieds_name)
177179
return False
178180

179-
logger.debug("demographics_match: demographics match for %s", patient)
181+
logger.info("demographics_match: demographics match for %s", patient)
180182
return True
181183
except Exception:
182184
logger.exception("demographics_match: comparison failed with exception")

0 commit comments

Comments
 (0)