Added json support
Browse files
app.py
CHANGED
|
@@ -50,7 +50,7 @@ logger.info("Models loaded successfully.")
|
|
| 50 |
# ---------------------------------------------------------------------------
|
| 51 |
# Step 3: Discover input files in data/input/ (.txt and .json)
|
| 52 |
# ---------------------------------------------------------------------------
|
| 53 |
-
INPUT_DIR = Path("data/
|
| 54 |
|
| 55 |
def _discover_input_files() -> dict:
|
| 56 |
"""
|
|
@@ -196,7 +196,7 @@ DISCLAIMER_HTML = """
|
|
| 196 |
color: #664d03;
|
| 197 |
line-height: 1.5;
|
| 198 |
">
|
| 199 |
-
<strong>⚠️ Clinical Decision Support Tool
|
| 200 |
This system is intended for use by qualified oncologists and clinical teams as a
|
| 201 |
<em>decision support aid</em>. It does not constitute medical advice and must be
|
| 202 |
interpreted in conjunction with comprehensive clinical evaluation. All outputs are
|
|
|
|
| 50 |
# ---------------------------------------------------------------------------
|
| 51 |
# Step 3: Discover input files in data/input/ (.txt and .json)
|
| 52 |
# ---------------------------------------------------------------------------
|
| 53 |
+
INPUT_DIR = Path("data/sample_input")
|
| 54 |
|
| 55 |
def _discover_input_files() -> dict:
|
| 56 |
"""
|
|
|
|
| 196 |
color: #664d03;
|
| 197 |
line-height: 1.5;
|
| 198 |
">
|
| 199 |
+
<strong>⚠️ Clinical Decision Support Tool</strong><br>
|
| 200 |
This system is intended for use by qualified oncologists and clinical teams as a
|
| 201 |
<em>decision support aid</em>. It does not constitute medical advice and must be
|
| 202 |
interpreted in conjunction with comprehensive clinical evaluation. All outputs are
|
data/sample_input/act.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"extraction_version": "1.0",
|
| 3 |
+
"extraction_date": "2026-02-23",
|
| 4 |
+
"patient": {
|
| 5 |
+
"id": "UMC-556219",
|
| 6 |
+
"age": 60,
|
| 7 |
+
"gender": "Male"
|
| 8 |
+
},
|
| 9 |
+
"cancer": {
|
| 10 |
+
"type": "Diffuse Large B-Cell Lymphoma",
|
| 11 |
+
"subtype": "non-GCB (ABC type)",
|
| 12 |
+
"stage": "IV",
|
| 13 |
+
"primary_site": "Lymphoma",
|
| 14 |
+
"metastases": [
|
| 15 |
+
"Bone marrow (15% involvement)",
|
| 16 |
+
"Retroperitoneal nodes (3.2cm)",
|
| 17 |
+
"Mesenteric mass (4.8cm)"
|
| 18 |
+
],
|
| 19 |
+
"biomarkers": {
|
| 20 |
+
"pdl1_expression": "N/A",
|
| 21 |
+
"tmb": "N/A",
|
| 22 |
+
"msi_status": "MSS"
|
| 23 |
+
},
|
| 24 |
+
"diagnosis_date": "2024-03-18"
|
| 25 |
+
},
|
| 26 |
+
"immunotherapy": {
|
| 27 |
+
"therapy_type": "ACT",
|
| 28 |
+
"drug_name": "Axicabtagene ciloleucel",
|
| 29 |
+
"drug_class": "CAR-T",
|
| 30 |
+
"treatment_setting": "metastatic",
|
| 31 |
+
"line_of_therapy": "Second-line",
|
| 32 |
+
"planned_start_date": "2026-03-10",
|
| 33 |
+
"ici_details": null,
|
| 34 |
+
"act_details": {
|
| 35 |
+
"act_type": "CAR-T",
|
| 36 |
+
"target_antigen": "CD19",
|
| 37 |
+
"cell_source": "autologous",
|
| 38 |
+
"preconditioning_regimen": "Fludarabine + Cyclophosphamide",
|
| 39 |
+
"t_cell_harvest_date": "2026-02-14",
|
| 40 |
+
"expected_crs_risk": "moderate-high",
|
| 41 |
+
"expected_neurotoxicity_risk": "moderate"
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"prior_treatments": {
|
| 45 |
+
"chemotherapy": {
|
| 46 |
+
"received": true,
|
| 47 |
+
"regimens": [
|
| 48 |
+
"R-CHOP",
|
| 49 |
+
"R-ICE",
|
| 50 |
+
"Gemcitabine (bridging)"
|
| 51 |
+
],
|
| 52 |
+
"response": "CR (R-CHOP), PR (R-ICE), Stable disease (Gemcitabine)"
|
| 53 |
+
},
|
| 54 |
+
"prior_immunotherapy": {
|
| 55 |
+
"received": true,
|
| 56 |
+
"drugs": [],
|
| 57 |
+
"response": ""
|
| 58 |
+
}
|
| 59 |
+
},
|
| 60 |
+
"medications": {
|
| 61 |
+
"ppi_use": {
|
| 62 |
+
"currently_on_ppi": false,
|
| 63 |
+
"ppi_name": "",
|
| 64 |
+
"duration_months": 0
|
| 65 |
+
},
|
| 66 |
+
"antibiotic_history": {
|
| 67 |
+
"recent_antibiotics": true,
|
| 68 |
+
"exposures": [
|
| 69 |
+
{
|
| 70 |
+
"antibiotic_name": "Levofloxacin 500mg",
|
| 71 |
+
"antibiotic_class": "fluoroquinolone",
|
| 72 |
+
"start_date": "2026-01-25",
|
| 73 |
+
"end_date": "2026-02-05",
|
| 74 |
+
"days_before_ici": 14
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"antibiotic_name": "Piperacillin-tazobactam 4.5g",
|
| 78 |
+
"antibiotic_class": "beta-lactam",
|
| 79 |
+
"start_date": "2025-12-18",
|
| 80 |
+
"end_date": "2025-12-27",
|
| 81 |
+
"days_before_ici": 73
|
| 82 |
+
}
|
| 83 |
+
]
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"comorbidities": [
|
| 87 |
+
"Hypertension",
|
| 88 |
+
"hyperlipidemia",
|
| 89 |
+
"Type 2 diabetes",
|
| 90 |
+
"chronic back pain"
|
| 91 |
+
],
|
| 92 |
+
"microbiome": {
|
| 93 |
+
"sample_date": "2026-02-05",
|
| 94 |
+
"sequencing_method": "Shotgun metagenomic sequencing (Illumina NovaSeq, 12M reads)",
|
| 95 |
+
"diversity": {
|
| 96 |
+
"shannon_index": 2.7,
|
| 97 |
+
"simpson_index": 0.82,
|
| 98 |
+
"observed_species": 164
|
| 99 |
+
},
|
| 100 |
+
"key_bacteria": {
|
| 101 |
+
"Akkermansia muciniphila": 1.8,
|
| 102 |
+
"Faecalibacterium prausnitzii": 3.6,
|
| 103 |
+
"Ruminococcaceae": 9.2,
|
| 104 |
+
"Ruminococcus lactaris": 1.8,
|
| 105 |
+
"Lachnospiraceae": 8.8,
|
| 106 |
+
"Lachnospira pectinoschiza": 1.2,
|
| 107 |
+
"Roseburia": 1.8,
|
| 108 |
+
"Bifidobacterium spp.": 2.2,
|
| 109 |
+
"Bacteroides eggerthii": 2.4,
|
| 110 |
+
"Proteobacteria": 8.4,
|
| 111 |
+
"E. coli": 4.2,
|
| 112 |
+
"Klebsiella pneumoniae": 1.8,
|
| 113 |
+
"Enterococcus faecalis": 2.1,
|
| 114 |
+
"Bacteroides uniformis": 3.6,
|
| 115 |
+
"Blautia spp.": 4.2
|
| 116 |
+
},
|
| 117 |
+
"metabolites": {
|
| 118 |
+
"scfa": {
|
| 119 |
+
"butyrate_uM": 15.8,
|
| 120 |
+
"propionate_uM": 11.2,
|
| 121 |
+
"acetate_uM": 38.4
|
| 122 |
+
},
|
| 123 |
+
"bile_acids_available": true,
|
| 124 |
+
"tryptophan_metabolites_available": false
|
| 125 |
+
},
|
| 126 |
+
"data_quality": {
|
| 127 |
+
"completeness": "moderate",
|
| 128 |
+
"source": "Precision Microbiome Diagnostics",
|
| 129 |
+
"limitations": [
|
| 130 |
+
"Single time-point during active antibiotics",
|
| 131 |
+
"Reduced diversity from antibiotics + chemotherapy"
|
| 132 |
+
]
|
| 133 |
+
}
|
| 134 |
+
},
|
| 135 |
+
"clinical_context": {
|
| 136 |
+
"urgency": "",
|
| 137 |
+
"patient_goals": [
|
| 138 |
+
"CAR-T therapy consultation",
|
| 139 |
+
"Relapsed/Refractory DLBCL treatment"
|
| 140 |
+
],
|
| 141 |
+
"specific_concerns": [
|
| 142 |
+
"CAR-T efficacy",
|
| 143 |
+
"CAR-T toxicity (CRS, neurotoxicity)",
|
| 144 |
+
"Microbiome dysbiosis",
|
| 145 |
+
"Low butyrate",
|
| 146 |
+
"Antibiotic disruption"
|
| 147 |
+
]
|
| 148 |
+
}
|
| 149 |
+
}
|
data/sample_input/{demo_ehr_act_dlbcl.txt → act_patient.txt}
RENAMED
|
File without changes
|
data/sample_input/ici.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"extraction_version": "1.0",
|
| 3 |
+
"extraction_date": "2026-02-23",
|
| 4 |
+
"patient": {
|
| 5 |
+
"id": "CCC-782934",
|
| 6 |
+
"age": 66,
|
| 7 |
+
"gender": "Female"
|
| 8 |
+
},
|
| 9 |
+
"cancer": {
|
| 10 |
+
"type": "Lung adenocarcinoma",
|
| 11 |
+
"subtype": "Non-GCB (ABC type)",
|
| 12 |
+
"stage": "IVA",
|
| 13 |
+
"primary_site": "Right upper lobe",
|
| 14 |
+
"metastases": [
|
| 15 |
+
"Mediastinal nodes",
|
| 16 |
+
"Malignant pleural effusion"
|
| 17 |
+
],
|
| 18 |
+
"biomarkers": {
|
| 19 |
+
"pdl1_expression": "65% TPS",
|
| 20 |
+
"tmb": "18 mutations/megabase",
|
| 21 |
+
"msi_status": "MSS"
|
| 22 |
+
},
|
| 23 |
+
"diagnosis_date": "2025-12-08"
|
| 24 |
+
},
|
| 25 |
+
"immunotherapy": {
|
| 26 |
+
"therapy_type": "ICI",
|
| 27 |
+
"drug_name": "Pembrolizumab",
|
| 28 |
+
"drug_class": "PD-1 inhibitor",
|
| 29 |
+
"treatment_setting": "First-line",
|
| 30 |
+
"line_of_therapy": "First-line",
|
| 31 |
+
"planned_start_date": "2026-02-19",
|
| 32 |
+
"ici_details": {
|
| 33 |
+
"ici_target": "PD-1",
|
| 34 |
+
"PD-L1": "65% TPS",
|
| 35 |
+
"CTLA-4": null
|
| 36 |
+
},
|
| 37 |
+
"act_details": null
|
| 38 |
+
},
|
| 39 |
+
"prior_treatments": {
|
| 40 |
+
"chemotherapy": {
|
| 41 |
+
"received": false,
|
| 42 |
+
"regimens": [],
|
| 43 |
+
"response": ""
|
| 44 |
+
},
|
| 45 |
+
"prior_immunotherapy": {
|
| 46 |
+
"received": false,
|
| 47 |
+
"drugs": [],
|
| 48 |
+
"response": ""
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"medications": {
|
| 52 |
+
"ppi_use": {
|
| 53 |
+
"currently_on_ppi": false,
|
| 54 |
+
"ppi_name": "",
|
| 55 |
+
"duration_months": 0
|
| 56 |
+
},
|
| 57 |
+
"antibiotic_history": {
|
| 58 |
+
"recent_antibiotics": true,
|
| 59 |
+
"exposures": [
|
| 60 |
+
{
|
| 61 |
+
"antibiotic_name": "Levofloxacin 750mg",
|
| 62 |
+
"antibiotic_class": "fluoroquinolone",
|
| 63 |
+
"start_date": "2025-12-28",
|
| 64 |
+
"end_date": "2025-12-31",
|
| 65 |
+
"days_before_ici": 49
|
| 66 |
+
}
|
| 67 |
+
]
|
| 68 |
+
}
|
| 69 |
+
},
|
| 70 |
+
"comorbidities": [],
|
| 71 |
+
"microbiome": {
|
| 72 |
+
"sample_date": "2026-02-07",
|
| 73 |
+
"sequencing_method": "Shotgun metagenomic sequencing (Illumina NovaSeq, 15M reads)",
|
| 74 |
+
"diversity": {
|
| 75 |
+
"shannon_index": 3.6,
|
| 76 |
+
"simpson_index": 0.91,
|
| 77 |
+
"observed_species": 247
|
| 78 |
+
},
|
| 79 |
+
"key_bacteria": {
|
| 80 |
+
"Akkermansia muciniphila": 4.8,
|
| 81 |
+
"Faecalibacterium prausnitzii": 8.9,
|
| 82 |
+
"Ruminococcaceae family": 14.2,
|
| 83 |
+
"Bifidobacterium longum": 3.2,
|
| 84 |
+
"Bifidobacterium adolescentis": 1.8,
|
| 85 |
+
"Lachnospiraceae family": 12.8,
|
| 86 |
+
"Roseburia intestinalis": 3.8,
|
| 87 |
+
"Alistipes putredinis": 2.6,
|
| 88 |
+
"Prevotella copri": 4.2,
|
| 89 |
+
"Bacteroides spp.": 11.3,
|
| 90 |
+
"E. coli": 1.2,
|
| 91 |
+
"Enterococcus": 0.4,
|
| 92 |
+
"Fusobacterium": 0.1
|
| 93 |
+
},
|
| 94 |
+
"metabolites": {
|
| 95 |
+
"scfa": {
|
| 96 |
+
"butyrate_uM": 32.8,
|
| 97 |
+
"propionate_uM": 18.6,
|
| 98 |
+
"acetate_uM": 58.4
|
| 99 |
+
},
|
| 100 |
+
"bile_acids_available": true,
|
| 101 |
+
"tryptophan_metabolites_available": true
|
| 102 |
+
},
|
| 103 |
+
"data_quality": {
|
| 104 |
+
"completeness": "high",
|
| 105 |
+
"source": "Precision Microbiome Diagnostics",
|
| 106 |
+
"limitations": []
|
| 107 |
+
}
|
| 108 |
+
},
|
| 109 |
+
"clinical_context": {
|
| 110 |
+
"urgency": "",
|
| 111 |
+
"patient_goals": [],
|
| 112 |
+
"specific_concerns": []
|
| 113 |
+
}
|
| 114 |
+
}
|
data/sample_input/{demo_ehr_ici_nsclc.txt → ici_patient.txt}
RENAMED
|
File without changes
|