Give the community desk's ED heads-up a narrow scoped list (D-154)

Merged
BI
12h ago
+476-328

What this changes

This is the follow-up to #1606 that Josh approved ("Yes, in a follow-up PR", then "Yes I approve", 11 Nov 2026). It is recorded as D-154.

The item 46 "Your patients in ED" card (D-133, D-141) now works on a community team desk. That desk's scoped view only holds the journeys its own role may see, so the card had nothing to read. Now the desk's scoped workspace carries communityEdArrivals, a narrow list of the team's own open-episode patients who are in an ED now.

  • Narrow by design: each item is the UMRN, the ED's name and the time the stay was recorded, keyed by the journey id, and nothing else. The ED journey itself and the patient record are still not sent to the desk.
  • One source for episodes: the mock-up community episodes' team and status moved to patients/community-episode-teams.ts, the one place they are typed. patient-record-extras.ts spreads those entries, so the card and the record can't disagree.
  • Card: home-team-heads-up-card.tsx reads the projected list through useCommunityEdArrivals() when it exists, and otherwise works it out from the whole workspace as before.
  • Not covered: shared mode. A shared community desk's copy comes from the server's scopeWardFlowState, which does not send this list yet, so the card stays empty there. Noted in D-154.

Evidence (local)

  • npm run typecheck:internal: clean.
  • tests/ward-community-ed-arrivals-scope.test.ts (new, 5 tests) checks:
    • The Midland desk gets exactly one item, with only edName, key, since and umrn.
    • The ED movement and the patient are not in the desk's view.
    • The list matches what the whole workspace says.
    • Bentley gets an empty list.
    • The ED and coordinator desks get none.
    • The record mock-ups read the same episode list.
  • The new test plus the related access-scope, ward-access, heads-up and record-extras test files all pass: 17 files, 175 tests.
  • D-154 entry and index row added. OWNER-RULINGS.md regenerated, and the decisions anchor check passes.

Synthetic data only. Display only. No event, stored field or signed clinical value changes.


Generated by Claude Code