Patient Timeline Forecasting — ens_lr_gbdt_tx

Predicts which of 40 target conditions are newly diagnosed in the five years after a patient's anchor date, from structured Synthea EHR events recorded strictly before it.

Trained for the M31 research-intern take-home. Synthetic data only. Not a clinical device, and not usable for any decision about a real person.

Task

  • 3,514 Synthea patients, split 2,791 train / 365 validation / 358 test.
  • Anchor = last recorded encounter minus five calendar years, floored to midnight.
  • Label = first-ever diagnosis of the condition falls in [anchor, anchor+5y]. A patient already diagnosed before the anchor is prevalent: structurally negative, and reported separately rather than counted as an ordinary negative.

Results (validation, n=365)

metric value
val_macro_auroc 0.7700
val_macro_ap 0.2681

The validation set resolves differences of roughly ±0.01 macro AUROC and no better. Per-condition AUROC on the rarest label (5 positives) carries a Hanley–McNeil 95% interval of about ±0.24. Numbers below that separation are reported but should not be read as rankings.

What the model is actually learning

The anchor is defined from each patient's last encounter, so for the 42.9% of training patients with a death date, the outcome window is exactly their last five years of life — 100% of those deaths fall within 30 days of the window end. A substantial part of the achievable signal is therefore "is this record about to end", which is a property of how the task was constructed rather than of clinical prediction. The same rule generated the test anchors, so this is not leakage, but it does bound how the results should be interpreted.

Leakage controls

DEATHDATE, HEALTHCARE_EXPENSES and HEALTHCARE_COVERAGE are refused at load time. STOP-derived durations are excluded: the organisers blanked post-anchor stops in the test split, so such a feature would both leak and shift. Every fitted statistic — vocabulary, quantile edges, scalers — is fitted on training patients only. 63 automated checks cover this, including a grep test that no module outside the time utility parses a timestamp.

Limitations

Synthea is not real EHR data. A discriminator separates it from MIMIC at AUC 0.999, and across 19 health datasets the winning classifier agreed between real- and synthetic-trained models in only 21–26% of cases. Whichever model wins here, that ranking should not be assumed to transfer.

Reproducing

git clone https://github.com/Sallamsaka/M31-Coding-Test && pip install -r requirements.txt
./run_all.ps1
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support