Research prototype — not for clinical use. It demonstrates a method on a de-identified research cohort. It cannot assess a real patient, it has not been validated anywhere prospectively, and nothing you enter leaves your browser.

HF-RISK · interactive prototype

The same model, running in your browser.

Two patient-grouped XGBoost models for six-month mortality after a heart-failure admission — one on 34 clinical inputs, one on the same 34 plus the three Glasgow Coma Scale components. The ensembles are exported from the retrain script and evaluated locally, so there is no service to cold-start and no reading to wait for.

Cohort
MIMIC-IV heart-failure admissions
Split
Patient-grouped 80/20, seed 17
Holdout
8,749 admissions · 1,830 deaths (20.9%)
Outcome
Death within 6 months of the discharge date

0

Admissions

18,890 patients · 8,006 with more than one

0

Mean AUROC at 6 months

0.8266 without GCS · 0.8352 with GCS

0

Paired AUROC gain from GCS

95% CI 0.0054–0.0120

0

Calibration error, with GCS

Brier 0.1122 on the holdout

The reading

Change an input, watch the estimate move.

All 37 inputs the model uses are on this page, grouped and labelled. Anything you leave alone stays at the derivation-cohort median, which is printed beside the field once the model metadata loads — nothing is filled in behind your back.

Inputs

37 model inputs

Patient

Age and sex as recorded for the index admission.

Comorbidities

Counts derived from ICD-coded diagnoses for the admission.

Renal and electrolytes

First values recorded for the admission, in the cohort's units.

Haematology and cardiac markers

Same windows as above; BNP and troponin are left as recorded.

Neurological assessment

Glasgow Coma Scale components. Leave a box empty to record that it was not assessed — the model then takes its trained missing-value branch, which is how 71.9% of this cohort was handled. Clearing the boxes is the honest way to say "nobody measured this".

Where this reading sits Without GCS
Distribution of predicted six-month mortality across the 8,749 held-out admissions, with the current reading marked. holdout event rate 20.9% without with GCS

One bar per 2.1% slice of predicted risk, counted over the held-out admissions for the selected arm. The dashes mark the share of those patients who actually died within six months.

What the GCS components are doing waiting…
Eye opening –

not assessed

Verbal response –

not assessed

Motor response –

not assessed

–

How these numbers are produced

Each bar is the exact Shapley value of that component inside the with-GCS model, holding the other 34 inputs at your values. Three features means 3! = 6 orderings, so it is computed exactly rather than sampled: no approximation is involved. A component that is not assessed enters as a missing value, which is the model's own trained branch for it, so the three bars sum precisely to the difference between "GCS unknown" and "GCS as entered". This is an attribution of the GCS block within this model — it is not a full-model SHAP explanation, and it is not labelled as one.

Does the number mean what it says? Calibration, both arms, on the holdout
Predicted versus observed six-month mortality in ten equal-count risk bands of the held-out admissions, for both model arms. 0% 100% observed rate →
ArmAUROCAUPRCBrierECE
Without GCS 0.82660.63690.11740.0157
With GCS 0.83520.66780.11220.0112

Each point is one tenth of the holdout, so every point carries the same number of patients. The diagonal is perfect calibration. ECE is the reported ten-bin figure; Brier is the mean squared error of the probabilities themselves. Higher AUPRC and lower Brier are better, and AUPRC should be read against the 20.9% event rate — a model that always predicted that rate would score 0.209.

How to read it

A percentage is a measurement, not a verdict.

A predicted probability from a retrospective cohort model is one of the least dramatic quantities in medicine. Here is exactly what the number on this page is, what it is not, and which parts of it are uncertain.

What the number is

The model's estimate for a profile, not for a person

The ensembles output the rate at which admissions with these 37 values died within six months in the derivation cohort. It is a cohort-level probability attached to a profile. Two real patients can share every input here and have completely different outcomes; that is a property of the measurement, not a failure of the model.

What the number is not

Not a prognosis, not a triage input, not a treatment effect

Nothing here models what happens next: not the treatment given, not the ward, not the patient's own trajectory, not the quality of care. The model has never been tested prospectively and has never seen a patient from your hospital. Compare it with a cohort prevalence, never with an individual.

Why the two arms agree

GCS is deliberately left missing

In this cohort GCS is charted for 28.1% of admissions, because it is recorded for patients who reached intensive care and the majority of heart-failure admissions never did. If you clear the three boxes, the with-GCS model takes its trained missing branch and the two arms converge. That is the honest behaviour, and it is also the whole reason the extension is interesting: a variable that mostly exists for the sickest patients will look powerful.

What the numbers show

Moderate discrimination, close calibration

AUROC 0.8352 with GCS and 0.8266 without: the model orders patients usefully and gets the ordering wrong often enough that it is not a classifier. Calibration is the better news — a ten-bin expected calibration error of 0.0112 means predicted and observed rates tracked within about one percentage point across the whole range, so the size of the number is more trustworthy than its rank order suggests.

The GCS increment

+0.0086 AUROC, and what it may be made of

Adding the three components raised six-month AUROC by 0.0086 (95% CI 0.0054–0.0120) and 28-day AUROC by 0.0138 (0.0090–0.0194) on the same holdout patients. An ICU-stay flag from the icustays table does not reproduce that gain at six months (+0.0014, CI −0.0012 to 0.0040), so it is not simply "was this patient sick enough for intensive care". That is the honest reading of what has been measured so far — and the label audit on the case-study page is the reason a further test is needed.

The open question

Part of that signal may be an artefact of the label

Dying in hospital and dying after discharge are different events. GCS is lowest in the patients closest to death in hospital, so if the outcome label mixes the two, GCS is unusually well placed to absorb the in-hospital signal. The prediction being tested is that the GCS increment shrinks in a survivors-to-discharge arm and that GCS predicts in-hospital death better than post-discharge death. Until that runs, the +0.0086 is a measurement awaiting a mechanism check, not a settled effect.

Provenance

Why you can trust the numbers on this page.

A browser demo is only worth the evidence behind it. This one ships the exported ensembles, the metrics computed on the same holdout, and a script that re-checks the browser against XGBoost every time the model or the code changes.

The chain

  1. scripts/08_mimic_gcs_extraction.py pulls the MIMIC-IV heart-failure cohort with the GCS components.
  2. scripts/09a_icu_stay_flags.py adds an ICU-stay flag from icustays, independent of whether GCS was charted.
  3. scripts/09_mimic_native_gcs_retrain.py fits both arms on a patient-grouped split and writes results/mimic_gcs_run_log.md.
  4. scripts/11_export_web_model.py re-runs that protocol, asserts the reproduced AUROCs equal the logged ones, and exports the trees, medians, holdout calibration and a parity fixture to /data/hf-risk-models.json.
  5. src/scripts/hf-risk-model.js walks those trees in the browser, and scripts/verify-web-model.mjs re-checks it in Node.

The checks that actually ran

Reproduced AUROCs
0.8266 and 0.8352, identical to the run log. The export aborts if they drift by more than 0.002.
Browser against XGBoost
120 held-out patients re-evaluated from the exported trees alone: maximum probability difference 6.3×10-7.
GCS attribution
Maximum difference from the Python computation 5.6×10-7, and the three shares sum to the exact span to 4.4×10-16.
Float32 fidelity
The walker rounds threshold comparisons and leaf accumulation through float32, because XGBoost does. In float64 the traversal disagreed on 265 of 20,000 sampled tree decisions.
Published metrics
Brier 0.1122 and ECE 0.0112 reproduce the values logged in the run log for the with-GCS arm.
node scripts/verify-web-model.mjs
python scripts/11_export_web_model.py

What it runs on, precisely

XGBoost, 400 trees, depth 6, learning rate 0.05, subsample 0.8, seed 17. The split is GroupShuffleSplit at 80/20 grouped on subject_id, and the script asserts zero patient overlap before scoring — 8,006 of the 18,890 patients have more than one heart-failure admission, one of them 59, so a row-level split would have put the same person on both sides. Non-GCS missing values are filled with training-set medians computed on training rows only; GCS is never imputed.

The model targets death within six months of the discharge date, which — as the label audit on the case-study page explains — includes deaths in hospital. That is a limitation of the label, not a detail, and it is the reason the mechanism test is the next piece of work rather than a footnote.

Limitations, stated plainly

  • Research prototype. Not a medical device, not validated for clinical use, and not a substitute for clinical judgement.
  • The model is retrospective. It was fitted and evaluated on a single MIMIC-IV extract, with no prospective or external validation of this particular pair of models.
  • The outcome label mixes deaths in hospital with deaths after discharge — audited in full on the case-study page. Until the re-extraction lands, a reading describes "death within six months of the discharge date", which is not the same thing as surviving to discharge and then dying.
  • Each arm is a separately trained model, so the difference between them is not a pure "effect of GCS" — it also carries the usual variance of two independently fitted ensembles.
  • GCS is charted for 28.1% of these admissions. If it is left blank here the with-GCS model uses its trained missing-value branch, which is how the majority of the cohort was handled.
  • The ICU-only subgroup quoted on the case-study page is selected on severity, so it is a collider subgroup and stays descriptive.
  • Discrimination is moderate. AUROC 0.8352 means the model ranks patients usefully, not that it identifies who will die.

The full method, including the leakage audit, the cross-cohort SHAP comparison and the MIMIC-IV transport check, is written up on the case-study page.