Clinical: forecast double count, ended legal form wording, ED 24-hour boundary (D-145)
Merged
BI
1d ago+284+284+012345678901234567890123456789-50-50-01234567890123456789
Requested by Josh · project thread
The clinical part of the 11 November repository review. Josh approved it as D-145 item 1, which is recorded in the thread's normal PR, #1623. Josh signed it off on 11 November 2026 at 05:51 UTC ("I approve all of them to remove labels"), so the hold label is off; the sign-off is recorded under D-145 in #1623. Synthetic data only. No signed clinical value changes.
What changes
- Expected occupancy no longer counts one patient twice.
- The bug: a patient who held a named bed (through a journey or a referral) and also had a booked planned admission to the same ward was counted twice. The ward's 24, 48 and 72 hour figures went up by 2 instead of 1.
- The network forecast had the same double count for referral holds.
- The fix: a new
patientsHoldingANamedBedhelper uses the same rule asnumberedReservationBeds. It feedsplannedAdmissionsStillNeedingABedfromexpected-occupancy.ts,beds-forecast.tsandforecast/forecast-by-kind.ts, so all the forecast views agree. - The helper lives in
capacity/planned-admissions-reducer.ts, which is already on the D-14 patient-link allowlist for the same yes/no id comparison. Its allowlist reason intests/ward-patient-link-default-deny.test.tsnow names this use. No new file joins the allowlist.
- An ended legal form no longer shows a live-looking expiry.
- The Legal forms card and row now read "Form ended; expiry as typed was 15:42", or "Form ended" if no time was typed. The time stays exactly as typed (D-93).
- The ED screen flags a long wait at exactly 24 hours.
- A shared
isLongWait()now does the check on the ED screen and its timeline, matching Alerts, TV, the bed meeting and statistics ("24 h or more").
- A shared
Phone size limits
| Route | Old limit | New limit | Measured (CI, PR merged with main) |
|---|---|---|---|
/ward-flow | 575.4 | 575.7 | 575.4 |
/ward-flow/referrals | 583.6 | 583.9 | 583.6 |
/ward-flow/ward/rph-adult-secure | 613.8 | 614.1 | 613.8 |
/ward-flow/capacity | 654.3 | 654.7 | 654.4 |
/ward-flow/ed | 535.4 | 535.7 | 535.4 (main alone 535.2) |
- All sizes are in KB, each raise under 1 KB. Reasons in
docs/script-budget-history/2026-11-11-pr1621-held-clinical-review-fixes.md.
Checks (local, not hosted CI)
npx vitest runon 92 related test files: 742 passed; after the helper move, 20 related files (235 tests) includingtests/ward-patient-link-default-deny.test.tspassed.node --max-old-space-size=8192 node_modules/typescript/bin/tsc -p tsconfig.json --noEmit --incremental false: exit 0.npx eslinton changed files: clean.node docs/ward-flow/journey/verify.mjs --check,node scripts/doc-facts.mjs,node scripts/ward-flow/owner-rulings-index.mjs --check: passed after merging main3aa63c3.- Not run locally: the full unit suite and the browser suite (left to CI).
🤖 Generated with Claude Code