fix typo , fingers crossed
Browse files- utils/oneclick.py +1 -9
utils/oneclick.py
CHANGED
@@ -68,6 +68,7 @@ def generate_ai_discharge_summary(patient_dict: Dict[str, str], client) -> Tuple
|
|
68 |
logger.error(f"Error generating AI discharge summary: {str(e)}", exc_info=True)
|
69 |
return None, None
|
70 |
|
|
|
71 |
def generate_discharge_paper_one_click(
|
72 |
api: MeldRxAPI,
|
73 |
client,
|
@@ -102,7 +103,6 @@ def generate_discharge_paper_one_click(
|
|
102 |
logger.debug(f"Processing patient {i}: {patient_data}") # Add debug log
|
103 |
patient_id_from_data = str(patient_data.get('id', '')).strip().lower()
|
104 |
|
105 |
-
|
106 |
if patient_id_input and patient_id_from_data == patient_id_input:
|
107 |
matching_patient = patient_data
|
108 |
logger.info(f"Exact match found for patient ID: {patient_id_from_data}")
|
@@ -124,9 +124,6 @@ def generate_discharge_paper_one_click(
|
|
124 |
if not matching_patient:
|
125 |
search_criteria = f"ID: {patient_id or 'N/A'}, First: {first_name or 'N/A'}, Last: {last_name or 'N/A'}"
|
126 |
all_patient_ids = [str(p.get('id', '')) for p in extractor.get_all_patients()]
|
127 |
-
all_patient_names = [f"{p.get('first_name', '')} {p.get('last_name', '')}".strip()
|
128 |
-
for p in extractor.get_all_patients()]
|
129 |
-
all_patient_ids = [str(p.get('id', '')) for p in extractor.get_all_patients()]
|
130 |
all_patient_names = [f"{p.get('first_name', '')} {p.get('last_name', '')}".strip()
|
131 |
for p in extractor.get_all_patients()]
|
132 |
logger.warning(f"No patients matched criteria: {search_criteria}")
|
@@ -135,11 +132,7 @@ def generate_discharge_paper_one_click(
|
|
135 |
f"Available Names: {', '.join(all_patient_names)}"), None, None, None
|
136 |
|
137 |
logger.info(f"Selected patient data: {matching_patient}")
|
138 |
-
|
139 |
-
logger.info(f"Selected patient data: {matching_patient}")
|
140 |
|
141 |
-
basic_summary = format_discharge_summary(matching_patient)
|
142 |
-
ai_summary, verified_summary = generate_ai_discharge_summary(matching_patient, client)
|
143 |
basic_summary = format_discharge_summary(matching_patient)
|
144 |
ai_summary, verified_summary = generate_ai_discharge_summary(matching_patient, client)
|
145 |
|
@@ -148,7 +141,6 @@ def generate_discharge_paper_one_click(
|
|
148 |
|
149 |
pdf_gen = PDFGenerator()
|
150 |
filename = f"discharge_{matching_patient.get('id', 'unknown')}_{matching_patient.get('last_name', 'patient')}.pdf"
|
151 |
-
filename = f"discharge_{matching_patient.get('id', 'unknown')}_{matching_patient.get('last_name', 'patient')}.pdf"
|
152 |
pdf_path = pdf_gen.generate_pdf_from_text(ai_summary, filename)
|
153 |
|
154 |
if pdf_path:
|
|
|
68 |
logger.error(f"Error generating AI discharge summary: {str(e)}", exc_info=True)
|
69 |
return None, None
|
70 |
|
71 |
+
# utils/oneclick.py
|
72 |
def generate_discharge_paper_one_click(
|
73 |
api: MeldRxAPI,
|
74 |
client,
|
|
|
103 |
logger.debug(f"Processing patient {i}: {patient_data}") # Add debug log
|
104 |
patient_id_from_data = str(patient_data.get('id', '')).strip().lower()
|
105 |
|
|
|
106 |
if patient_id_input and patient_id_from_data == patient_id_input:
|
107 |
matching_patient = patient_data
|
108 |
logger.info(f"Exact match found for patient ID: {patient_id_from_data}")
|
|
|
124 |
if not matching_patient:
|
125 |
search_criteria = f"ID: {patient_id or 'N/A'}, First: {first_name or 'N/A'}, Last: {last_name or 'N/A'}"
|
126 |
all_patient_ids = [str(p.get('id', '')) for p in extractor.get_all_patients()]
|
|
|
|
|
|
|
127 |
all_patient_names = [f"{p.get('first_name', '')} {p.get('last_name', '')}".strip()
|
128 |
for p in extractor.get_all_patients()]
|
129 |
logger.warning(f"No patients matched criteria: {search_criteria}")
|
|
|
132 |
f"Available Names: {', '.join(all_patient_names)}"), None, None, None
|
133 |
|
134 |
logger.info(f"Selected patient data: {matching_patient}")
|
|
|
|
|
135 |
|
|
|
|
|
136 |
basic_summary = format_discharge_summary(matching_patient)
|
137 |
ai_summary, verified_summary = generate_ai_discharge_summary(matching_patient, client)
|
138 |
|
|
|
141 |
|
142 |
pdf_gen = PDFGenerator()
|
143 |
filename = f"discharge_{matching_patient.get('id', 'unknown')}_{matching_patient.get('last_name', 'patient')}.pdf"
|
|
|
144 |
pdf_path = pdf_gen.generate_pdf_from_text(ai_summary, filename)
|
145 |
|
146 |
if pdf_path:
|