EHR2Trace: Auditable EHR Data Infrastructure for Patient World Models and Clinical Agents
Organizations: Department of Radiology University of Colorado Anschutz School of Medicine Aurora, CO, USA · Department of Radiology Johns Hopkins University School of Medicine Baltimore, MD, USA
Abstract
Patient world models and clinical agents aim to predict changes in patients' health and support clinical work. Developing these systems requires reliable histories of patient conditions, treatments, and the information available at each decision. Electronic health records (EHRs) contain these histories, but differences in how events are recorded make them difficult to use consistently. We present EHR2Trace, a system that converts EHRs from different sources into traceable patient events for model training and evaluation. It links events to source records, separates event time from information availability, and distinguishes medication orders, dispensing, and administration. A shared event representation supports both OMOP and MEDS exports, with automated validation and reproducible builds. Across three clinical datasets, EHR2Trace converted 846.4 million events, with every applicable check passing except one unit-consistency check on MIMIC-IV, and detected all 28 injected faults. A controlled prediction experiment showed that assigning later diagnoses to admission time substantially inflated measured performance, and that a model trained on such data lost accuracy when deployed on histories filtered by availability. EHR2Trace provides a reusable data foundation for patient world models and clinical agents, helping researchers inspect patient histories, check conversion decisions, and evaluate models with explicit data rules.
Figures & tables
| event_kind | hours from admission | source_name , and the detail an action carries | at | |
| event | avail. | |||
| Subject 1, one encounter of 75 h; decision time at +44.08 h | ||||
| drug_admin | 4.37 | 4.38 | CeftriaXONE 1 gm · Administered | ✓ |
| visit | 7.98 | · | EW EMER. AVAILABILITY_ASSUMED | ✓ |
| drug_order | 12.32 | · | Vitamin D 1,000 Unit Tablet 1000 · PO/NG · AVAILABILITY_ASSUMED | ✓ |
| drug_dispense | 12.32 | · | Docusate Sodium PO/NG · Discontinued via patient discharge · AVAILABILITY_BEFORE_EVENT | ✓ |
| Measure | JHU-CTPE | MIMIC-IV | CU-CTPA |
|---|---|---|---|
| Source rows | 75,113,066 | 836,795,494 | 16,682,059 |
| Identities encountered | 22,982 | 364,673 | 127,955 |
| Subjects with canonical events | 22,980 | 364,673 | 127,955 |
| Canonical events | 33,396,779 | 799,153,396 | 13,880,372 |
| Event-to-source links | 101,522,252 | 801,049,552 | 16,385,410 |
| Quarantine entries | 750,121 | 1,074,435 | 232,123 |
| JHU-CTPE | MIMIC-IV | CU-CTPA | ||||
|---|---|---|---|---|---|---|
| Domain | Rows | Mapped | Rows | Mapped | Rows | Mapped |
| Condition | 3,637,437 | 99.8% | 6,451,372 | 98.9% | 5,861,753 | 100.0% |
| Drug | 11,713,070 | 86.7% | 74,731,397 | 74.5% | 4,206,761 | 99.1% |
| Measurement | 15,911,634 | 97.1% | 613,248,151 | 25.7% | 982,655 | 100.0% |
| Procedure | 572,119 | 100.0% | 1,710,192 | 52.6% | 719,423 | 100.0% |
| Observation | 678,871 | 96.6% | 11,531,859 | 9.8% | 35 | 100.0% |
| Audit measure | JHU-CTPE | MIMIC-IV | CU-CTPA |
|---|---|---|---|
| Vital-status timestamps | |||
| Untimed VITAL_STATUS events after conversion | 0 | 0 | 0 |
| Medication action types and details | |||
| Dispensing records kept separate from administration | — | 18,968,537 | — |
| cabinet records among them | — | 1,189,422 | — |
| Non-medication requests stored as service orders | — | 28,916,331 | — |
| Property | EHR2Trace | mimic-iv-demo-omop | mimic-iv-demo-meds |
|---|---|---|---|
| Common data models produced | OMOP and MEDS | OMOP | MEDS |
| Source modules read on the subset | hospital, ICU | hospital, ICU | hospital, ICU |
| Output rows (OMOP) / events (MEDS) | 897,487 / 971,545 | 423,057 | 916,166 |
| Rows with a standard concept | 18.9% | 98.3% | – |
| Events linked to a concept | 19.8% | – | 13.5% |
| Source file and row recoverable | every event (972,567 links) | not carried | source keys on 95.2%, table not named |
| Horizon | A A | C C | C A | Evaluation inflation | Training deficit | AUPRC |
|---|---|---|---|---|---|---|
| filtered | backdated | cross-rule | C C C A | A A C A | A A / C A | |
| 6 h | 0.829 | 0.965 | 0.642 | 0.323 [0.295, 0.352] | 0.188 [0.161, 0.215] | 0.222 / 0.071 |
| 12 h | 0.839 | 0.969 | 0.660 | 0.309 [0.280, 0.338] | 0.179 [0.152, 0.206] | 0.239 / 0.088 |
| 24 h | 0.854 | 0.967 | 0.669 | 0.298 [0.269, 0.328] | 0.185 [0.156, 0.214] | 0.253 / 0.107 |
| 48 h | 0.863 | 0.963 | 0.694 | 0.269 [0.241, 0.297] | 0.169 [0.145, 0.194] | 0.310 / 0.142 |
Electronic Health Records
Electronic Health Records (EHRs) are longitudinal digital patient records studied for clinical data integration, analysis, and decision support.
See all 111 papers