fix typo , major, fingers crossed
Browse files- utils/oneclick.py +1 -1
- utils/responseparser.py +12 -12
utils/oneclick.py
CHANGED
@@ -98,7 +98,7 @@ def generate_discharge_paper_one_click(
|
|
98 |
for i in range(len(extractor.patients)):
|
99 |
extractor.set_patient_by_index(i)
|
100 |
patient_data = extractor.get_patient_dict()
|
101 |
-
logger.debug(f"Processing patient {i}: {patient_data}")
|
102 |
patient_id_from_data = str(patient_data.get('id', '')).strip().lower()
|
103 |
|
104 |
if patient_id_input and patient_id_from_data == patient_id_input:
|
|
|
98 |
for i in range(len(extractor.patients)):
|
99 |
extractor.set_patient_by_index(i)
|
100 |
patient_data = extractor.get_patient_dict()
|
101 |
+
logger.debug(f"Processing patient {i}: {patient_data}") # Add debug log
|
102 |
patient_id_from_data = str(patient_data.get('id', '')).strip().lower()
|
103 |
|
104 |
if patient_id_input and patient_id_from_data == patient_id_input:
|
utils/responseparser.py
CHANGED
@@ -271,18 +271,18 @@ class PatientDataExtractor:
|
|
271 |
|
272 |
# Safely extract fields with defaults to avoid KeyError
|
273 |
return {
|
274 |
-
"id": data
|
275 |
-
"first_name": data
|
276 |
-
"last_name": data
|
277 |
-
"name_prefix": data
|
278 |
-
"dob": data
|
279 |
-
"age": data
|
280 |
-
"sex": data
|
281 |
-
"address": data
|
282 |
-
"city": data
|
283 |
-
"state": data
|
284 |
-
"zip_code": data
|
285 |
-
"phone": data
|
286 |
"admission_date": admission_date,
|
287 |
"discharge_date": discharge_date,
|
288 |
"diagnosis": diagnosis,
|
|
|
271 |
|
272 |
# Safely extract fields with defaults to avoid KeyError
|
273 |
return {
|
274 |
+
"id": data.get("id", "Unknown"),
|
275 |
+
"first_name": data.get("first_name", ""),
|
276 |
+
"last_name": data.get("last_name", ""),
|
277 |
+
"name_prefix": data.get("name_prefix", ""), # Fixed to avoid KeyError
|
278 |
+
"dob": data.get("dob", "Unknown"),
|
279 |
+
"age": data.get("age", "Unknown"),
|
280 |
+
"sex": data.get("gender", "Unknown"),
|
281 |
+
"address": data.get("address_line", "Unknown"),
|
282 |
+
"city": data.get("city", "Unknown"),
|
283 |
+
"state": data.get("state", "Unknown"),
|
284 |
+
"zip_code": data.get("zip_code", "Unknown"),
|
285 |
+
"phone": data.get("phone", "Unknown"),
|
286 |
"admission_date": admission_date,
|
287 |
"discharge_date": discharge_date,
|
288 |
"diagnosis": diagnosis,
|