Heaping screen of all variables¶
Every hand-entered clinical value and every lab analyte was screened for mixed resolution and heaping, to decide which need a rounding model and which need only a registry entry.
| Date | 2026-10-13 |
| Status | current |
| Methods | Rounding, heaping and value resolution |
Background¶
- Every clinical-table field labelled "EMR" was entered by people. Only the vital-sign tracks were recorded automatically.
- Variables were ordered by how likely they are to be hand-entered and heaped.
Data¶
clinical_data.csv(6,388 cases) andlab_data.csv(34 analytes, 928,448 results), plus the pre-operative copies (preop_*).
Method¶
- Clinical values: share of values on each anchor family against the flat expectation, plus an MWI-style index with a binomial threshold.
- Lab analytes: finest resolution (the finest number of decimal places held by at least 1% of values) and the coarser share. Because results are stored without trailing zeros, about 10% of values should look one step coarser at a single resolution.
- Whole-number analytes: preference at multiples of 10 and 5, per analyser, with expected counts from a local quadratic fit to the neighbouring values (skipping other multiples of 5). Ratio = observed ÷ expected; z is the Poisson z-score.
- Command (vitaldb-resolution):
python tools/screens.py heaping-screen-all-variables --root $R --out $W/screens, which writes$W/screens/heaping-screen-all-variables.jsonwith the numbers below. The screen flags two whole-number analytes: SaO₂ at odd multiples of 5 (ratio 2.03, z 15.5) and sodium at multiples of 10 (1.07, z 5.5); PT % and fibrinogen are covered in Computed lab values on reachable grids. These two are checked bypython tools/screens.py lab-heaping-sao2-sodium --root $R --out $W/screens: the counts near the mode; the same ratio on the other four residues (values shifted by 1–4, a placebo showing what the fit alone gives); the ratio with the quadratic fitted to log counts, which follows a steep exponential flank; and splits by analyser and by clock time (08:00–18:00 against the rest). The earlier claim that a simulated smooth peaked distribution gives deviations of the same size had no kept simulation and is replaced by the placebo residues. The screen's ratios below 1 (ALT, AST and ammonia) are checked bypython tools/screens.py lab-heaping-sparse-tail --root $R --out $W/screens: how many multiples have a fit below the floor of 0.5 expected results, and the ratio over the dense multiples only (neighbours averaging at least 20 results), with the same placebo residues.
Results¶
- Heaped clinical values: urine output (91% end in 0), blood loss (85% multiples of 50), crystalloid (98% multiples of 50), colloid, height (21% whole centimetres, 10% expected) and weight.
- Age is not heaped: 19.1% end in 0 or 5 (20% expected), and last digits are flat.
- Red-cell and plasma units, ICU days and length of stay show no heaping.
- Lab analytes with decimals sit near the 10% coarser share. Exceptions: haematocrit (32.4%, two analysers), total bilirubin (6.5%), lactate (12.5%) and bicarbonate (7.9%).
- No whole-number analyte shows a clear preference for multiples of 5 or 10 once the shape of the distribution is allowed for; SaO₂ and sodium, flagged by the quadratic fit, are checked separately.
- ALT, AST and ammonia do not avoid multiples of 10. Their screen ratios below 1 (ALT 0.86, AST 0.79, z −9 and −14) come from the long, sparse upper tail: at each of 1,177 (ALT) and 2,055 (AST) multiples the fit falls below zero and is floored at 0.5 expected results, against 31 and 43 results actually there, so the floor alone adds about 590 and 1,030 to the expected count. Over the multiples with enough results around them (16 and 15, neighbours averaging at least 20 results) the ratios are 0.99 (ALT) and 1.03 (AST), within the 0.96–1.02 the same fit gives on the other residues. Ammonia (0.59) has no dense multiples at all.
- SaO₂ is not heaped at 95. Its counts rise steeply towards the 100% ceiling (93: 189, 94: 279, 95: 393, 96: 638, 97: 868), and a quadratic over that flank overshoots: on the other residues the same fit gives ratios from 0.43 to 1.58. Fitted to log counts the ratio is 1.03 (z 0.7), with 393 results at 95 against 381 expected. All SaO₂ results come from the theatre blood-gas analyser.
- Sodium shows at most a small excess at 140, at the mode: 5,408 results against 5,198 expected (+4%) with the log fit, a ratio of 1.04 (z 3.2) that lies within the 0.98–1.07 the fit gives on the other residues. The excess is in the central laboratory (1.05; 40,787 results), not the blood-gas analyser (0.96; 14,594), and in daytime results (1.07 from 08:00 to 18:00, 1.00 otherwise). Rounding to 140 by hand is possible but not shown.
- Total bilirubin's low range (0.2–1.0 mg/dL, 23,802 results) shows no heaping: from 0.6 mg/dL up each count is within 5% of the mean of its neighbours, and below that the counts follow the rise of the distribution (0.3 and 0.4 sit 8% and 16% above their neighbours' mean, 0.2 below it), not a preference for any value. Its lower coarser share comes from the shape of the distribution.
- Lactate is measured on the blood-gas analysers only (14,512 of 14,516 results share a timestamp with a pH), so there is no second instrument to compare, and era cannot be tested. No value below 15 is heaped. Its excess is a reporting limit: 317 results (28 cases) are exactly 15.0 mmol/L, against at most 16 for any other value near the top (Three lab analytes stop at a reporting limit).
- Two more analytes have reporting limits: aPTT at 400.0 s (226 results, 87 cases) and ESR at 2 mm/h (89 results, 72 cases).
- Since vitaldb-resolution v0.6.0 (18 October; model version 2): lactate at 15.0 and aPTT at 400.0 (and pre-
operative aPTT) are
top_coded, ESR at 2bottom_coded, andpis described as probably phosphorus (unconfirmed).
Discussion¶
- Apart from computed values, every lab analyte is single resolution per source and needs a registry entry, not a rounding model.
- Pre-operative copies behave like the lab data: platelets, glucose, AST, ALT and BUN show no heaping; pre-op PT % and sodium show the same artefacts. Pre-op PaO₂ is the exception.
Observations it supports¶
| Observation | Status | Summary |
|---|---|---|
| Three lab analytes stop at a reporting limit | likely | Lactate is capped at 15.0 mmol/L, aPTT at 400.0 s, and ESR does not go below 2 mm/h: the values at the limit stand for "this or beyond", not for the number itself. |
Limitations¶
- ESR, ammonia and creatinine clearance have too few results to judge (537–1,415).
Open questions¶
- Analyte p as phosphorus (weakly supported hypothesis). The analyte coded
p(16,440 results) is missing fromlab_parameters.csv. Its median of 3.2 (IQR 2.7–3.8, p5–p95 1.9–5.0) fits phosphorus in mg/dL, the only common analyte with that range, but only the VitalDB team can confirm it.
Code¶
Tags: from the resolution work