Demo notebooks and datasets
Data provenance — fully synthetic
notes.csv, notes_lab_results.csv, hospitalizations.csv and
lab_results.csv contain no real patient data.
Every name, birth date, identifier (MRN), practitioner, and clinical
narrative was generated for demonstration purposes. Any resemblance to real
persons is coincidental. The hospitalization dataset is deliberately curated
so its stays cover a spread of clinical situations (procedures,
complications, comorbidities, a readmission, a paediatric stay decided by a
deployment's own standing orders); see the notebook's dataset table.
Contents
| File | What it is |
|---|---|
extraction_demo.ipynb |
End-to-end CSV → FHIR extraction with the ingestion pipeline |
hospitalization_extraction_demo.ipynb |
Hospital stays, each updating one FHIR Encounter document by document via encounter_id, plus a walkthrough of reverse-chronological ingestion against split context |
notes.csv |
The unified demo dataset: 2,452 synthetic documents across 281 patients, 2017–2026 (cut-off 2026-06-30). It merges the outpatient histories of the original notes file (duplicates removed) with the 21 curated stays of hospitalizations.csv (same ids, lab-report documents replaced by lab rows) and adds 756 documents: 100 hospital stays, 33 day cases, 25 ED attendances and outpatient work-ups |
notes_lab_results.csv |
4,989 structured lab rows for notes.csv: the rows of lab_results.csv (same LAB- ids, without the 7 deliberately broken ones), the results written inside the outpatient notes, and the labs of every new stay and visit |
hospitalizations.csv |
154 synthetic documents across 37 hospital stays (including 19 pain-clinic, spine and maxillofacial stays, V-2301 … V-2314 and V-2401 … V-2405) and 4 pre-admission outpatient reviews carrying prior medical history (17 patients), plus 8 held-back notes — 6 backdated for MRN-20002 (V-903 Nov 2022, V-902 Sept 2023) and 2 forward-dated for MRN-20017 (V-018 July 2025) — submitted in one call to show only the backdated notes taking the split-context path |
lab_results_ingestion_demo.ipynb |
Structured lab results → FHIR Observations, deterministically (no LLM): fail-closed reference checks, a merged rejection report, and an idempotent re-run. Run the hospitalization demo first — the labs attach to its patients, practitioners and admissions |
lab_results.csv |
289 synthetic lab rows for the hospitalization cohort: the structured twin of its prose lab notes plus pre-admission/post-discharge draws, rows without LOINC codes, comparator and qualitative values, and 7 deliberately broken rows for the rejection report |
Every column in these files is documented in the CSV field reference — what it means, what it produces in FHIR, and which rules decide whether a row is accepted.
Running
- Start the local FHIR server:
docker compose up -d(HAPI onhttp://localhost:8090). - Set
CAVELL_API_URL(your Prism deployment) andCAVELL_API_KEY(your LLM Gateway key) — the notebooks prompt for the key if unset. - Open a notebook and run top to bottom.
lab_results_ingestion_demo.ipynb must run after
hospitalization_extraction_demo.ipynb on the same FHIR server: it only
attaches labs to patients, practitioners and admissions that already exist.
notes_lab_results.csv must likewise be ingested after notes.csv has been
extracted: its rows reference the patients, practitioners and encounters that
the notes create. notes.csv is the input of extraction_demo.ipynb; at
2,452 documents a full run is a substantial number of API calls, so filter to
the patients your demo needs.
scripts/extract_demo_dataset.py does the whole load unattended — fresh FHIR
database, seeding, every note, then the labs — with progress bars and an ETA.
It keeps existing FHIR data and resumes an interrupted run; --fresh wipes
the database and starts over.