# Model card — CarePulse deterioration risk `cp-risk-1` and anomaly detection

## Intended use
Rank monitored patients (ward, ICU step-down, home RPM) for **clinical review** by how likely their condition is worsening, and
explain why. Supports nurses and doctors; **does not diagnose, does not replace NEWS2, bedside alarms or clinical judgement.**
Not validated for children, pregnancy (use obstetric scores) or ICU patients on organ support (their scores saturate at 100).

## Inputs (from CarePulse data only)
Latest values (ward: last 2 h; home: last 48 h) and least-squares trends (ward: 6 h; home: 72 h) of RR, HR/pulse, SpO₂, systolic BP,
temperature, glucose, weight; latest NEWS2 and its minimum 3–8 h earlier; patient's own 21-day baseline (home); age; heart-failure flag
(condition or programme); critical alerts in 24 h; medicine adherence (7 d) and rescue-inhaler puffs (24 h).

## How the score is made
Points are log-odds, summed onto an intercept of −3.5; score = 100 / (1 + e^(−sum)). Levels: Watch ≥ 30, High ≥ 60 (alert),
Critical alert ≥ 85 — all adjustable per hospital.

| Factor | Points |
|---|---|
| NEWS2 (per point) | +0.5 (home without full NEWS2: +0.45 per partial vital-sign point) |
| NEWS2 up ≥ 2 / ≥ 3 vs 3–8 h earlier | +0.8 / +1.2 |
| RR rising ≥ 1 / ≥ 2 per h (RR ≥ 18) | +0.6 / +0.9 |
| SpO₂ falling ≥ 0.5 / ≥ 1 % per h (SpO₂ ≤ 95) | +0.5 / +0.9 |
| HR rising ≥ 4 / ≥ 8 per h (HR ≥ 95) | +0.5 / +0.8 |
| SBP falling ≥ 4 / ≥ 8 mmHg per h (SBP ≤ 115) | +0.6 / +0.9 |
| Shock index ≥ 1.0 / 0.8–1.0 | +1.0 / +0.4 |
| Temp ≥ 38.3 °C with HR > 100; temp < 36 °C with HR > 90 | +0.6 each |
| Glucose ≥ 300 or < 70 mg/dL | +0.6 |
| Home: SpO₂ ≥ 2 points below usual; SBP ≥ 15 from usual; HR ≥ 12 above usual | +0.8; +0.4; +0.5 |
| Heart failure with weight up ≥ 1.5 / ≥ 2 kg in 3 days | +0.6 / +1.0 |
| Critical alerts in 24 h | +0.3 each, max +0.9 |
| Age 65–74 / ≥ 75 | +0.15 / +0.3 |
| Adherence < 70 % (7 d) | +0.4 |
| Rescue inhaler ≥ limit (default 8 puffs / 24 h) | +0.6 |

Examples: NEWS2 0, stable → 3. NEWS2 5 → 27. NEWS2 6 → 38 (Watch). NEWS2 7 → 50. NEWS2 3, up 3 in a few hours, with SpO₂ falling and RR rising → 57–73 (Watch/High) — before NEWS2 reaches 5.

The weights are expert-set from published early-warning literature (NEWS2 trajectories, shock index, qSOFA/SIRS elements), **not
trained on CarePulse data**. The 0–100 value is a risk index, not a calibrated probability.

## Anomaly detection
| Kind | Rule | Who is told |
|---|---|---|
| Impossible value | outside physiological range (e.g. HR 20–260, SpO₂ 50–100) or diastolic ≥ systolic | device team (info) |
| Sudden jump | same device, ≤ 5 min apart, change ≥ HR 50 / SpO₂ 15 / RR 18 / SBP 60 / temp 1.5 | recorded (artefact) |
| Stuck sensor | 30 identical consecutive values over ≥ 25 min | device team (info) |
| Unusual for this patient | inside alert limits but robust z ≥ 3.5 vs own 14-day median / MAD (minimum spread per parameter) | care team after 2 in the same direction within 24 h |
| 3-day shift (home) | 3-day mean vs usual (days 4–24) beyond max(clinical minimum, 2.5 SE) — e.g. SBP 12, weight 1.5 kg, SpO₂ 2 | care team |

## Local validation (do this in every pilot)
1. Run 4–8 weeks with AI alerts on and staff feedback (👍/👎 on each AI and anomaly alert).
2. Analytics → AI: alerts followed by a critical NEWS2 / reading alert within 24 h, **median lead time**, % rated useful.
3. Export the pseudonymous dataset (AI early warning → Dataset CSV: features, score, outcome = critical alert within 24 h) and compute
   AUROC, sensitivity / PPV at the chosen threshold with the hospital's clinical team. Add true outcomes (rapid response calls,
   ICU transfer, death) from the HIS when available — the CSV outcome is a proxy.
4. Adjust thresholds, or train the hospital's own model on the same features and plug it in (Settings → AI & medicines → model URL).
   Request: `POST {"model_input":"carepulse-risk-features-v1","features":{…},"builtin":{"score":…,"factors":[…]}}` with bearer key;
   response: `{"score":0-100,"model":"name","factors":[{"code","text","points"}]}`; 5-second timeout, falls back to cp-risk-1.

## Regulatory note
A software function that ranks patients for deterioration is likely to be treated as medical device software (CDSCO). Keep the
"supports review, does not diagnose" positioning, record the classification opinion, and do not market the index as predicting a
specific probability or outcome until it has been clinically validated.

## AI summary (LLM)
Optional draft summary for doctors from de-identified facts (age, sex, conditions, programme names, reading statistics and trends,
alerts with names removed, NEWS2, risk reasons, adherence). No name, UHID, phone, address or ABHA is sent. Without an AI key, a
rule-based summary is generated. Always labelled as a draft to verify; every generation is audited.
