MedLoCoMo generates long-context, multi-session medical dialogue benchmark samples from MIMIC-IV v3.1 and MIMIC-IV-Note v2.2.
- One patient = one MedLoCoMo sample
- One admission = one session
- Only two speakers:
DoctorandPatient - Dialogues are grounded in:
- discharge notes
- radiology notes
- diagnoses ICD
- procedures ICD
- microbiology
Admissions without discharge notes are skipped. Re-running the same patient replaces that patient's output directory instead of appending to it.
The core benchmark artifacts for each patient are combined_conversation.json, the full chronological multi-session dialogue, and benchmark_qa.json, the final QA set paired with that dialogue.
The released benchmark data is included in this repository under MedLoCoMo/.
From the repository root:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtExpected defaults:
data/
mimic-iv/
hosp/
mimic-iv-notes/
Generate the MedLoCoMo dialogue artifacts for one patient:
export OPENAI_API_KEY="YOUR_KEY"
python main.py generate-patient --subject-id 10000032 --output-root MedLoCoMoOverride dataset, model, or output paths:
python main.py generate-patient \
--mimiciv-dir /path/to/mimic-iv \
--mimiciv-note-dir /path/to/mimic-iv-notes \
--output-root MedLoCoMo \
--subject-id 10000032 \
--model gpt-5.2Generate QA for one patient after the dialogue artifacts exist:
python main.py generate-qa \
--subject-id 10000032 \
--output-root MedLoCoMo \
--model gpt-5.2Generate dialogue and QA artifacts together:
python main.py generate-all \
--subject-id 10000032 \
--output-root MedLoCoMo \
--model gpt-5.2generate-qa requires that every admission folder already contains both conversation.json and summary.json.
MedLoCoMo/
<subject_id>/
combined_conversation.json # core chronological multi-session dialogue
patient_summary.json
benchmark_qa.json # core benchmark QA set
cross_admission_qa.json
<hadm_id>/
formed_packet.json
prompt_record.json
conversation.json
summary.json
qa.json
Per-patient generation writes to MedLoCoMo/_tmp/<subject_id>/ first and only replaces MedLoCoMo/<subject_id>/ after a successful run.
QA generation writes to MedLoCoMo/_tmp/qa_<subject_id>/ first and only replaces QA artifacts on success.
