Jesse Liu commited on
Commit
bc856cc
·
1 Parent(s): 6fbe7ad

Sync latest app + data (clinician groups, jsonl)

Browse files
Files changed (1) hide show
  1. chatgpt.py +8 -6
chatgpt.py CHANGED
@@ -386,10 +386,10 @@ def submit_patient_evaluation(patient_id, patient_input, ai_summary, overall_rat
386
  clarity, feedback, expert_name, sentence_comments):
387
  """Process and save the patient evaluation"""
388
  if not expert_name.strip():
389
- return "Please enter your name before submitting evaluation.", "", 0, 0, 0, 0, 0, "", ""
390
 
391
  if overall_rating == 0:
392
- return "Please provide an overall rating before submitting.", "", 0, 0, 0, 0, 0, "", ""
393
 
394
  categories = {
395
  'medical_accuracy': medical_accuracy,
@@ -413,7 +413,7 @@ def submit_patient_evaluation(patient_id, patient_input, ai_summary, overall_rat
413
  overall_rating, feedback, expert_name, categories, parsed_comments)
414
 
415
  # Reset form after successful submission
416
- return result, "", 0, 0, 0, 0, 0, "", ""
417
 
418
  def get_conversation_for_evaluation(history):
419
  """Get the last conversation pair for evaluation"""
@@ -1310,23 +1310,25 @@ with gr.Blocks() as app:
1310
  # Handle clinician ID selection to filter patient list
1311
  if eval_groups:
1312
  def update_patient_list_by_group(selected_clinician):
1313
- """Filter patient list based on selected clinician ID"""
1314
  if selected_clinician == "All Patients":
1315
  filtered_patients = patient_ids_list
1316
  info_text = f"Showing all {len(patient_ids_list)} patients"
 
1317
  else:
1318
  # Directly use selected_clinician as key (no mapping needed)
1319
  group_data = eval_groups.get(selected_clinician, {})
1320
  group_patients = group_data.get('all_patients', [])
1321
  filtered_patients = [p for p in patient_ids_list if p in group_patients]
1322
  info_text = f"**{selected_clinician}**: {len(filtered_patients)} patients assigned"
 
1323
 
1324
- return gr.update(choices=filtered_patients, value=None), info_text
1325
 
1326
  eval_group_dropdown.change(
1327
  fn=update_patient_list_by_group,
1328
  inputs=[eval_group_dropdown],
1329
- outputs=[eval_patient_radio, group_info_display]
1330
  )
1331
 
1332
  # When patient changes, update display directly (single admission per patient)
 
386
  clarity, feedback, expert_name, sentence_comments):
387
  """Process and save the patient evaluation"""
388
  if not expert_name.strip():
389
+ return "Please enter your name before submitting evaluation.", feedback, overall_rating, medical_accuracy, clinical_relevance, completeness, clarity, sentence_comments, expert_name
390
 
391
  if overall_rating == 0:
392
+ return "Please provide an overall rating before submitting.", feedback, overall_rating, medical_accuracy, clinical_relevance, completeness, clarity, sentence_comments, expert_name
393
 
394
  categories = {
395
  'medical_accuracy': medical_accuracy,
 
413
  overall_rating, feedback, expert_name, categories, parsed_comments)
414
 
415
  # Reset form after successful submission
416
+ return result, "", 0, 0, 0, 0, 0, "", expert_name
417
 
418
  def get_conversation_for_evaluation(history):
419
  """Get the last conversation pair for evaluation"""
 
1310
  # Handle clinician ID selection to filter patient list
1311
  if eval_groups:
1312
  def update_patient_list_by_group(selected_clinician):
1313
+ """Filter patient list based on selected clinician ID and auto-fill clinician ID field"""
1314
  if selected_clinician == "All Patients":
1315
  filtered_patients = patient_ids_list
1316
  info_text = f"Showing all {len(patient_ids_list)} patients"
1317
+ clinician_id_update = gr.update() # leave existing text untouched
1318
  else:
1319
  # Directly use selected_clinician as key (no mapping needed)
1320
  group_data = eval_groups.get(selected_clinician, {})
1321
  group_patients = group_data.get('all_patients', [])
1322
  filtered_patients = [p for p in patient_ids_list if p in group_patients]
1323
  info_text = f"**{selected_clinician}**: {len(filtered_patients)} patients assigned"
1324
+ clinician_id_update = gr.update(value=selected_clinician)
1325
 
1326
+ return gr.update(choices=filtered_patients, value=None), info_text, clinician_id_update
1327
 
1328
  eval_group_dropdown.change(
1329
  fn=update_patient_list_by_group,
1330
  inputs=[eval_group_dropdown],
1331
+ outputs=[eval_patient_radio, group_info_display, expert_name_input]
1332
  )
1333
 
1334
  # When patient changes, update display directly (single admission per patient)