Preetham22 commited on
Commit
4e592d4
·
1 Parent(s): b473579

fix model paths, retrain, perform inference

Browse files
Makefile CHANGED
@@ -1,6 +1,6 @@
1
- MODEL_PATH_TEXT=medi_llm_fullmodel_text.pt
2
- MODEL_PATH_IMAGE=medi_llm_fullmodel_image.pt
3
- MODEL_PATH_MULTIMODAL=medi_llm_fullmodel_multimodal.pt
4
  SCRIPT=inference.py
5
 
6
  # Run inference for multimodal model
 
1
+ MODEL_PATH_TEXT=medi_llm_state_dict_text.pth
2
+ MODEL_PATH_IMAGE=medi_llm_state_dict_image.pth
3
+ MODEL_PATH_MULTIMODAL=medi_llm_state_dict_multimodal.pth
4
  SCRIPT=inference.py
5
 
6
  # Run inference for multimodal model
assets/model_training_curve_image.png CHANGED

Git LFS Details

  • SHA256: e1679a556c60ef4c1aaad3703bc4c56af14d7fc34cfc24eba9f8de9f17d07167
  • Pointer size: 130 Bytes
  • Size of remote file: 30.3 kB

Git LFS Details

  • SHA256: c280693c4c96ac793ceaa10f93c94fd17be32293ba7f7f09a0d4eca6c0e0226b
  • Pointer size: 130 Bytes
  • Size of remote file: 33.2 kB
assets/model_training_curve_multimodal.png CHANGED

Git LFS Details

  • SHA256: 451fc976c8f201e152b323dd134748eabc78c2e78e4a7308bb3a12997b9f5236
  • Pointer size: 130 Bytes
  • Size of remote file: 25.8 kB

Git LFS Details

  • SHA256: 2997e81bc41c09ba46556e29b85d72f0d45cbefa7edd15b6aad4a79e0c2c0a12
  • Pointer size: 130 Bytes
  • Size of remote file: 29.4 kB
assets/model_training_curve_text.png CHANGED

Git LFS Details

  • SHA256: 16785ec8b74e6642eff13ee918004b01bfc2067a96eab16a4799fb2371930063
  • Pointer size: 130 Bytes
  • Size of remote file: 32 kB

Git LFS Details

  • SHA256: 23f240984f4b6d439bd137f11b6b12f5caf3cf1a5109cb84e93b11b8ea54bce7
  • Pointer size: 130 Bytes
  • Size of remote file: 31.3 kB
inference.py CHANGED
@@ -26,6 +26,8 @@ def predict(model, dataloader, device):
26
  all_preds, all_truths = [], []
27
  all_texts, all_paths, all_ids = [], [], []
28
 
 
 
29
  with torch.no_grad():
30
  for batch in tqdm(dataloader, desc="Running inference"):
31
  input_ids = batch.get("input_ids", None)
@@ -42,10 +44,22 @@ def predict(model, dataloader, device):
42
  preds = torch.argmax(outputs, dim=1).cpu().tolist()
43
  all_preds.extend(preds)
44
 
45
- all_truths.extend(batch.get("triage_level", [-1] * len(preds)))
46
- all_texts.extend(batch.get("emr_text", [""] * len(preds)))
47
- all_paths.extend([str(p) for p in batch.get("image_path", [""] * len(preds))])
48
- all_ids.extend(batch.get("patient_id", [f"patient_{i}" for i in range(len(preds))]))
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  return all_preds, all_truths, all_texts, all_paths, all_ids
51
 
@@ -105,40 +119,39 @@ def main():
105
  preds, truths, texts, paths, ids = predict(model, dataloader, DEVICE)
106
 
107
  label_inv_map = inverse_label_map()
108
- pred_labels = [label_inv_map(p) for p in preds]
109
- true_labels = [label_inv_map(t) if t in label_inv_map else "" for t in truths]
110
 
111
  df = pd.DataFrame({
112
  "patient_id": ids,
113
  "predicted": pred_labels,
114
- "true": true_labels,
115
  "emr_text": texts,
116
  "image_path": paths,
117
  })
118
 
119
  # Filter misclassified rows if needed
120
- if args.save_missclassified_only:
121
- df = df[df["predicted"] != df["true"]]
122
 
123
- print(df[["patient_id", "predicted", "true"]])
124
  # Ensure output directory exists
125
  output_path = Path(args.output_csv)
126
  output_path.parent.mkdir(parents=True, exist_ok=True)
127
 
128
  # Save predictions
129
  df.to_csv(args.output_csv, index=False)
130
- print(f"✅ Saved predictions to {args.output_csv}")
131
  print(f"\n🔎 Processed {len(preds)} samples ({'missclassified only' if args.save_misclassified_only else 'all'}).")
132
 
133
  # print classification report + metrics if labels exist
134
- if all(label in ["low", "medium", "high"] for label in true_labels):
135
  print("\n📊 Classification Report:")
136
- print(classification_report(true_labels, pred_labels))
137
 
138
- acc = accuracy_score(true_labels, pred_labels)
139
- f1 = f1_score(true_labels, pred_labels, average="weighted")
140
  print(f"\n🎯 Accuracy: {acc:.4f}")
141
- print(f"🎯 Weighted F1 Score: {f1:.4f}")
142
 
143
 
144
  if __name__ == "__main__":
 
26
  all_preds, all_truths = [], []
27
  all_texts, all_paths, all_ids = [], [], []
28
 
29
+ inv_map = {0: "low", 1: "medium", 2: "high"}
30
+
31
  with torch.no_grad():
32
  for batch in tqdm(dataloader, desc="Running inference"):
33
  input_ids = batch.get("input_ids", None)
 
44
  preds = torch.argmax(outputs, dim=1).cpu().tolist()
45
  all_preds.extend(preds)
46
 
47
+ batch_size = len(preds)
48
+
49
+ # Patient ID (original from dataset)
50
+ all_ids.extend(batch["patient_id"])
51
+
52
+ # EMR Text
53
+ all_texts.extend(batch.get("emr_text", [""] * batch_size))
54
+
55
+ # Image Path
56
+ all_paths.extend(batch.get("image_path", [""] * batch_size))
57
+
58
+ # True Labels
59
+ if "label" in batch:
60
+ all_truths.extend([inv_map.get(label.item(), "") for label in batch["label"]])
61
+ else:
62
+ all_truths.extend([""] * batch_size)
63
 
64
  return all_preds, all_truths, all_texts, all_paths, all_ids
65
 
 
119
  preds, truths, texts, paths, ids = predict(model, dataloader, DEVICE)
120
 
121
  label_inv_map = inverse_label_map()
122
+ pred_labels = [label_inv_map[p] for p in preds]
 
123
 
124
  df = pd.DataFrame({
125
  "patient_id": ids,
126
  "predicted": pred_labels,
127
+ "truth_label": truths,
128
  "emr_text": texts,
129
  "image_path": paths,
130
  })
131
 
132
  # Filter misclassified rows if needed
133
+ if args.save_misclassified_only:
134
+ df = df[df["predicted"] != df["truth_label"]]
135
 
136
+ print(df[["patient_id", "predicted", "truth_label"]])
137
  # Ensure output directory exists
138
  output_path = Path(args.output_csv)
139
  output_path.parent.mkdir(parents=True, exist_ok=True)
140
 
141
  # Save predictions
142
  df.to_csv(args.output_csv, index=False)
143
+ print(f"✅ Saved predictions to {output_path}")
144
  print(f"\n🔎 Processed {len(preds)} samples ({'missclassified only' if args.save_misclassified_only else 'all'}).")
145
 
146
  # print classification report + metrics if labels exist
147
+ if all(label in ["low", "medium", "high"] for label in truths):
148
  print("\n📊 Classification Report:")
149
+ print(classification_report(truths, pred_labels))
150
 
151
+ acc = accuracy_score(truths, pred_labels)
152
+ f1 = f1_score(truths, pred_labels, average="weighted")
153
  print(f"\n🎯 Accuracy: {acc:.4f}")
154
+ print(f"\n🎯 Weighted F1 Score: {f1:.4f}")
155
 
156
 
157
  if __name__ == "__main__":
predictions_image_20250725_201612.csv ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ patient_id,predicted,truth_label,emr_text,image_path
2
+ COVID-8,high,high,"Patient TEST-DC29, a 55 years old individual presented after experiencing symptoms for approximately 10 days. Patient remains oriented with stable hemodynamics. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 100.8°F and an oxygen saturation level of 87%. No definitive pattern observed; further evaluation is warranted. No remarkable family history or chronic illness reported. Anosmia has been intermittently observed over recent days.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1640.png
3
+ NORMAL-6,low,low,"Patient TEST-RF26, a 42 years old individual presented after experiencing symptoms for approximately 6 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Standard precautions have been advised post-evaluation. Vital measurements include a body temperature of 98.6°F and an oxygen saturation level of 98%. No prior admissions or surgical history disclosed. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-2223.png
4
+ VIRAL PNEUMONIA-5,high,medium,"Patient TEST-NP02, a 75 years old individual presented after experiencing symptoms for approximately 9 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 92%. No definitive pattern observed; further evaluation is warranted. Patient remains oriented with stable hemodynamics. Radiographic evidence reveals dispersed infiltrative patterns.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-1101.png
5
+ NORMAL-2,low,low,"Patient TEST-AJ06, a 50 years old individual presented after experiencing symptoms for approximately 4 days. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 97.9°F and an oxygen saturation level of 95%. Diagnosis remains unclear pending further laboratory confirmation. No prior admissions or surgical history disclosed.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-7819.png
6
+ COVID-10,high,high,"Patient TEST-DF19, a 68 years old individual presented after experiencing symptoms for approximately 7 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 102.4°F and an oxygen saturation level of 92%. No prior admissions or surgical history disclosed. No definitive pattern observed; further evaluation is warranted.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-418.png
7
+ COVID-5,high,high,"Patient TEST-RI51, a 46 years old individual presented after experiencing symptoms for approximately 6 days. Nutritional intake and sleep patterns appear adequate. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 99.4°F and an oxygen saturation level of 89%. No remarkable family history or chronic illness reported. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-653.png
8
+ VIRAL PNEUMONIA-8,medium,medium,"Patient TEST-CD95, a 64 years old individual presented after experiencing symptoms for approximately 8 days. Episodes of throat irritation and general malaise observed. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 100.9°F and an oxygen saturation level of 96%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-1286.png
9
+ COVID-3,high,high,"Patient TEST-KO00, a 56 years old individual presented after experiencing symptoms for approximately 3 days. No prior admissions or surgical history disclosed. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 100.2°F and an oxygen saturation level of 89%. No prior admissions or surgical history disclosed. No definitive pattern observed; further evaluation is warranted.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-2258.png
10
+ NORMAL-5,low,low,"Patient TEST-EK85, a 79 years old individual presented after experiencing symptoms for approximately 5 days. Episodes of throat irritation and general malaise observed. No remarkable family history or chronic illness reported. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 98.0°F and an oxygen saturation level of 97%. No definitive pattern observed; further evaluation is warranted.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-1365.png
11
+ VIRAL PNEUMONIA-6,medium,medium,"Patient TEST-DY43, a 75 years old individual presented after experiencing symptoms for approximately 5 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 100.7°F and an oxygen saturation level of 95%. Nutritional intake and sleep patterns appear adequate. No remarkable family history or chronic illness reported. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-927.png
12
+ COVID-7,high,high,"Patient TEST-DN15, a 37 years old individual presented after experiencing symptoms for approximately 10 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 91%. Preliminary indicators fall into a diagnostic grey area. No remarkable family history or chronic illness reported. Anosmia has been intermittently observed over recent days.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1085.png
13
+ NORMAL-7,low,low,"Patient TEST-QU92, a 85 years old individual presented after experiencing symptoms for approximately 3 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.2°F and an oxygen saturation level of 97%. Nutritional intake and sleep patterns appear adequate. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-7874.png
14
+ COVID-6,high,high,"Patient TEST-YM73, a 65 years old individual presented after experiencing symptoms for approximately 2 days. Episodes of throat irritation and general malaise observed. Nutritional intake and sleep patterns appear adequate. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 100.0°F and an oxygen saturation level of 93%. Diagnosis remains unclear pending further laboratory confirmation. Anosmia has been intermittently observed over recent days.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1399.png
15
+ NORMAL-1,low,low,"Patient TEST-HN49, a 34 years old individual presented after experiencing symptoms for approximately 9 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 98.4°F and an oxygen saturation level of 99%. No prior admissions or surgical history disclosed. No prior admissions or surgical history disclosed. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-1925.png
16
+ NORMAL-4,high,low,"Patient TEST-QE09, a 52 years old individual presented after experiencing symptoms for approximately 7 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.2°F and an oxygen saturation level of 95%. Preliminary indicators fall into a diagnostic grey area. There are currently no active complaints from the patient.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-3320.png
17
+ VIRAL PNEUMONIA-1,medium,medium,"Patient TEST-HR49, a 61 years old individual presented after experiencing symptoms for approximately 5 days. No remarkable family history or chronic illness reported. Patient remains oriented with stable hemodynamics. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 99.5°F and an oxygen saturation level of 90%. Preliminary indicators fall into a diagnostic grey area. Radiographic evidence reveals dispersed infiltrative patterns.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-144.png
18
+ NORMAL-8,low,low,"Patient TEST-RW12, a 54 years old individual presented after experiencing symptoms for approximately 5 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 98.4°F and an oxygen saturation level of 96%. Presentation overlaps multiple pulmonary conditions. Nutritional intake and sleep patterns appear adequate.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-4447.png
19
+ VIRAL PNEUMONIA-9,medium,medium,"Patient TEST-ZO32, a 20 years old individual presented after experiencing symptoms for approximately 10 days. Standard precautions have been advised post-evaluation. No remarkable family history or chronic illness reported. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 101.2°F and an oxygen saturation level of 92%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-261.png
20
+ VIRAL PNEUMONIA-10,medium,medium,"Patient TEST-CU46, a 40 years old individual presented after experiencing symptoms for approximately 8 days. No prior admissions or surgical history disclosed. A gradual onset of dry cough with mild respiratory discomfort has been documented. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 95%. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-166.png
21
+ COVID-1,high,high,"Patient TEST-FB14, a 40 years old individual presented after experiencing symptoms for approximately 7 days. Nutritional intake and sleep patterns appear adequate. The patient has noted intermittent chest pressure and occasional shortness of breath. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 98.9°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-3380.png
22
+ COVID-2,high,high,"Patient TEST-HB66, a 73 years old individual presented after experiencing symptoms for approximately 10 days. Mild respiratory symptoms have progressed over several days. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 99.3°F and an oxygen saturation level of 89%. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1410.png
23
+ NORMAL-3,high,low,"Patient TEST-KX40, a 39 years old individual presented after experiencing symptoms for approximately 2 days. Reported complaints include mild fatigue and sporadic episodes of wheezing. No prior admissions or surgical history disclosed. No prior admissions or surgical history disclosed. Vital measurements include a body temperature of 97.6°F and an oxygen saturation level of 95%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-5988.png
24
+ COVID-9,low,high,"Patient TEST-JK08, a 64 years old individual presented after experiencing symptoms for approximately 7 days. Nutritional intake and sleep patterns appear adequate. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 100.0°F and an oxygen saturation level of 93%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-2796.png
25
+ VIRAL PNEUMONIA-3,medium,medium,"Patient TEST-RZ58, a 84 years old individual presented after experiencing symptoms for approximately 4 days. Reported complaints include mild fatigue and sporadic episodes of wheezing. Vital measurements include a body temperature of 100.3°F and an oxygen saturation level of 91%. No remarkable family history or chronic illness reported. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-843.png
26
+ NORMAL-9,low,low,"Patient TEST-SG97, a 24 years old individual presented after experiencing symptoms for approximately 10 days. Standard precautions have been advised post-evaluation. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.7°F and an oxygen saturation level of 100%. Presentation overlaps multiple pulmonary conditions.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-4888.png
27
+ VIRAL PNEUMONIA-2,medium,medium,"Patient TEST-OG12, a 74 years old individual presented after experiencing symptoms for approximately 3 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 101.3°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions. No prior admissions or surgical history disclosed.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-396.png
28
+ COVID-4,high,high,"Patient TEST-KY96, a 83 years old individual presented after experiencing symptoms for approximately 6 days. Patient remains oriented with stable hemodynamics. Reported complaints include mild fatigue and sporadic episodes of wheezing. Vital measurements include a body temperature of 99.9°F and an oxygen saturation level of 94%. Presentation overlaps multiple pulmonary conditions. Nutritional intake and sleep patterns appear adequate.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1639.png
29
+ VIRAL PNEUMONIA-7,medium,medium,"Patient TEST-ZK84, a 52 years old individual presented after experiencing symptoms for approximately 1 days. Patient remains oriented with stable hemodynamics. Episodes of throat irritation and general malaise observed. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 99.7°F and an oxygen saturation level of 91%. Clinical features are suggestive of a nonspecific viral etiology.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-397.png
30
+ NORMAL-10,high,low,"Patient TEST-PW53, a 51 years old individual presented after experiencing symptoms for approximately 9 days. Standard precautions have been advised post-evaluation. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 97.6°F and an oxygen saturation level of 97%. Diagnosis remains unclear pending further laboratory confirmation. No prior admissions or surgical history disclosed.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-1943.png
31
+ VIRAL PNEUMONIA-4,medium,medium,"Patient TEST-PP31, a 38 years old individual presented after experiencing symptoms for approximately 3 days. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 102.1°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions. Patient remains oriented with stable hemodynamics. Radiographic evidence reveals dispersed infiltrative patterns.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-411.png
predictions_multimodal_20250725_201743.csv ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ patient_id,predicted,truth_label,emr_text,image_path
2
+ COVID-8,high,high,"Patient TEST-DC29, a 55 years old individual presented after experiencing symptoms for approximately 10 days. Patient remains oriented with stable hemodynamics. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 100.8°F and an oxygen saturation level of 87%. No definitive pattern observed; further evaluation is warranted. No remarkable family history or chronic illness reported. Anosmia has been intermittently observed over recent days.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1640.png
3
+ NORMAL-6,low,low,"Patient TEST-RF26, a 42 years old individual presented after experiencing symptoms for approximately 6 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Standard precautions have been advised post-evaluation. Vital measurements include a body temperature of 98.6°F and an oxygen saturation level of 98%. No prior admissions or surgical history disclosed. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-2223.png
4
+ VIRAL PNEUMONIA-5,medium,medium,"Patient TEST-NP02, a 75 years old individual presented after experiencing symptoms for approximately 9 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 92%. No definitive pattern observed; further evaluation is warranted. Patient remains oriented with stable hemodynamics. Radiographic evidence reveals dispersed infiltrative patterns.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-1101.png
5
+ NORMAL-2,low,low,"Patient TEST-AJ06, a 50 years old individual presented after experiencing symptoms for approximately 4 days. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 97.9°F and an oxygen saturation level of 95%. Diagnosis remains unclear pending further laboratory confirmation. No prior admissions or surgical history disclosed.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-7819.png
6
+ COVID-10,high,high,"Patient TEST-DF19, a 68 years old individual presented after experiencing symptoms for approximately 7 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 102.4°F and an oxygen saturation level of 92%. No prior admissions or surgical history disclosed. No definitive pattern observed; further evaluation is warranted.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-418.png
7
+ COVID-5,high,high,"Patient TEST-RI51, a 46 years old individual presented after experiencing symptoms for approximately 6 days. Nutritional intake and sleep patterns appear adequate. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 99.4°F and an oxygen saturation level of 89%. No remarkable family history or chronic illness reported. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-653.png
8
+ VIRAL PNEUMONIA-8,medium,medium,"Patient TEST-CD95, a 64 years old individual presented after experiencing symptoms for approximately 8 days. Episodes of throat irritation and general malaise observed. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 100.9°F and an oxygen saturation level of 96%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-1286.png
9
+ COVID-3,high,high,"Patient TEST-KO00, a 56 years old individual presented after experiencing symptoms for approximately 3 days. No prior admissions or surgical history disclosed. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 100.2°F and an oxygen saturation level of 89%. No prior admissions or surgical history disclosed. No definitive pattern observed; further evaluation is warranted.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-2258.png
10
+ NORMAL-5,low,low,"Patient TEST-EK85, a 79 years old individual presented after experiencing symptoms for approximately 5 days. Episodes of throat irritation and general malaise observed. No remarkable family history or chronic illness reported. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 98.0°F and an oxygen saturation level of 97%. No definitive pattern observed; further evaluation is warranted.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-1365.png
11
+ VIRAL PNEUMONIA-6,high,medium,"Patient TEST-DY43, a 75 years old individual presented after experiencing symptoms for approximately 5 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 100.7°F and an oxygen saturation level of 95%. Nutritional intake and sleep patterns appear adequate. No remarkable family history or chronic illness reported. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-927.png
12
+ COVID-7,high,high,"Patient TEST-DN15, a 37 years old individual presented after experiencing symptoms for approximately 10 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 91%. Preliminary indicators fall into a diagnostic grey area. No remarkable family history or chronic illness reported. Anosmia has been intermittently observed over recent days.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1085.png
13
+ NORMAL-7,low,low,"Patient TEST-QU92, a 85 years old individual presented after experiencing symptoms for approximately 3 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.2°F and an oxygen saturation level of 97%. Nutritional intake and sleep patterns appear adequate. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-7874.png
14
+ COVID-6,high,high,"Patient TEST-YM73, a 65 years old individual presented after experiencing symptoms for approximately 2 days. Episodes of throat irritation and general malaise observed. Nutritional intake and sleep patterns appear adequate. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 100.0°F and an oxygen saturation level of 93%. Diagnosis remains unclear pending further laboratory confirmation. Anosmia has been intermittently observed over recent days.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1399.png
15
+ NORMAL-1,low,low,"Patient TEST-HN49, a 34 years old individual presented after experiencing symptoms for approximately 9 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 98.4°F and an oxygen saturation level of 99%. No prior admissions or surgical history disclosed. No prior admissions or surgical history disclosed. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-1925.png
16
+ NORMAL-4,low,low,"Patient TEST-QE09, a 52 years old individual presented after experiencing symptoms for approximately 7 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.2°F and an oxygen saturation level of 95%. Preliminary indicators fall into a diagnostic grey area. There are currently no active complaints from the patient.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-3320.png
17
+ VIRAL PNEUMONIA-1,medium,medium,"Patient TEST-HR49, a 61 years old individual presented after experiencing symptoms for approximately 5 days. No remarkable family history or chronic illness reported. Patient remains oriented with stable hemodynamics. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 99.5°F and an oxygen saturation level of 90%. Preliminary indicators fall into a diagnostic grey area. Radiographic evidence reveals dispersed infiltrative patterns.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-144.png
18
+ NORMAL-8,low,low,"Patient TEST-RW12, a 54 years old individual presented after experiencing symptoms for approximately 5 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 98.4°F and an oxygen saturation level of 96%. Presentation overlaps multiple pulmonary conditions. Nutritional intake and sleep patterns appear adequate.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-4447.png
19
+ VIRAL PNEUMONIA-9,medium,medium,"Patient TEST-ZO32, a 20 years old individual presented after experiencing symptoms for approximately 10 days. Standard precautions have been advised post-evaluation. No remarkable family history or chronic illness reported. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 101.2°F and an oxygen saturation level of 92%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-261.png
20
+ VIRAL PNEUMONIA-10,medium,medium,"Patient TEST-CU46, a 40 years old individual presented after experiencing symptoms for approximately 8 days. No prior admissions or surgical history disclosed. A gradual onset of dry cough with mild respiratory discomfort has been documented. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 95%. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-166.png
21
+ COVID-1,high,high,"Patient TEST-FB14, a 40 years old individual presented after experiencing symptoms for approximately 7 days. Nutritional intake and sleep patterns appear adequate. The patient has noted intermittent chest pressure and occasional shortness of breath. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 98.9°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-3380.png
22
+ COVID-2,high,high,"Patient TEST-HB66, a 73 years old individual presented after experiencing symptoms for approximately 10 days. Mild respiratory symptoms have progressed over several days. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 99.3°F and an oxygen saturation level of 89%. Diagnosis remains unclear pending further laboratory confirmation.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1410.png
23
+ NORMAL-3,low,low,"Patient TEST-KX40, a 39 years old individual presented after experiencing symptoms for approximately 2 days. Reported complaints include mild fatigue and sporadic episodes of wheezing. No prior admissions or surgical history disclosed. No prior admissions or surgical history disclosed. Vital measurements include a body temperature of 97.6°F and an oxygen saturation level of 95%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-5988.png
24
+ COVID-9,high,high,"Patient TEST-JK08, a 64 years old individual presented after experiencing symptoms for approximately 7 days. Nutritional intake and sleep patterns appear adequate. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 100.0°F and an oxygen saturation level of 93%. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-2796.png
25
+ VIRAL PNEUMONIA-3,high,medium,"Patient TEST-RZ58, a 84 years old individual presented after experiencing symptoms for approximately 4 days. Reported complaints include mild fatigue and sporadic episodes of wheezing. Vital measurements include a body temperature of 100.3°F and an oxygen saturation level of 91%. No remarkable family history or chronic illness reported. Preliminary indicators fall into a diagnostic grey area.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-843.png
26
+ NORMAL-9,low,low,"Patient TEST-SG97, a 24 years old individual presented after experiencing symptoms for approximately 10 days. Standard precautions have been advised post-evaluation. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.7°F and an oxygen saturation level of 100%. Presentation overlaps multiple pulmonary conditions.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-4888.png
27
+ VIRAL PNEUMONIA-2,medium,medium,"Patient TEST-OG12, a 74 years old individual presented after experiencing symptoms for approximately 3 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 101.3°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions. No prior admissions or surgical history disclosed.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-396.png
28
+ COVID-4,low,high,"Patient TEST-KY96, a 83 years old individual presented after experiencing symptoms for approximately 6 days. Patient remains oriented with stable hemodynamics. Reported complaints include mild fatigue and sporadic episodes of wheezing. Vital measurements include a body temperature of 99.9°F and an oxygen saturation level of 94%. Presentation overlaps multiple pulmonary conditions. Nutritional intake and sleep patterns appear adequate.",/Users/preetham_ravula/projects/medi-llm/data/images/COVID/COVID-1639.png
29
+ VIRAL PNEUMONIA-7,high,medium,"Patient TEST-ZK84, a 52 years old individual presented after experiencing symptoms for approximately 1 days. Patient remains oriented with stable hemodynamics. Episodes of throat irritation and general malaise observed. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 99.7°F and an oxygen saturation level of 91%. Clinical features are suggestive of a nonspecific viral etiology.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-397.png
30
+ NORMAL-10,low,low,"Patient TEST-PW53, a 51 years old individual presented after experiencing symptoms for approximately 9 days. Standard precautions have been advised post-evaluation. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 97.6°F and an oxygen saturation level of 97%. Diagnosis remains unclear pending further laboratory confirmation. No prior admissions or surgical history disclosed.",/Users/preetham_ravula/projects/medi-llm/data/images/NORMAL/Normal-1943.png
31
+ VIRAL PNEUMONIA-4,medium,medium,"Patient TEST-PP31, a 38 years old individual presented after experiencing symptoms for approximately 3 days. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 102.1°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions. Patient remains oriented with stable hemodynamics. Radiographic evidence reveals dispersed infiltrative patterns.",/Users/preetham_ravula/projects/medi-llm/data/images/VIRAL PNEUMONIA/Viral Pneumonia-411.png
predictions_text_20250725_201433.csv ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ patient_id,predicted,truth_label,emr_text,image_path
2
+ COVID-8,high,high,"Patient TEST-DC29, a 55 years old individual presented after experiencing symptoms for approximately 10 days. Patient remains oriented with stable hemodynamics. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 100.8°F and an oxygen saturation level of 87%. No definitive pattern observed; further evaluation is warranted. No remarkable family history or chronic illness reported. Anosmia has been intermittently observed over recent days.",data/images/COVID/COVID-1640.png
3
+ NORMAL-6,low,low,"Patient TEST-RF26, a 42 years old individual presented after experiencing symptoms for approximately 6 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Standard precautions have been advised post-evaluation. Vital measurements include a body temperature of 98.6°F and an oxygen saturation level of 98%. No prior admissions or surgical history disclosed. Diagnosis remains unclear pending further laboratory confirmation.",data/images/NORMAL/Normal-2223.png
4
+ VIRAL PNEUMONIA-5,medium,medium,"Patient TEST-NP02, a 75 years old individual presented after experiencing symptoms for approximately 9 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 92%. No definitive pattern observed; further evaluation is warranted. Patient remains oriented with stable hemodynamics. Radiographic evidence reveals dispersed infiltrative patterns.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-1101.png
5
+ NORMAL-2,low,low,"Patient TEST-AJ06, a 50 years old individual presented after experiencing symptoms for approximately 4 days. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 97.9°F and an oxygen saturation level of 95%. Diagnosis remains unclear pending further laboratory confirmation. No prior admissions or surgical history disclosed.",data/images/NORMAL/Normal-7819.png
6
+ COVID-10,medium,high,"Patient TEST-DF19, a 68 years old individual presented after experiencing symptoms for approximately 7 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 102.4°F and an oxygen saturation level of 92%. No prior admissions or surgical history disclosed. No definitive pattern observed; further evaluation is warranted.",data/images/COVID/COVID-418.png
7
+ COVID-5,high,high,"Patient TEST-RI51, a 46 years old individual presented after experiencing symptoms for approximately 6 days. Nutritional intake and sleep patterns appear adequate. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 99.4°F and an oxygen saturation level of 89%. No remarkable family history or chronic illness reported. Diagnosis remains unclear pending further laboratory confirmation.",data/images/COVID/COVID-653.png
8
+ VIRAL PNEUMONIA-8,medium,medium,"Patient TEST-CD95, a 64 years old individual presented after experiencing symptoms for approximately 8 days. Episodes of throat irritation and general malaise observed. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 100.9°F and an oxygen saturation level of 96%. Preliminary indicators fall into a diagnostic grey area.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-1286.png
9
+ COVID-3,high,high,"Patient TEST-KO00, a 56 years old individual presented after experiencing symptoms for approximately 3 days. No prior admissions or surgical history disclosed. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 100.2°F and an oxygen saturation level of 89%. No prior admissions or surgical history disclosed. No definitive pattern observed; further evaluation is warranted.",data/images/COVID/COVID-2258.png
10
+ NORMAL-5,low,low,"Patient TEST-EK85, a 79 years old individual presented after experiencing symptoms for approximately 5 days. Episodes of throat irritation and general malaise observed. No remarkable family history or chronic illness reported. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 98.0°F and an oxygen saturation level of 97%. No definitive pattern observed; further evaluation is warranted.",data/images/NORMAL/Normal-1365.png
11
+ VIRAL PNEUMONIA-6,medium,medium,"Patient TEST-DY43, a 75 years old individual presented after experiencing symptoms for approximately 5 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 100.7°F and an oxygen saturation level of 95%. Nutritional intake and sleep patterns appear adequate. No remarkable family history or chronic illness reported. Diagnosis remains unclear pending further laboratory confirmation.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-927.png
12
+ COVID-7,high,high,"Patient TEST-DN15, a 37 years old individual presented after experiencing symptoms for approximately 10 days. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 91%. Preliminary indicators fall into a diagnostic grey area. No remarkable family history or chronic illness reported. Anosmia has been intermittently observed over recent days.",data/images/COVID/COVID-1085.png
13
+ NORMAL-7,low,low,"Patient TEST-QU92, a 85 years old individual presented after experiencing symptoms for approximately 3 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.2°F and an oxygen saturation level of 97%. Nutritional intake and sleep patterns appear adequate. Preliminary indicators fall into a diagnostic grey area.",data/images/NORMAL/Normal-7874.png
14
+ COVID-6,medium,high,"Patient TEST-YM73, a 65 years old individual presented after experiencing symptoms for approximately 2 days. Episodes of throat irritation and general malaise observed. Nutritional intake and sleep patterns appear adequate. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 100.0°F and an oxygen saturation level of 93%. Diagnosis remains unclear pending further laboratory confirmation. Anosmia has been intermittently observed over recent days.",data/images/COVID/COVID-1399.png
15
+ NORMAL-1,low,low,"Patient TEST-HN49, a 34 years old individual presented after experiencing symptoms for approximately 9 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 98.4°F and an oxygen saturation level of 99%. No prior admissions or surgical history disclosed. No prior admissions or surgical history disclosed. Preliminary indicators fall into a diagnostic grey area.",data/images/NORMAL/Normal-1925.png
16
+ NORMAL-4,low,low,"Patient TEST-QE09, a 52 years old individual presented after experiencing symptoms for approximately 7 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.2°F and an oxygen saturation level of 95%. Preliminary indicators fall into a diagnostic grey area. There are currently no active complaints from the patient.",data/images/NORMAL/Normal-3320.png
17
+ VIRAL PNEUMONIA-1,medium,medium,"Patient TEST-HR49, a 61 years old individual presented after experiencing symptoms for approximately 5 days. No remarkable family history or chronic illness reported. Patient remains oriented with stable hemodynamics. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 99.5°F and an oxygen saturation level of 90%. Preliminary indicators fall into a diagnostic grey area. Radiographic evidence reveals dispersed infiltrative patterns.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-144.png
18
+ NORMAL-8,low,low,"Patient TEST-RW12, a 54 years old individual presented after experiencing symptoms for approximately 5 days. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 98.4°F and an oxygen saturation level of 96%. Presentation overlaps multiple pulmonary conditions. Nutritional intake and sleep patterns appear adequate.",data/images/NORMAL/Normal-4447.png
19
+ VIRAL PNEUMONIA-9,medium,medium,"Patient TEST-ZO32, a 20 years old individual presented after experiencing symptoms for approximately 10 days. Standard precautions have been advised post-evaluation. No remarkable family history or chronic illness reported. A gradual onset of dry cough with mild respiratory discomfort has been documented. Vital measurements include a body temperature of 101.2°F and an oxygen saturation level of 92%. Preliminary indicators fall into a diagnostic grey area.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-261.png
20
+ VIRAL PNEUMONIA-10,medium,medium,"Patient TEST-CU46, a 40 years old individual presented after experiencing symptoms for approximately 8 days. No prior admissions or surgical history disclosed. A gradual onset of dry cough with mild respiratory discomfort has been documented. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 99.1°F and an oxygen saturation level of 95%. Diagnosis remains unclear pending further laboratory confirmation.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-166.png
21
+ COVID-1,medium,high,"Patient TEST-FB14, a 40 years old individual presented after experiencing symptoms for approximately 7 days. Nutritional intake and sleep patterns appear adequate. The patient has noted intermittent chest pressure and occasional shortness of breath. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 98.9°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions.",data/images/COVID/COVID-3380.png
22
+ COVID-2,high,high,"Patient TEST-HB66, a 73 years old individual presented after experiencing symptoms for approximately 10 days. Mild respiratory symptoms have progressed over several days. Nutritional intake and sleep patterns appear adequate. Vital measurements include a body temperature of 99.3°F and an oxygen saturation level of 89%. Diagnosis remains unclear pending further laboratory confirmation.",data/images/COVID/COVID-1410.png
23
+ NORMAL-3,low,low,"Patient TEST-KX40, a 39 years old individual presented after experiencing symptoms for approximately 2 days. Reported complaints include mild fatigue and sporadic episodes of wheezing. No prior admissions or surgical history disclosed. No prior admissions or surgical history disclosed. Vital measurements include a body temperature of 97.6°F and an oxygen saturation level of 95%. Preliminary indicators fall into a diagnostic grey area.",data/images/NORMAL/Normal-5988.png
24
+ COVID-9,medium,high,"Patient TEST-JK08, a 64 years old individual presented after experiencing symptoms for approximately 7 days. Nutritional intake and sleep patterns appear adequate. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 100.0°F and an oxygen saturation level of 93%. Preliminary indicators fall into a diagnostic grey area.",data/images/COVID/COVID-2796.png
25
+ VIRAL PNEUMONIA-3,medium,medium,"Patient TEST-RZ58, a 84 years old individual presented after experiencing symptoms for approximately 4 days. Reported complaints include mild fatigue and sporadic episodes of wheezing. Vital measurements include a body temperature of 100.3°F and an oxygen saturation level of 91%. No remarkable family history or chronic illness reported. Preliminary indicators fall into a diagnostic grey area.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-843.png
26
+ NORMAL-9,low,low,"Patient TEST-SG97, a 24 years old individual presented after experiencing symptoms for approximately 10 days. Standard precautions have been advised post-evaluation. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 98.7°F and an oxygen saturation level of 100%. Presentation overlaps multiple pulmonary conditions.",data/images/NORMAL/Normal-4888.png
27
+ VIRAL PNEUMONIA-2,medium,medium,"Patient TEST-OG12, a 74 years old individual presented after experiencing symptoms for approximately 3 days. Mild respiratory symptoms have progressed over several days. Vital measurements include a body temperature of 101.3°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions. No prior admissions or surgical history disclosed.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-396.png
28
+ COVID-4,medium,high,"Patient TEST-KY96, a 83 years old individual presented after experiencing symptoms for approximately 6 days. Patient remains oriented with stable hemodynamics. Reported complaints include mild fatigue and sporadic episodes of wheezing. Vital measurements include a body temperature of 99.9°F and an oxygen saturation level of 94%. Presentation overlaps multiple pulmonary conditions. Nutritional intake and sleep patterns appear adequate.",data/images/COVID/COVID-1639.png
29
+ VIRAL PNEUMONIA-7,medium,medium,"Patient TEST-ZK84, a 52 years old individual presented after experiencing symptoms for approximately 1 days. Patient remains oriented with stable hemodynamics. Episodes of throat irritation and general malaise observed. No remarkable family history or chronic illness reported. Vital measurements include a body temperature of 99.7°F and an oxygen saturation level of 91%. Clinical features are suggestive of a nonspecific viral etiology.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-397.png
30
+ NORMAL-10,low,low,"Patient TEST-PW53, a 51 years old individual presented after experiencing symptoms for approximately 9 days. Standard precautions have been advised post-evaluation. The patient has noted intermittent chest pressure and occasional shortness of breath. Vital measurements include a body temperature of 97.6°F and an oxygen saturation level of 97%. Diagnosis remains unclear pending further laboratory confirmation. No prior admissions or surgical history disclosed.",data/images/NORMAL/Normal-1943.png
31
+ VIRAL PNEUMONIA-4,medium,medium,"Patient TEST-PP31, a 38 years old individual presented after experiencing symptoms for approximately 3 days. Episodes of throat irritation and general malaise observed. Vital measurements include a body temperature of 102.1°F and an oxygen saturation level of 91%. Presentation overlaps multiple pulmonary conditions. Patient remains oriented with stable hemodynamics. Radiographic evidence reveals dispersed infiltrative patterns.",data/images/VIRAL PNEUMONIA/Viral Pneumonia-411.png
results/classification_report_image.json CHANGED
@@ -1,33 +1,33 @@
1
  {
2
  "low": {
3
- "precision": 0.7076923076923077,
4
- "recall": 0.7666666666666667,
5
- "f1-score": 0.736,
6
  "support": 60.0
7
  },
8
  "medium": {
9
- "precision": 0.9454545454545454,
10
  "recall": 0.8666666666666667,
11
- "f1-score": 0.9043478260869565,
12
  "support": 60.0
13
  },
14
  "high": {
15
- "precision": 0.8,
16
- "recall": 0.8,
17
- "f1-score": 0.8,
18
  "support": 60.0
19
  },
20
- "accuracy": 0.8111111111111111,
21
  "macro avg": {
22
- "precision": 0.8177156177156176,
23
- "recall": 0.8111111111111112,
24
- "f1-score": 0.8134492753623187,
25
  "support": 180.0
26
  },
27
  "weighted avg": {
28
- "precision": 0.8177156177156177,
29
- "recall": 0.8111111111111111,
30
- "f1-score": 0.8134492753623189,
31
  "support": 180.0
32
  }
33
  }
 
1
  {
2
  "low": {
3
+ "precision": 0.7288135593220338,
4
+ "recall": 0.7166666666666667,
5
+ "f1-score": 0.7226890756302521,
6
  "support": 60.0
7
  },
8
  "medium": {
9
+ "precision": 0.8524590163934426,
10
  "recall": 0.8666666666666667,
11
+ "f1-score": 0.859504132231405,
12
  "support": 60.0
13
  },
14
  "high": {
15
+ "precision": 0.7833333333333333,
16
+ "recall": 0.7833333333333333,
17
+ "f1-score": 0.7833333333333333,
18
  "support": 60.0
19
  },
20
+ "accuracy": 0.7888888888888889,
21
  "macro avg": {
22
+ "precision": 0.7882019696829365,
23
+ "recall": 0.7888888888888889,
24
+ "f1-score": 0.7885088470649967,
25
  "support": 180.0
26
  },
27
  "weighted avg": {
28
+ "precision": 0.7882019696829367,
29
+ "recall": 0.7888888888888889,
30
+ "f1-score": 0.7885088470649968,
31
  "support": 180.0
32
  }
33
  }
results/classification_report_multimodal.json CHANGED
@@ -1,33 +1,33 @@
1
  {
2
  "low": {
3
- "precision": 1.0,
4
- "recall": 0.9833333333333333,
5
- "f1-score": 0.9915966386554622,
6
  "support": 60.0
7
  },
8
  "medium": {
9
  "precision": 1.0,
10
- "recall": 0.8666666666666667,
11
- "f1-score": 0.9285714285714286,
12
  "support": 60.0
13
  },
14
  "high": {
15
- "precision": 0.8695652173913043,
16
  "recall": 1.0,
17
- "f1-score": 0.9302325581395349,
18
  "support": 60.0
19
  },
20
- "accuracy": 0.95,
21
  "macro avg": {
22
- "precision": 0.9565217391304347,
23
- "recall": 0.9500000000000001,
24
- "f1-score": 0.9501335417888086,
25
  "support": 180.0
26
  },
27
  "weighted avg": {
28
- "precision": 0.9565217391304347,
29
- "recall": 0.95,
30
- "f1-score": 0.9501335417888085,
31
  "support": 180.0
32
  }
33
  }
 
1
  {
2
  "low": {
3
+ "precision": 0.9836065573770492,
4
+ "recall": 1.0,
5
+ "f1-score": 0.9917355371900827,
6
  "support": 60.0
7
  },
8
  "medium": {
9
  "precision": 1.0,
10
+ "recall": 0.95,
11
+ "f1-score": 0.9743589743589743,
12
  "support": 60.0
13
  },
14
  "high": {
15
+ "precision": 0.967741935483871,
16
  "recall": 1.0,
17
+ "f1-score": 0.9836065573770492,
18
  "support": 60.0
19
  },
20
+ "accuracy": 0.9833333333333333,
21
  "macro avg": {
22
+ "precision": 0.9837828309536402,
23
+ "recall": 0.9833333333333334,
24
+ "f1-score": 0.9832336896420353,
25
  "support": 180.0
26
  },
27
  "weighted avg": {
28
+ "precision": 0.98378283095364,
29
+ "recall": 0.9833333333333333,
30
+ "f1-score": 0.9832336896420354,
31
  "support": 180.0
32
  }
33
  }
results/classification_report_text.json CHANGED
@@ -1,33 +1,33 @@
1
  {
2
  "low": {
3
- "precision": 0.9523809523809523,
4
- "recall": 1.0,
5
- "f1-score": 0.975609756097561,
6
  "support": 60.0
7
  },
8
  "medium": {
9
- "precision": 0.8181818181818182,
10
- "recall": 0.75,
11
- "f1-score": 0.782608695652174,
12
  "support": 60.0
13
  },
14
  "high": {
15
- "precision": 0.7741935483870968,
16
- "recall": 0.8,
17
- "f1-score": 0.7868852459016393,
18
  "support": 60.0
19
  },
20
- "accuracy": 0.85,
21
  "macro avg": {
22
- "precision": 0.8482521063166223,
23
- "recall": 0.85,
24
- "f1-score": 0.8483678992171247,
25
  "support": 180.0
26
  },
27
  "weighted avg": {
28
- "precision": 0.8482521063166224,
29
- "recall": 0.85,
30
- "f1-score": 0.8483678992171247,
31
  "support": 180.0
32
  }
33
  }
 
1
  {
2
  "low": {
3
+ "precision": 0.9672131147540983,
4
+ "recall": 0.9833333333333333,
5
+ "f1-score": 0.9752066115702479,
6
  "support": 60.0
7
  },
8
  "medium": {
9
+ "precision": 0.7647058823529411,
10
+ "recall": 0.8666666666666667,
11
+ "f1-score": 0.8125,
12
  "support": 60.0
13
  },
14
  "high": {
15
+ "precision": 0.8627450980392157,
16
+ "recall": 0.7333333333333333,
17
+ "f1-score": 0.7927927927927928,
18
  "support": 60.0
19
  },
20
+ "accuracy": 0.8611111111111112,
21
  "macro avg": {
22
+ "precision": 0.8648880317154184,
23
+ "recall": 0.8611111111111112,
24
+ "f1-score": 0.8601664681210135,
25
  "support": 180.0
26
  },
27
  "weighted avg": {
28
+ "precision": 0.8648880317154184,
29
+ "recall": 0.8611111111111112,
30
+ "f1-score": 0.8601664681210135,
31
  "support": 180.0
32
  }
33
  }
results/metrics_image.json CHANGED
@@ -1,34 +1,34 @@
1
  {
2
  "train_acc": [
3
- 0.5180555555555556,
4
- 0.6791666666666667,
5
- 0.7652777777777777,
6
- 0.8111111111111111,
7
- 0.8347222222222223
8
  ],
9
  "val_acc": [
10
- 0.5666666666666667,
11
- 0.7555555555555555,
12
- 0.7777777777777778,
13
- 0.7833333333333333,
14
- 0.8111111111111111
15
  ],
16
  "train_f1": [
17
- 0.5137332025573597,
18
- 0.6703242558393787,
19
- 0.7633980527238039,
20
- 0.8102284861708482,
21
- 0.8336262775152254
22
  ],
23
  "val_f1": [
24
- 0.4961886334435354,
25
- 0.748110619539191,
26
- 0.7796714007240322,
27
- 0.7774577094965445,
28
- 0.8134492753623189
29
  ],
30
- "final_train_acc": 0.8347222222222223,
31
- "final_val_acc": 0.8111111111111111,
32
- "final_train_f1": 0.8336262775152254,
33
- "final_val_f1": 0.8134492753623189
34
  }
 
1
  {
2
  "train_acc": [
3
+ 0.4888888888888889,
4
+ 0.6986111111111111,
5
+ 0.7791666666666667,
6
+ 0.7555555555555555,
7
+ 0.8430555555555556
8
  ],
9
  "val_acc": [
10
+ 0.45555555555555555,
11
+ 0.48333333333333334,
12
+ 0.7666666666666667,
13
+ 0.8166666666666667,
14
+ 0.7888888888888889
15
  ],
16
  "train_f1": [
17
+ 0.48181922061091015,
18
+ 0.6887650937467082,
19
+ 0.778548540566389,
20
+ 0.7558482159219586,
21
+ 0.8426780556664499
22
  ],
23
  "val_f1": [
24
+ 0.4491433291639997,
25
+ 0.4363378684807256,
26
+ 0.7625073668664554,
27
+ 0.8150274189840973,
28
+ 0.7885088470649968
29
  ],
30
+ "final_train_acc": 0.8430555555555556,
31
+ "final_val_acc": 0.7888888888888889,
32
+ "final_train_f1": 0.8426780556664499,
33
+ "final_val_f1": 0.7885088470649968
34
  }
results/metrics_multimodal.json CHANGED
@@ -1,34 +1,34 @@
1
  {
2
  "train_acc": [
3
- 0.5138888888888888,
4
- 0.8375,
5
- 0.9291666666666667,
6
- 0.9458333333333333,
7
- 0.9611111111111111
8
  ],
9
  "val_acc": [
10
- 0.7555555555555555,
11
- 0.8555555555555555,
12
- 0.8277777777777777,
13
- 0.9388888888888889,
14
- 0.95
15
  ],
16
  "train_f1": [
17
- 0.5134230099661359,
18
- 0.8361895459722223,
19
- 0.9290709485857166,
20
- 0.9457510555138364,
21
- 0.9610323477679206
22
  ],
23
  "val_f1": [
24
- 0.7517789275334545,
25
- 0.8570538585441715,
26
- 0.8169790993320406,
27
- 0.9389060273658387,
28
- 0.9501335417888085
29
  ],
30
- "final_train_acc": 0.9611111111111111,
31
- "final_val_acc": 0.95,
32
- "final_train_f1": 0.9610323477679206,
33
- "final_val_f1": 0.9501335417888085
34
  }
 
1
  {
2
  "train_acc": [
3
+ 0.5375,
4
+ 0.7263888888888889,
5
+ 0.9027777777777778,
6
+ 0.9333333333333333,
7
+ 0.9652777777777778
8
  ],
9
  "val_acc": [
10
+ 0.5833333333333334,
11
+ 0.8388888888888889,
12
+ 0.9277777777777778,
13
+ 0.9611111111111111,
14
+ 0.9833333333333333
15
  ],
16
  "train_f1": [
17
+ 0.536049328660644,
18
+ 0.7235148703595,
19
+ 0.9024800641801505,
20
+ 0.93318371312119,
21
+ 0.9652251280841254
22
  ],
23
  "val_f1": [
24
+ 0.5680470763804097,
25
+ 0.8340975484075549,
26
+ 0.9271197664874166,
27
+ 0.9612710946146225,
28
+ 0.9832336896420354
29
  ],
30
+ "final_train_acc": 0.9652777777777778,
31
+ "final_val_acc": 0.9833333333333333,
32
+ "final_train_f1": 0.9652251280841254,
33
+ "final_val_f1": 0.9832336896420354
34
  }
results/metrics_text.json CHANGED
@@ -1,34 +1,34 @@
1
  {
2
  "train_acc": [
3
- 0.4930555555555556,
4
- 0.6,
5
- 0.8388888888888889,
6
- 0.8347222222222223,
7
- 0.8513888888888889
8
  ],
9
  "val_acc": [
10
- 0.5111111111111111,
11
- 0.7222222222222222,
12
- 0.8555555555555555,
13
- 0.8333333333333334,
14
- 0.85
15
  ],
16
  "train_f1": [
17
- 0.4904818105293567,
18
- 0.5966488044725581,
19
- 0.8390194686500029,
20
- 0.8349985580382376,
21
- 0.8510579595638623
22
  ],
23
  "val_f1": [
24
- 0.4915977110377292,
25
- 0.7155129398120051,
26
- 0.8516779224409841,
27
- 0.8292850467289719,
28
- 0.8483678992171247
29
  ],
30
- "final_train_acc": 0.8513888888888889,
31
- "final_val_acc": 0.85,
32
- "final_train_f1": 0.8510579595638623,
33
- "final_val_f1": 0.8483678992171247
34
  }
 
1
  {
2
  "train_acc": [
3
+ 0.4652777777777778,
4
+ 0.6638888888888889,
5
+ 0.7402777777777778,
6
+ 0.7861111111111111,
7
+ 0.8305555555555556
8
  ],
9
  "val_acc": [
10
+ 0.5333333333333333,
11
+ 0.7611111111111111,
12
+ 0.7888888888888889,
13
+ 0.85,
14
+ 0.8611111111111112
15
  ],
16
  "train_f1": [
17
+ 0.4613460806590974,
18
+ 0.6653808670140424,
19
+ 0.7397632622113597,
20
+ 0.7833112108974177,
21
+ 0.8286638765327977
22
  ],
23
  "val_f1": [
24
+ 0.5090167917778191,
25
+ 0.7322554991931685,
26
+ 0.782206139060508,
27
+ 0.8462691058842163,
28
+ 0.8601664681210135
29
  ],
30
+ "final_train_acc": 0.8305555555555556,
31
+ "final_val_acc": 0.8611111111111112,
32
+ "final_train_f1": 0.8286638765327977,
33
+ "final_val_f1": 0.8601664681210135
34
  }
src/multimodal_model.py CHANGED
@@ -3,6 +3,16 @@ import torch.nn as nn
3
  import timm # For Image models like ResNet
4
  from transformers import AutoModel # Pretrained text encoders
5
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  class MediLLMModel(nn.Module):
8
  def __init__(
@@ -112,6 +122,25 @@ class MediLLMModel(nn.Module):
112
  ) # Concatenates text and image features along feature dimension
113
  # [CLS vector from BERT] + [ResNet image vector]
114
  # -> [batch_size, 2816]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  # Return logits for each class, later apply softmax during evaluation
117
  return self.classifier(features)
 
3
  import timm # For Image models like ResNet
4
  from transformers import AutoModel # Pretrained text encoders
5
 
6
+ # ================================================
7
+ # NOTE:
8
+ # Future upgrades can include:
9
+ # - MLP Fusion
10
+ # - Bilinear Pooling
11
+ # - Attention-based Fusion
12
+ # - Cross-modal Transformers
13
+ # These require structural changes to the forward() logic.
14
+ # ================================================
15
+
16
 
17
  class MediLLMModel(nn.Module):
18
  def __init__(
 
122
  ) # Concatenates text and image features along feature dimension
123
  # [CLS vector from BERT] + [ResNet image vector]
124
  # -> [batch_size, 2816]
125
+ # === Placeholder: Advanced Fusion Methods ===
126
+ # Option 1: Bilinear Fusion
127
+ # fused = torch.bmm(text_feat.unsqueeze(2), img_feat.unsqueeze(1)).view(batch_size, -1)
128
+ # fused = self.bilinear_fc(fused)
129
+
130
+ # Option 2: Cross-Modal Attention
131
+ # - Use attention mechanism where one modality attends to another
132
+ # - E.g., compute attention weights over image using text as query
133
+ # - Requires custom attention modules or transformers
134
+
135
+ # Option 3: Cross-modal Transformer Encoder
136
+ # - Concatenate image and text features as tokens
137
+ # - Feed into transformer encoder with positional embeddings
138
+
139
+ # Option 4: Fusion Logic
140
+ # fused = torch.cat([text_feat, img_feat], dim=1)
141
+ # fused = self.dropout(torch.relu(self.fusion_fc1(fused)))
142
+ # fused = self.dropout(torch.relu(self.fusion_fc2(fused)))
143
+ # return self.classifier(fused)
144
 
145
  # Return logits for each class, later apply softmax during evaluation
146
  return self.classifier(features)
src/train.py CHANGED
@@ -5,6 +5,8 @@ import yaml
5
  import json
6
  import argparse
7
  import matplotlib.pyplot as plt # for plotting
 
 
8
 
9
  from tqdm import tqdm # loading bar for loops
10
  from torch.utils.data import (
@@ -33,6 +35,15 @@ from src.triage_dataset import TriageDataset # Dataset Class
33
  from src.multimodal_model import MediLLMModel # Mutlimodal Model
34
 
35
 
 
 
 
 
 
 
 
 
 
36
  def load_config(mode):
37
  config_path = os.path.join(base_dir, "config", "config.yaml")
38
  os.makedirs(os.path.dirname(config_path), exist_ok=True)
@@ -87,6 +98,8 @@ def stratified_split(dataset, val_ratio=0.2, seed=42):
87
  # Function to instantiate model and data, train, validate, plot results
88
  # and save the model
89
  def train_model(mode="multimodal", use_wandb=False):
 
 
90
  if use_wandb:
91
  import wandb
92
 
@@ -110,7 +123,7 @@ def train_model(mode="multimodal", use_wandb=False):
110
  if use_wandb:
111
  # Initialize Weights & Biases
112
  wandb.init(
113
- project="MediLLM_Final",
114
  name=f"train_{mode}",
115
  config=cfg
116
  )
@@ -260,11 +273,11 @@ def train_model(mode="multimodal", use_wandb=False):
260
  })
261
 
262
  # Save model
263
- model_path = os.path.join(base_dir, f"medi_llm_fullmodel_{mode}.pt")
264
  torch.save(
265
- model, model_path
266
- ) # Saves the full model
267
- print(f"💾 Saved full model to {model_path}")
268
 
269
  # Save to Weights & Biases
270
  if use_wandb:
 
5
  import json
6
  import argparse
7
  import matplotlib.pyplot as plt # for plotting
8
+ import random
9
+ import numpy as np
10
 
11
  from tqdm import tqdm # loading bar for loops
12
  from torch.utils.data import (
 
35
  from src.multimodal_model import MediLLMModel # Mutlimodal Model
36
 
37
 
38
+ def set_seed(seed=42):
39
+ random.seed(seed)
40
+ np.random.seed(seed)
41
+ torch.manual_seed(seed)
42
+ torch.cuda.manual_seed_all(seed)
43
+ torch.backends.cudnn.deterministic = True
44
+ torch.backends.cudnn.benchmark = False
45
+
46
+
47
  def load_config(mode):
48
  config_path = os.path.join(base_dir, "config", "config.yaml")
49
  os.makedirs(os.path.dirname(config_path), exist_ok=True)
 
98
  # Function to instantiate model and data, train, validate, plot results
99
  # and save the model
100
  def train_model(mode="multimodal", use_wandb=False):
101
+ set_seed(42)
102
+
103
  if use_wandb:
104
  import wandb
105
 
 
123
  if use_wandb:
124
  # Initialize Weights & Biases
125
  wandb.init(
126
+ project="MediLLM_Final_v2",
127
  name=f"train_{mode}",
128
  config=cfg
129
  )
 
273
  })
274
 
275
  # Save model
276
+ model_path = os.path.join(base_dir, f"medi_llm_state_dict_{mode}.pth")
277
  torch.save(
278
+ model.state_dict(), model_path
279
+ ) # Saves only model weights and biases
280
+ print(f"💾 Saved model weights and biases to {model_path}")
281
 
282
  # Save to Weights & Biases
283
  if use_wandb:
src/triage_dataset.py CHANGED
@@ -100,21 +100,26 @@ class TriageDataset(Dataset):
100
  image_path = self.image_base_dir / image_path
101
 
102
  if not image_path.exists():
103
- if IS_CI:
104
- raise FileNotFoundError(f"[CI] Image file not found: {image_path}")
105
- else:
106
- raise FileNotFoundError(f"[LOCAL] Image file not found: {image_path}")
107
  image = Image.open(image_path).convert("RGB")
108
  output["image"] = self.transform(image)
109
 
110
- # addition for inference
111
- if "image_path" in self.df.columns:
112
- output["image_path"] = image_path
113
-
114
  # Label
115
- if "label" in row and row["label"] in self.label_map:
116
  output["label"] = torch.tensor(
117
  self.label_map[row["triage_level"]], dtype=torch.long
118
  )
119
 
 
 
 
 
 
 
 
 
 
 
120
  return output
 
100
  image_path = self.image_base_dir / image_path
101
 
102
  if not image_path.exists():
103
+ msg = f"Image file not found: {image_path}"
104
+ raise FileNotFoundError(f"[CI] {msg}" if IS_CI else f"[LOCAL] {msg}")
105
+
 
106
  image = Image.open(image_path).convert("RGB")
107
  output["image"] = self.transform(image)
108
 
 
 
 
 
109
  # Label
110
+ if "triage_level" in row and row["triage_level"] in self.label_map:
111
  output["label"] = torch.tensor(
112
  self.label_map[row["triage_level"]], dtype=torch.long
113
  )
114
 
115
+ # fields for inference output
116
+ if "patient_id" in row:
117
+ output["patient_id"] = row["patient_id"]
118
+
119
+ if "emr_text" in row and "emr_text" not in output:
120
+ output["emr_text"] = row["emr_text"]
121
+
122
+ if "image_path" in row and "image_path" not in output:
123
+ output["image_path"] = str(image_path) if "image_path" in locals() else row["image_path"]
124
+
125
  return output