diff --git a/data/repo-awareness-snapshot.json b/data/repo-awareness-snapshot.json index 4c783dca91..692d7ca66a 100644 --- a/data/repo-awareness-snapshot.json +++ b/data/repo-awareness-snapshot.json @@ -1,8 +1,8 @@ { "version": "repo-awareness-snapshot-v1", "captured_revision": { - "sha": "a5d918057c1fb8103f8aa3b57b8c4056aea533c6", - "committed_at": "2026-08-26T00:44:09+08:00" + "sha": "16a65c8432a95ae857c8766ad961cdf32d76567b", + "committed_at": "2026-08-26T05:02:16+08:00" }, "routes": { "modes": [ @@ -878,6 +878,81 @@ "file": "src/app/mockups/verification-notice-subtle/page.tsx", "area": "mockup" }, + { + "path": "/mockups/ward-flow", + "file": "src/app/mockups/ward-flow/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/capacity", + "file": "src/app/mockups/ward-flow/capacity/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/ed/[edId]", + "file": "src/app/mockups/ward-flow/ed/[edId]/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/escalation", + "file": "src/app/mockups/ward-flow/escalation/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/exceptions", + "file": "src/app/mockups/ward-flow/exceptions/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/governance", + "file": "src/app/mockups/ward-flow/governance/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/handover", + "file": "src/app/mockups/ward-flow/handover/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/movements", + "file": "src/app/mockups/ward-flow/movements/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/network", + "file": "src/app/mockups/ward-flow/network/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/patients/[patientId]", + "file": "src/app/mockups/ward-flow/patients/[patientId]/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/queue", + "file": "src/app/mockups/ward-flow/queue/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/search", + "file": "src/app/mockups/ward-flow/search/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/transport", + "file": "src/app/mockups/ward-flow/transport/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/transport/officer", + "file": "src/app/mockups/ward-flow/transport/officer/page.tsx", + "area": "mockup" + }, + { + "path": "/mockups/ward-flow/ward/[unitId]", + "file": "src/app/mockups/ward-flow/ward/[unitId]/page.tsx", + "area": "mockup" + }, { "path": "/mockups/warning-consolidation", "file": "src/app/mockups/warning-consolidation/page.tsx", @@ -982,66 +1057,6 @@ "path": "/tools", "file": "src/app/(search-app)/tools/page.tsx", "area": "product" - }, - { - "path": "/ward-management", - "file": "src/app/ward-management/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/capacity", - "file": "src/app/ward-management/capacity/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/ed/[edId]", - "file": "src/app/ward-management/ed/[edId]/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/exceptions", - "file": "src/app/ward-management/exceptions/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/governance", - "file": "src/app/ward-management/governance/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/movements", - "file": "src/app/ward-management/movements/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/network", - "file": "src/app/ward-management/network/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/patients/[patientId]", - "file": "src/app/ward-management/patients/[patientId]/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/queue", - "file": "src/app/ward-management/queue/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/transport", - "file": "src/app/ward-management/transport/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/transport/officer", - "file": "src/app/ward-management/transport/officer/page.tsx", - "area": "product" - }, - { - "path": "/ward-management/ward/[unitId]", - "file": "src/app/ward-management/ward/[unitId]/page.tsx", - "area": "product" } ], "redirects": [ @@ -1110,6 +1125,11 @@ "file": "src/app/mockups/medication-prescribing/page.tsx", "target": "/medications/acamprosate" }, + { + "path": "/mockups/ward-flow/constellation", + "file": "src/app/mockups/ward-flow/constellation/page.tsx", + "target": "/mockups/ward-flow/network" + }, { "path": "/services", "file": "src/app/(search-app)/services/page.tsx", @@ -1124,11 +1144,6 @@ "path": "/therapy-compass", "file": "src/app/(search-app)/therapy-compass/page.tsx", "target": "/?mode=therapy-compass" - }, - { - "path": "/ward-management/constellation", - "file": "src/app/ward-management/constellation/page.tsx", - "target": "/ward-management/network" } ], "api": [ @@ -1359,9 +1374,9 @@ ], "counts": { "modes": 15, - "pages": 189, - "product_pages": 67, - "mockup_pages": 122, + "pages": 192, + "product_pages": 55, + "mockup_pages": 137, "redirects": 17, "api": 56 } @@ -2918,6 +2933,26 @@ "section": "superpowers", "catalogued": false }, + { + "path": "docs/superpowers/plans/2026-08-25-ward-flow-phase-4-specialist-boards.md", + "section": "superpowers", + "catalogued": false + }, + { + "path": "docs/superpowers/plans/2026-08-25-ward-flow-sandbox-and-design-repair.md", + "section": "superpowers", + "catalogued": false + }, + { + "path": "docs/superpowers/plans/2026-08-25-ward-flow-standalone-and-nav-repair.md", + "section": "superpowers", + "catalogued": false + }, + { + "path": "docs/superpowers/plans/2026-08-26-ward-flow-sidebar-house-pattern.md", + "section": "superpowers", + "catalogued": false + }, { "path": "docs/superpowers/rag-upgrade/canonical/approval-matrix.md", "section": "superpowers", @@ -3193,6 +3228,11 @@ "section": "superpowers", "catalogued": false }, + { + "path": "docs/superpowers/specs/2026-08-25-ward-flow-phase-4-specialist-boards-design.md", + "section": "superpowers", + "catalogued": false + }, { "path": "docs/testing.md", "section": "root", @@ -3581,9 +3621,9 @@ } ], "counts": { - "documents": 431, + "documents": 436, "catalogued": 102, - "uncatalogued": 329, + "uncatalogued": 334, "sections": 18 } }, @@ -3628,6 +3668,22 @@ "outcome": "Reviewed and reworked: settings search index, phone/tablet section rail, 768px two-column seam, ConfirmDialog on both destructive privacy actions plus a scoped app-only reset, real preference sync state replacing two swallowed catches, new saveRecentSearches privacy gate, corrected platform-aware shortcuts, persistent live regions. Answer style deliberately left inert (protected RAG surface). PR #2364.", "checks": "verify:pr-local exit 0 (18 gates, none failed; 815 test files, 9853 passed); verify:cheap exit 0; focused Chromium pass at 320/390/768/1280 caught and fixed a duplicate native search-clear glyph; check:production-readiness fails only on pre-existing privacy-register items byte-identical to origin/main" }, + { + "date": "2026-08-25", + "ref": "claude/ward-flow-phase-4-spec", + "head": "436fb8a306299f29c6f972d31ff51ccb6674d007", + "scope": "PR #2373 CI failures, merge conflicts, and review-thread fixes", + "outcome": "fixed seven review findings, merge conflicts, and stale sandbox document links", + "checks": "focused 120 tests passed; design contract and docs link check passed; exact-head hosted static rerun pending" + }, + { + "date": "2026-08-25", + "ref": "claude/ward-flow-phase-4-spec", + "head": "4d945ef7395a1e457d5d92ce10ec7f1dda328862", + "scope": "PR #2373 CI failures, merge conflicts, and review-thread fixes", + "outcome": "fixed seven review findings and merge conflicts", + "checks": "focused 120 tests passed before sidebar merge; design contract passed after sidebar merge; final focused rerun admission-deferred" + }, { "date": "2026-08-24", "ref": "2354", @@ -24502,8 +24558,8 @@ } ], "counts": { - "records": 2613, - "refs": 1593 + "records": 2615, + "refs": 1594 } } } diff --git a/docs/branch-review-records/3695bb07ddb686cb820c7c585ed285ceb863a5aa2f9902ebe83d831fab2df066.record.md b/docs/branch-review-records/3695bb07ddb686cb820c7c585ed285ceb863a5aa2f9902ebe83d831fab2df066.record.md new file mode 100644 index 0000000000..2ef538d4f2 --- /dev/null +++ b/docs/branch-review-records/3695bb07ddb686cb820c7c585ed285ceb863a5aa2f9902ebe83d831fab2df066.record.md @@ -0,0 +1 @@ +| 2026-08-25 | claude/ward-flow-phase-4-spec | 436fb8a306299f29c6f972d31ff51ccb6674d007 | PR #2373 CI failures, merge conflicts, and review-thread fixes | fixed seven review findings, merge conflicts, and stale sandbox document links | focused 120 tests passed; design contract and docs link check passed; exact-head hosted static rerun pending | diff --git a/docs/branch-review-records/caf00bc10f3cb68ea01cd69d3456de137cd89f6f366b1c34cf6f6ec88e70a99f.record.md b/docs/branch-review-records/caf00bc10f3cb68ea01cd69d3456de137cd89f6f366b1c34cf6f6ec88e70a99f.record.md new file mode 100644 index 0000000000..50c7097ec0 --- /dev/null +++ b/docs/branch-review-records/caf00bc10f3cb68ea01cd69d3456de137cd89f6f366b1c34cf6f6ec88e70a99f.record.md @@ -0,0 +1 @@ +| 2026-08-25 | claude/ward-flow-phase-4-spec | 4d945ef7395a1e457d5d92ce10ec7f1dda328862 | PR #2373 CI failures, merge conflicts, and review-thread fixes | fixed seven review findings and merge conflicts | focused 120 tests passed before sidebar merge; design contract passed after sidebar merge; final focused rerun admission-deferred | diff --git a/docs/codebase-index.md b/docs/codebase-index.md index 2087d0de99..dcc68e612d 100644 --- a/docs/codebase-index.md +++ b/docs/codebase-index.md @@ -69,34 +69,33 @@ Smaller top-level directories that are easy to miss: ### Product pages (`src/app/`) -| Route | File | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `/` | `src/app/(search-app)/page.tsx` | -| Shared mode-home route group (`/(search-app)`) | `src/app/(search-app)/` | -| Mode homes (`/services`, `/dsm`, `/documents/…`, …) | `src/app/(search-app)/` shared shell group | -| `/caring-contacts` (standalone workspace; own nav, entered from Tools) | `src/app/caring-contacts/` | -| `/caring-contacts/patients` (permission-scoped caseload: one row per plan plus an authorised names-only projection; URL state filter and local name/identifier search) | `src/app/caring-contacts/patients/page.tsx` | -| `/applications` | `src/app/applications/route.ts` | -| `/differentials`, `/diagnoses`, `/presentations`, `/compare` | `src/app/(search-app)/differentials/` | -| `/dsm`, `/dsm/search`, `/dsm/compare`, `/dsm/diagnoses/[slug]` | `src/app/(search-app)/dsm/` | -| `/documents/search`, `/source`, `/evidence`, `/[id]` | `src/app/(search-app)/documents/` | -| `/factsheets`, `/factsheets/search`, `/factsheets/topics`, `/factsheets/[slug]` | `src/app/(search-app)/factsheets/` | -| `/dictionary`, Terms (`/search`, one catalogue — `/browse` redirects to it), Topics, Definition, Compare, Sources | `src/app/(search-app)/dictionary/` | -| `/favourites` | `src/app/(search-app)/favourites/page.tsx` | -| `/forms`, `/forms/[slug]` | `src/app/(search-app)/forms/` | -| `/medications`, `/medications/[slug]` | `src/app/(search-app)/medications/` | -| `/privacy` | `src/app/privacy/page.tsx` → `privacy-quiet-signal-page.tsx` + `privacy-page-content.tsx` | -| `/reference/colour-coding` | `src/app/reference/` | -| `/safety-plan` | `src/app/safety-plan/page.tsx` | -| `/calculators`, `/calculators/search` | `src/app/(search-app)/calculators/` | -| `/services`, `/services/[slug]` | `src/app/(search-app)/services/` | -| `/therapy-compass` | `src/app/(search-app)/therapy-compass/` | -| `/tools` | `src/app/(search-app)/tools/` | -| `/specifiers`, `/specifiers/[slug]`, `/specifiers/builder`, `/specifiers/compare`, `/specifiers/map` | `src/app/(search-app)/specifiers/` | -| `/formulation`, `/formulation/[slug]`, `/formulation/builder`, `/formulation/compare`, `/formulation/map` | `src/app/(search-app)/formulation/` | -| `/ward-management`, `/network`, `/queue`, `/capacity`, `/movements`, `/exceptions`, `/transport`, `/transport/officer`, `/governance`, `/ed/[edId]`, `/patients/[patientId]`, `/ward/[unitId]` | `src/app/ward-management/` — Ward Flow synthetic patient-flow prototype | -| `/mockups/*` | `src/app/mockups/` (404 in production) | -| `/auth/callback` | `src/app/auth/callback/route.ts` | +| Route | File | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `/` | `src/app/(search-app)/page.tsx` | +| Shared mode-home route group (`/(search-app)`) | `src/app/(search-app)/` | +| Mode homes (`/services`, `/dsm`, `/documents/…`, …) | `src/app/(search-app)/` shared shell group | +| `/caring-contacts` (standalone workspace; own nav, entered from Tools) | `src/app/caring-contacts/` | +| `/caring-contacts/patients` (permission-scoped caseload: one row per plan plus an authorised names-only projection; URL state filter and local name/identifier search) | `src/app/caring-contacts/patients/page.tsx` | +| `/applications` | `src/app/applications/route.ts` | +| `/differentials`, `/diagnoses`, `/presentations`, `/compare` | `src/app/(search-app)/differentials/` | +| `/dsm`, `/dsm/search`, `/dsm/compare`, `/dsm/diagnoses/[slug]` | `src/app/(search-app)/dsm/` | +| `/documents/search`, `/source`, `/evidence`, `/[id]` | `src/app/(search-app)/documents/` | +| `/factsheets`, `/factsheets/search`, `/factsheets/topics`, `/factsheets/[slug]` | `src/app/(search-app)/factsheets/` | +| `/dictionary`, Terms (`/search`, one catalogue — `/browse` redirects to it), Topics, Definition, Compare, Sources | `src/app/(search-app)/dictionary/` | +| `/favourites` | `src/app/(search-app)/favourites/page.tsx` | +| `/forms`, `/forms/[slug]` | `src/app/(search-app)/forms/` | +| `/medications`, `/medications/[slug]` | `src/app/(search-app)/medications/` | +| `/privacy` | `src/app/privacy/page.tsx` → `privacy-quiet-signal-page.tsx` + `privacy-page-content.tsx` | +| `/reference/colour-coding` | `src/app/reference/` | +| `/safety-plan` | `src/app/safety-plan/page.tsx` | +| `/calculators`, `/calculators/search` | `src/app/(search-app)/calculators/` | +| `/services`, `/services/[slug]` | `src/app/(search-app)/services/` | +| `/therapy-compass` | `src/app/(search-app)/therapy-compass/` | +| `/tools` | `src/app/(search-app)/tools/` | +| `/specifiers`, `/specifiers/[slug]`, `/specifiers/builder`, `/specifiers/compare`, `/specifiers/map` | `src/app/(search-app)/specifiers/` | +| `/formulation`, `/formulation/[slug]`, `/formulation/builder`, `/formulation/compare`, `/formulation/map` | `src/app/(search-app)/formulation/` | +| `/mockups/*` | `src/app/mockups/` (404 in production; `/mockups/development`, `/mockups/caring-contacts`, `/mockups/care-plan`, and `/mockups/ward-flow` are developer-gated instead — see below) | +| `/auth/callback` | `src/app/auth/callback/route.ts` | ### API routes (`src/app/api/`) @@ -359,13 +358,24 @@ sequenceDiagram - Registry modes: services, forms, medications, differentials; Formulation is a local mechanism and structured-draft workspace - Demo mode: synthetic data when Supabase unavailable (`demo-data.ts`, `isDemoMode()` in `env.ts`) -### Ward Flow (`src/app/ward-management/`, `src/components/ward-management/`) +### Ward Flow (`src/app/mockups/ward-flow/`, `src/components/ward-management/`) Synthetic prototype for WA metro psychiatry patient flow: getting a patient from an emergency department to an inpatient psychiatric bed. Offline and fixture-backed — no provider calls, no persistence, no patient-identifiable data. Advisory only: the system proposes destinations with visible reasons and a human confirms or overrides. +Developer-gated sandbox, reached only through the developer page (`/mockups/development`), the +same pattern as the Care Plan and Caring Contacts prototypes: `"/mockups/ward-flow"` is on +`DEVELOPER_GATED_PATH_PREFIXES` (`src/lib/developer-area/headers.ts`), so `src/proxy.ts` lets it +through the blanket `/mockups` production block and `DeveloperAreaGate` +(`src/app/mockups/ward-flow/layout.tsx`) requires a signed-in administrator instead of rendering +the prototype to an anonymous visitor. The move only relocated and re-gated the route tree; the +Tools catalogue entry (`src/lib/tools-catalog.ts`, id `ward-management`) still exists and now +points at the gated path rather than being removed — a separate, not-yet-landed task drops it +(and the applications-launcher, tools-search-results, and category-identity mentions that key off +it) from clinical discovery entirely. + - **Design spec:** `docs/superpowers/specs/2026-08-18-ward-flow-metro-patient-flow-design.md` - **Glossary:** `docs/ward-management-context.md` · **Decisions:** `docs/ward-management-decisions.md` - **Route/role map:** `docs/ward-management-mode-map.md` @@ -376,35 +386,69 @@ visible reasons and a human confirms or overrides. derivations) - **Surfaces:** `ward-management-console.tsx` (command), `ward-management-modes.tsx` (mode workspaces), `ward-management-network.tsx` (network diagram), `ward-management-navigation.tsx`, - `src/app/ward-management/constellation/page.tsx` (retired constellation; server redirect to - `/ward-management/network`), `coordinator/coordinator-screen.tsx` (Phase 3 live coordinator screen — priority queue, statewide + `src/app/mockups/ward-flow/constellation/page.tsx` (retired constellation; server redirect to + `/mockups/ward-flow/network`), `coordinator/coordinator-screen.tsx` (Phase 3 live coordinator screen — priority queue, statewide flow diagram, explainable shortlist), `ward/ward-screen.tsx` (Task 8: one inpatient unit's own - view — `/ward-management/ward/[unitId]`; capacity confirmation, incoming-referral accept/hold/ + view — `/mockups/ward-flow/ward/[unitId]`; capacity confirmation, incoming-referral accept/hold/ decline, restriction notices, withdrawn referrals), `officer/officer-screen.tsx` (Task 9: the - transport officer's phone — `/ward-management/transport/officer`; every transport job not yet + transport officer's phone — `/mockups/ward-flow/transport/officer`; every transport job not yet arrived, since `TransportJob` carries a `provider` organisation and no officer identity; queue-plus-pinned-action-bar pattern inherited from `shortlist-panel.tsx`, one job "active" at a time with its four transport actions — accepted, en route, collected, arrived — pinned to the viewport bottom on phone widths), `tracker/live-tracker.tsx` (Task 10: the coordinator's live - tracker, rewriting the existing route — `/ward-management/transport`; every open movement that + tracker, rewriting the existing route — `/mockups/ward-flow/transport`; every open movement that carries a transport job, its leg via `tracker/tracker-derivations.ts`'s `trackerRowState` (delegating to `transportLeg`) and how long since that leg's own stamp via `stampAgeText`; a movement with no transport job at all is never listed as a row — the banner states the excluded count in real text instead, the same on-screen-honesty discipline as the officer screen's "no officer identity" notice), `ed/ed-screen.tsx` (Task 11: one emergency department's own view — - `/ward-management/ed/[edId]`, resolved via `ward-sites.ts`'s `edById`; both clocks (time in + `/mockups/ward-flow/ed/[edId]`, resolved via `ward-sites.ts`'s `edById`; both clocks (time in department from `openedAt`, the legal clock from `formedAt` where earlier, marked - `data-community-formed`), the four-hour `ED_ACCESS_TARGET_MINUTES` departmental access target + `data-community-formed`), the 24-hour `ED_ACCESS_TARGET_MINUTES` departmental access target — labelled and computed so it can never be mistaken for a legal deadline and never touches a `LegalForm`/`dueAt` — a police-attendance flag, and each movement's single outstanding item; a raise-referral form (`RAISE_REFERRAL`), a record-examination form (`RECORD_EXAMINATION`), and the mark-handover-ready control (`HANDOVER_READY`) that is the only producer of a transport job; - statewide capacity shown read-only) + statewide capacity shown read-only), `handover/handover-page.tsx` (Phase 4 Task 4: the shift + handover — `/mockups/ward-flow/handover`; four fixed, product-owner-approved sections in a fixed + order (longest waits, beds held, in transit, placement gone wrong) built by `ward-derivations.ts`'s + `handoverSnapshot`; read once from `useWardFlow()` inside a `useState` initialiser so the page is + frozen at the moment it is opened and never re-derives on the 30-second clock tick; every section + renders an explicit "None" line rather than hiding itself when empty; a Print button calls + `window.print()`, styled by `handover.module.css`'s own `@media print` block), `escalation/escalation-board.tsx` + (Phase 4 Task 5: the escalation board — `/mockups/ward-flow/escalation`; one place showing every + patient whose placement has gone wrong, via `ward-derivations.ts`'s `escalationBoard`; two + independently-computed, read-only sections — `escalated` (movements carrying a recorded + `Movement.escalation`: when, `triedUnitIds` resolved to real `Unit` objects, contact, wait) and + `nowhereEligible` (open movements with zero eligible wards right now, via `eligibleCandidatesAmong` + called with an unlimited-effective `limit` so nothing truncates); a movement can appear in both, and + on the real fixture at `NOW_ANCHOR` WF-009 does — it has a recorded escalation and, independently, + still has nowhere eligible. Unlike the handover, this page is NOT frozen: it reads the live clock on + every render, since a coordinator working this board wants the current picture. Records and shows + only — it computes no near-miss, no least-bad option, and no statement of what would need to change + for a ward to work), `search/patient-search.tsx` (Phase 4 Task 7: patient search — `/mockups/ward-flow/search`; + product owner's choice: its own page, reached from the left-hand menu, rather than a box on the + coordinator screen. A single live filter over `ward-derivations.ts`'s `searchMovements` — a free-text + field matching movement id, `originEdId`, the resolved destination unit's id/name, the stage's own + display label and `owner`, plus an exact-match stage ``, all three + combining as AND. Scoped to OPEN movements only (`isOpen`, applied before any other filter, so a + closed movement can never surface even when the query is its own id verbatim) and, like the + escalation board and unlike the frozen handover, reads the live `useWardFlow()` clock on every + render. Renders an explicit "No matches" note rather than an empty table when nothing fits. This is + the page's own single search composer — Ward Flow routes never mount the shared global shell + composer, so nothing else on the page competes with it) - **State layer (Phase 3):** `ward-flow-provider.tsx` (`WardFlowProvider`/`useWardFlow`, mounted at - `src/app/ward-management/layout.tsx`), `ward-flow-reducer.ts` (the one mutation path), + `src/app/mockups/ward-flow/layout.tsx`), `ward-flow-reducer.ts` (the one mutation path), `ward-flow-events.ts` (event/role table) - **Tests:** `tests/ward-management.test.ts`, `tests/ui-ward-management.spec.ts`, - `tests/ui-ward-coordinator.spec.ts`, `tests/ui-ward-roles.spec.ts` + `tests/ui-ward-coordinator.spec.ts`, `tests/ui-ward-roles.spec.ts`, `tests/ward-handover.test.ts` + (`handoverSnapshot`), `tests/ward-handover.dom.test.tsx` (the freeze and every section's empty + state), `tests/ward-escalation.test.ts` (`escalationBoard`, including the standard-night + `WF-009`/`WF-308` and scarce-night nine-movement measurements), `tests/ward-escalation.dom.test.tsx` + (both sections and their empty states), `tests/ward-patient-search.test.ts` (`searchMovements`, + including the closed-movement exclusion proven against both a real and a constructed fixture case), + `tests/ward-patient-search.dom.test.tsx` (the single-composer shape, live results, and the + "No matches" empty state) ### Developer hub (`src/app/mockups/development/`, `src/lib/developer-area/`) diff --git a/docs/design-system/ADOPTION.md b/docs/design-system/ADOPTION.md index f9dcf372a2..48c1667001 100644 --- a/docs/design-system/ADOPTION.md +++ b/docs/design-system/ADOPTION.md @@ -357,35 +357,33 @@ product exclusions; the only route-only dispositions are the documented legacy-r surfaces. Shared shell/component roots carry their own explicit `shared-shell` disposition. Registered public components: 55 -Declared product roots: 96 +Declared product roots: 76 Roots with a literal `.ckb-v2` opt-in: 1 -Roots inheriting `.ckb-v2` from the global ``: 95 -Production surfaces observed under v2: 17/17 +Roots inheriting `.ckb-v2` from the global ``: 75 +Production surfaces observed under v2: 15/15 Dynamic `ckb-v2` constructions: 0 -Declared production page routes: 81/81 +Declared production page routes: 68/68 Source observation and contract declaration are independent. A literal `ckb-v2` on the global `` makes every production surface inherit v2, but it does not approve that adoption. The Proof column summarizes each surface's dark, forced-colours, 320px, print and browser declarations; exact statuses and evidence paths live in the manifest. Observed v2 under a compatibility declaration fails closed. A declared v2 shell also fails closed unless every proof is passed with evidence and its visual baseline is committed or explicitly not-committed (pending Linux screenshot approval). -| Surface | Disposition | Routes | Roots | Declared shell | Observed shell (mount) | Proof | Baseline | -| ----------------------------------------------- | --------------- | -----: | ----: | -------------- | -------------------------- | -------------- | -------------- | -| `root-shell-and-settings` | shared-shell | 3 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `catalogues-forms-and-info` | owned | 24 | 24 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `differentials` | owned | 7 | 7 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `formulation` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `specifiers` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `therapy-compass` | owned | 9 | 10 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `documents-and-source-evidence` | owned | 3 | 4 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `documents-source-legacy-redirect` | legacy-redirect | 1 | 0 | v2 | v2 (inherited-global-root) | not-applicable | not-applicable | -| `ward-management-constellation-legacy-redirect` | legacy-redirect | 1 | 0 | v2 | v2 (inherited-global-root) | not-applicable | not-applicable | -| `favourites` | owned | 1 | 1 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `tools-and-calculators` | owned | 3 | 3 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `caring-contacts-workspace` | owned | 2 | 2 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `ward-management` | owned | 12 | 20 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `privacy-safety-and-reference` | owned | 3 | 3 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `search-results-shared` | shared-shell | 0 | 1 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `answers-shared` | shared-shell | 0 | 2 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `source-preview-shared` | shared-shell | 0 | 1 | v2 | v2 (inherited-global-root) | passed | not-committed | +| Surface | Disposition | Routes | Roots | Declared shell | Observed shell (mount) | Proof | Baseline | +| ---------------------------------- | --------------- | -----: | ----: | -------------- | -------------------------- | -------------- | -------------- | +| `root-shell-and-settings` | shared-shell | 3 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `catalogues-forms-and-info` | owned | 24 | 24 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `differentials` | owned | 7 | 7 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `formulation` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `specifiers` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `therapy-compass` | owned | 9 | 10 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `documents-and-source-evidence` | owned | 3 | 4 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `documents-source-legacy-redirect` | legacy-redirect | 1 | 0 | v2 | v2 (inherited-global-root) | not-applicable | not-applicable | +| `favourites` | owned | 1 | 1 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `tools-and-calculators` | owned | 3 | 3 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `caring-contacts-workspace` | owned | 2 | 2 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `privacy-safety-and-reference` | owned | 3 | 3 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `search-results-shared` | shared-shell | 0 | 1 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `answers-shared` | shared-shell | 0 | 2 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `source-preview-shared` | shared-shell | 0 | 1 | v2 | v2 (inherited-global-root) | passed | not-committed | diff --git a/docs/design-system/adoption-contract.json b/docs/design-system/adoption-contract.json index bffc9d9759..04e92a8f2c 100644 --- a/docs/design-system/adoption-contract.json +++ b/docs/design-system/adoption-contract.json @@ -10,10 +10,6 @@ "documents-source-legacy-redirect": { "route": "src/app/(search-app)/documents/source/page.tsx", "kind": "next-redirect-only" - }, - "ward-management-constellation-legacy-redirect": { - "route": "src/app/ward-management/constellation/page.tsx", - "kind": "next-redirect-only" } }, "proofEvidencePolicy": { @@ -432,43 +428,6 @@ "sanctionedSpecialPatterns": [], "documentedDisposition": "Legacy source URLs validate the document id and redirect to the canonical /documents/[id] route; they do not own a visual surface." }, - { - "id": "ward-management-constellation-legacy-redirect", - "disposition": "legacy-redirect", - "routes": ["src/app/ward-management/constellation/page.tsx"], - "routeRoots": false, - "roots": [], - "permittedComponentFamilies": [], - "expectedShellState": "v2", - "proof": { - "dark": { - "status": "not-applicable", - "evidence": [] - }, - "forcedColours": { - "status": "not-applicable", - "evidence": [] - }, - "compact320": { - "status": "not-applicable", - "evidence": [] - }, - "print": { - "status": "not-applicable", - "evidence": [] - }, - "browser": { - "status": "not-applicable", - "evidence": [] - } - }, - "baseline": { - "status": "not-applicable", - "files": [] - }, - "sanctionedSpecialPatterns": [], - "documentedDisposition": "Retired Phase 1 constellation URLs redirect to /ward-management/network; they do not own a visual surface." - }, { "id": "favourites", "disposition": "owned", @@ -581,72 +540,6 @@ }, "sanctionedSpecialPatterns": ["CaringContactsShell"] }, - { - "id": "ward-management", - "disposition": "owned", - "routes": [ - "src/app/ward-management/page.tsx", - "src/app/ward-management/capacity/page.tsx", - "src/app/ward-management/ed/[edId]/page.tsx", - "src/app/ward-management/exceptions/page.tsx", - "src/app/ward-management/governance/page.tsx", - "src/app/ward-management/movements/page.tsx", - "src/app/ward-management/network/page.tsx", - "src/app/ward-management/patients/[patientId]/page.tsx", - "src/app/ward-management/queue/page.tsx", - "src/app/ward-management/transport/page.tsx", - "src/app/ward-management/transport/officer/page.tsx", - "src/app/ward-management/ward/[unitId]/page.tsx" - ], - "routeRoots": true, - "roots": [ - "src/components/ward-management/coordinator/coordinator-screen.tsx", - "src/components/ward-management/ed/ed-screen.tsx", - "src/components/ward-management/officer/officer-screen.tsx", - "src/components/ward-management/ward-management-console.tsx", - "src/components/ward-management/ward-management-modes.tsx", - "src/components/ward-management/ward-management-navigation.tsx", - "src/components/ward-management/ward-management-network.tsx", - "src/components/ward-management/ward/ward-screen.tsx" - ], - "permittedComponentFamilies": ["controls", "feedback", "layout"], - "expectedShellState": "v2", - "proof": { - "dark": { - "status": "passed", - "evidence": ["tests/ui-style-contract.spec.ts"] - }, - "forcedColours": { - "status": "passed", - "evidence": ["tests/ckb-v2-token-contract.test.ts"] - }, - "compact320": { - "status": "passed", - "evidence": ["tests/ui-smoke.spec.ts"] - }, - "print": { - "status": "passed", - "evidence": ["tests/global-v2-activation.test.ts"] - }, - "browser": { - "status": "passed", - "evidence": ["tests/ui-visual-baseline.spec.ts"] - } - }, - "baseline": { - "status": "not-committed", - "files": [] - }, - "sanctionedSpecialPatterns": [ - "CoordinatorScreen", - "PatientMovementWorkspace", - "WardModeWorkspace", - "WardModeNavigation", - "ClinicalRail", - "WardNetworkWorkspace" - ], - "documentedDisposition": "Ward Flow is a synthetic operational coordination surface with a coordinator command home, statewide flow diagram and explainable shortlist, rail-based mode navigation, role-aware queue-first phone fallback, linked operational workspaces, and an explainable human-confirmed destination workflow." - }, { "id": "privacy-safety-and-reference", "disposition": "owned", diff --git a/docs/design-system/adoption-manifest.json b/docs/design-system/adoption-manifest.json index 235349886b..cca0213fdd 100644 --- a/docs/design-system/adoption-manifest.json +++ b/docs/design-system/adoption-manifest.json @@ -21,10 +21,6 @@ "documents-source-legacy-redirect": { "route": "src/app/(search-app)/documents/source/page.tsx", "kind": "next-redirect-only" - }, - "ward-management-constellation-legacy-redirect": { - "route": "src/app/ward-management/constellation/page.tsx", - "kind": "next-redirect-only" } }, "evidence": { @@ -1665,7 +1661,8 @@ "src/components/mode-nav/mode-nav.tsx", "src/components/therapy-compass/record/key-facts.tsx", "src/components/tools/tools-search-results-page.tsx", - "src/components/ui/confirm-dialog.tsx" + "src/components/ui/confirm-dialog.tsx", + "src/components/ward-management/ward-management-navigation.tsx" ], "productImportFiles": [ "src/components/AccessibleTable.tsx", @@ -3257,63 +3254,6 @@ "sanctionedSpecialPatterns": [], "roots": [] }, - { - "id": "ward-management-constellation-legacy-redirect", - "disposition": "legacy-redirect", - "documentedDisposition": "Retired Phase 1 constellation URLs redirect to /ward-management/network; they do not own a visual surface.", - "routes": ["src/app/ward-management/constellation/page.tsx"], - "routeRoots": false, - "proofApplicability": "not-applicable", - "nonVisualRoute": { - "contract": { - "route": "src/app/ward-management/constellation/page.tsx", - "kind": "next-redirect-only" - }, - "source": { - "importsNextRedirect": true, - "hasDefaultFunction": true, - "hasJsx": false, - "terminalOutcomes": ["redirect"], - "redirectOnly": true - }, - "topologyMatches": true - }, - "declaredShellState": "v2", - "observedShellState": "v2", - "v2ShellMounted": true, - "v2MountMode": "inherited-global-root", - "inheritedFrom": "src/app/layout.tsx", - "directV2MountFiles": [], - "proof": { - "browser": { - "status": "not-applicable", - "evidence": [] - }, - "compact320": { - "status": "not-applicable", - "evidence": [] - }, - "dark": { - "status": "not-applicable", - "evidence": [] - }, - "forcedColours": { - "status": "not-applicable", - "evidence": [] - }, - "print": { - "status": "not-applicable", - "evidence": [] - } - }, - "baseline": { - "status": "not-applicable", - "files": [] - }, - "permittedComponentFamilies": [], - "sanctionedSpecialPatterns": [], - "roots": [] - }, { "id": "favourites", "disposition": "owned", @@ -3513,271 +3453,6 @@ } ] }, - { - "id": "ward-management", - "disposition": "owned", - "documentedDisposition": "Ward Flow is a synthetic operational coordination surface with a coordinator command home, statewide flow diagram and explainable shortlist, rail-based mode navigation, role-aware queue-first phone fallback, linked operational workspaces, and an explainable human-confirmed destination workflow.", - "routes": [ - "src/app/ward-management/capacity/page.tsx", - "src/app/ward-management/ed/[edId]/page.tsx", - "src/app/ward-management/exceptions/page.tsx", - "src/app/ward-management/governance/page.tsx", - "src/app/ward-management/movements/page.tsx", - "src/app/ward-management/network/page.tsx", - "src/app/ward-management/page.tsx", - "src/app/ward-management/patients/[patientId]/page.tsx", - "src/app/ward-management/queue/page.tsx", - "src/app/ward-management/transport/officer/page.tsx", - "src/app/ward-management/transport/page.tsx", - "src/app/ward-management/ward/[unitId]/page.tsx" - ], - "routeRoots": true, - "proofApplicability": "required", - "nonVisualRoute": null, - "declaredShellState": "v2", - "observedShellState": "v2", - "v2ShellMounted": true, - "v2MountMode": "inherited-global-root", - "inheritedFrom": "src/app/layout.tsx", - "directV2MountFiles": [], - "proof": { - "browser": { - "status": "passed", - "evidence": ["tests/ui-visual-baseline.spec.ts"] - }, - "compact320": { - "status": "passed", - "evidence": ["tests/ui-smoke.spec.ts"] - }, - "dark": { - "status": "passed", - "evidence": ["tests/ui-style-contract.spec.ts"] - }, - "forcedColours": { - "status": "passed", - "evidence": ["tests/ckb-v2-token-contract.test.ts"] - }, - "print": { - "status": "passed", - "evidence": ["tests/global-v2-activation.test.ts"] - } - }, - "baseline": { - "status": "not-committed", - "files": [] - }, - "permittedComponentFamilies": ["controls", "feedback", "layout"], - "sanctionedSpecialPatterns": [ - "ClinicalRail", - "CoordinatorScreen", - "PatientMovementWorkspace", - "WardModeNavigation", - "WardModeWorkspace", - "WardNetworkWorkspace" - ], - "roots": [ - { - "file": "src/app/ward-management/capacity/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace"] - }, - { - "file": "src/app/ward-management/ed/[edId]/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": [] - }, - { - "file": "src/app/ward-management/exceptions/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace"] - }, - { - "file": "src/app/ward-management/governance/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace"] - }, - { - "file": "src/app/ward-management/movements/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace"] - }, - { - "file": "src/app/ward-management/network/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace"] - }, - { - "file": "src/app/ward-management/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["CoordinatorScreen"] - }, - { - "file": "src/app/ward-management/patients/[patientId]/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": [] - }, - { - "file": "src/app/ward-management/queue/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace"] - }, - { - "file": "src/app/ward-management/transport/officer/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": [] - }, - { - "file": "src/app/ward-management/transport/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": [] - }, - { - "file": "src/app/ward-management/ward/[unitId]/page.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": [] - }, - { - "file": "src/components/ward-management/coordinator/coordinator-screen.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["CoordinatorScreen", "ClinicalRail"] - }, - { - "file": "src/components/ward-management/ed/ed-screen.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["ClinicalRail"] - }, - { - "file": "src/components/ward-management/officer/officer-screen.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["ClinicalRail"] - }, - { - "file": "src/components/ward-management/ward-management-console.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["ClinicalRail"] - }, - { - "file": "src/components/ward-management/ward-management-modes.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeWorkspace", "ClinicalRail", "WardNetworkWorkspace"] - }, - { - "file": "src/components/ward-management/ward-management-navigation.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardModeNavigation", "ClinicalRail"] - }, - { - "file": "src/components/ward-management/ward-management-network.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["WardNetworkWorkspace"] - }, - { - "file": "src/components/ward-management/ward/ward-screen.tsx", - "exists": true, - "imports": [], - "importedFamilies": [], - "literalCkbV2": false, - "dynamicCkbV2": false, - "v2MountMode": "inherited-global-root", - "sanctionedPatternsPresent": ["ClinicalRail"] - } - ] - }, { "id": "privacy-safety-and-reference", "disposition": "owned", @@ -4102,20 +3777,7 @@ "src/app/caring-contacts/patients/page.tsx", "src/app/privacy/page.tsx", "src/app/reference/colour-coding/page.tsx", - "src/app/safety-plan/page.tsx", - "src/app/ward-management/capacity/page.tsx", - "src/app/ward-management/constellation/page.tsx", - "src/app/ward-management/ed/[edId]/page.tsx", - "src/app/ward-management/exceptions/page.tsx", - "src/app/ward-management/governance/page.tsx", - "src/app/ward-management/movements/page.tsx", - "src/app/ward-management/network/page.tsx", - "src/app/ward-management/page.tsx", - "src/app/ward-management/patients/[patientId]/page.tsx", - "src/app/ward-management/queue/page.tsx", - "src/app/ward-management/transport/officer/page.tsx", - "src/app/ward-management/transport/page.tsx", - "src/app/ward-management/ward/[unitId]/page.tsx" + "src/app/safety-plan/page.tsx" ], "declared": [ "src/app/(search-app)/calculators/page.tsx", @@ -4185,20 +3847,7 @@ "src/app/caring-contacts/patients/page.tsx", "src/app/privacy/page.tsx", "src/app/reference/colour-coding/page.tsx", - "src/app/safety-plan/page.tsx", - "src/app/ward-management/capacity/page.tsx", - "src/app/ward-management/constellation/page.tsx", - "src/app/ward-management/ed/[edId]/page.tsx", - "src/app/ward-management/exceptions/page.tsx", - "src/app/ward-management/governance/page.tsx", - "src/app/ward-management/movements/page.tsx", - "src/app/ward-management/network/page.tsx", - "src/app/ward-management/page.tsx", - "src/app/ward-management/patients/[patientId]/page.tsx", - "src/app/ward-management/queue/page.tsx", - "src/app/ward-management/transport/officer/page.tsx", - "src/app/ward-management/transport/page.tsx", - "src/app/ward-management/ward/[unitId]/page.tsx" + "src/app/safety-plan/page.tsx" ], "undeclared": [], "missing": [], @@ -4206,17 +3855,17 @@ }, "adoption": { "literalCkbV2RootCount": 1, - "inheritedCkbV2RootCount": 95, + "inheritedCkbV2RootCount": 75, "dynamicCkbV2RootCount": 0, - "v2MountedSurfaceCount": 17, - "declaredV2SurfaceCount": 17 + "v2MountedSurfaceCount": 15, + "declaredV2SurfaceCount": 15 }, "summary": { "registeredComponentCount": 55, "previewCount": 55, "productImportedComponentCount": 36, - "rootCount": 96, - "productionRouteCount": 81, - "nextUiEntryCount": 142 + "rootCount": 76, + "productionRouteCount": 68, + "nextUiEntryCount": 128 } } diff --git a/docs/site-map.md b/docs/site-map.md index d93e33df70..bb3153476a 100644 --- a/docs/site-map.md +++ b/docs/site-map.md @@ -59,18 +59,6 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir - `/therapy-compass/review` - Therapy records awaiting qualified-clinician source review. Source: `src/app/(search-app)/therapy-compass/review/page.tsx`. - `/therapy-compass/search` - Therapy library search surface. Source: `src/app/(search-app)/therapy-compass/search/page.tsx`. - `/tools` - Clinical tools and applications launcher directory. Source: `src/app/(search-app)/tools/page.tsx`. -- `/ward-management` - Statewide psychiatry ward demand, bed capacity, and patient flow console. Source: `src/app/ward-management/page.tsx`. -- `/ward-management/capacity` - Ward bed availability, unit occupancy, and staffing capacity. Source: `src/app/ward-management/capacity/page.tsx`. -- `/ward-management/constellation` - Intentional, unlinked backwards-compatibility redirect to `/ward-management/network` (pointing to the current Ward Management home). Phase 2 retired the constellation command view. Source: `src/app/ward-management/constellation/page.tsx`. -- `/ward-management/ed/[edId]` - Synthetic emergency-department role screen for one origin department. Source: `src/app/ward-management/ed/[edId]/page.tsx`. -- `/ward-management/exceptions` - Patient flow exceptions, delays, and escalation alerts. Source: `src/app/ward-management/exceptions/page.tsx`. -- `/ward-management/governance` - Ward coordination governance, compliance, and audit log. Source: `src/app/ward-management/governance/page.tsx`. -- `/ward-management/movements` - Scheduled and completed patient transfers and bed movements. Source: `src/app/ward-management/movements/page.tsx`. -- `/ward-management/network` - Psychiatric bed network status and regional catchment map. Source: `src/app/ward-management/network/page.tsx`. -- `/ward-management/queue` - Priority referral queue and triage waiting list. Source: `src/app/ward-management/queue/page.tsx`. -- `/ward-management/transport` - Patient inter-hospital transfer and transport logistics. Source: `src/app/ward-management/transport/page.tsx`. -- `/ward-management/transport/officer` - Synthetic transport-officer phone screen for in-flight jobs. Source: `src/app/ward-management/transport/officer/page.tsx`. -- `/ward-management/ward/[unitId]` - Synthetic ward-manager screen for one inpatient unit. Source: `src/app/ward-management/ward/[unitId]/page.tsx`. ## Mode/query routes @@ -1142,10 +1130,6 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir - `/documents/[id]` - Document viewer/detail page. Individual document IDs are intentionally not enumerated in this sitemap. -## Ward management patient route - -- `/ward-management/patients/[patientId]` - Synthetic patient placement and transfer trajectory detail. Synthetic patient IDs are generated runtime data and intentionally not enumerated in this sitemap. - ## Mockup/prototype routes - `/mockups/accessible-table-browser-fixture` - Route discovered from app directory Source: `src/app/mockups/accessible-table-browser-fixture/page.tsx`. @@ -1270,6 +1254,22 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir - `/mockups/universal-search-command` - Route discovered from app directory Source: `src/app/mockups/universal-search-command/page.tsx`. - `/mockups/universal-search-redesign` - Route discovered from app directory Source: `src/app/mockups/universal-search-redesign/page.tsx`. - `/mockups/verification-notice-subtle` - Route discovered from app directory Source: `src/app/mockups/verification-notice-subtle/page.tsx`. +- `/mockups/ward-flow` - Route discovered from app directory Source: `src/app/mockups/ward-flow/page.tsx`. +- `/mockups/ward-flow/capacity` - Route discovered from app directory Source: `src/app/mockups/ward-flow/capacity/page.tsx`. +- `/mockups/ward-flow/constellation` - Route discovered from app directory Source: `src/app/mockups/ward-flow/constellation/page.tsx`. +- `/mockups/ward-flow/ed/[edId]` - Route discovered from app directory Source: `src/app/mockups/ward-flow/ed/[edId]/page.tsx`. +- `/mockups/ward-flow/escalation` - Route discovered from app directory Source: `src/app/mockups/ward-flow/escalation/page.tsx`. +- `/mockups/ward-flow/exceptions` - Route discovered from app directory Source: `src/app/mockups/ward-flow/exceptions/page.tsx`. +- `/mockups/ward-flow/governance` - Route discovered from app directory Source: `src/app/mockups/ward-flow/governance/page.tsx`. +- `/mockups/ward-flow/handover` - Route discovered from app directory Source: `src/app/mockups/ward-flow/handover/page.tsx`. +- `/mockups/ward-flow/movements` - Route discovered from app directory Source: `src/app/mockups/ward-flow/movements/page.tsx`. +- `/mockups/ward-flow/network` - Route discovered from app directory Source: `src/app/mockups/ward-flow/network/page.tsx`. +- `/mockups/ward-flow/patients/[patientId]` - Route discovered from app directory Source: `src/app/mockups/ward-flow/patients/[patientId]/page.tsx`. +- `/mockups/ward-flow/queue` - Route discovered from app directory Source: `src/app/mockups/ward-flow/queue/page.tsx`. +- `/mockups/ward-flow/search` - Route discovered from app directory Source: `src/app/mockups/ward-flow/search/page.tsx`. +- `/mockups/ward-flow/transport` - Route discovered from app directory Source: `src/app/mockups/ward-flow/transport/page.tsx`. +- `/mockups/ward-flow/transport/officer` - Route discovered from app directory Source: `src/app/mockups/ward-flow/transport/officer/page.tsx`. +- `/mockups/ward-flow/ward/[unitId]` - Route discovered from app directory Source: `src/app/mockups/ward-flow/ward/[unitId]/page.tsx`. - `/mockups/warning-consolidation` - Route discovered from app directory Source: `src/app/mockups/warning-consolidation/page.tsx`. - `/mockups/warning-line` - Route discovered from app directory Source: `src/app/mockups/warning-line/page.tsx`. @@ -1352,10 +1352,10 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir - `/formulation` - Redirects to `/?mode=formulation`. Source: `src/app/(search-app)/formulation/page.tsx`. - `/mockups/favourites-hub` - Redirects to `/favourites`. Source: `src/app/mockups/favourites-hub/page.tsx`. - `/mockups/medication-prescribing` - Redirects to `/medications/acamprosate`. Source: `src/app/mockups/medication-prescribing/page.tsx`. +- `/mockups/ward-flow/constellation` - Redirects to `/mockups/ward-flow/network`. Source: `src/app/mockups/ward-flow/constellation/page.tsx`. - `/services` - Redirects to `/?mode=services`. Source: `src/app/(search-app)/services/page.tsx`. - `/specifiers` - Redirects to `/?mode=specifiers`. Source: `src/app/(search-app)/specifiers/page.tsx`. - `/therapy-compass` - Redirects to `/?mode=therapy-compass`. Source: `src/app/(search-app)/therapy-compass/page.tsx`. -- `/ward-management/constellation` - Redirects to `/ward-management/network`. Source: `src/app/ward-management/constellation/page.tsx`. ## Known caveats and stale-path flags @@ -1385,7 +1385,6 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir | Therapy Compass | `src/app/(search-app)/therapy-compass, src/lib/therapies.ts` | | Factsheets | `src/app/(search-app)/factsheets, src/components/factsheets` | | Dictionary | `src/app/(search-app)/dictionary, src/lib/dictionary.ts` | -| Ward Management | `src/app/ward-management, src/components/ward-management` | | Safety Plan | `src/app/safety-plan, src/components/patient-safety-plan.tsx` | | Privacy | `src/app/privacy` | | Tools | `src/components/applications-launcher-page.tsx` | diff --git a/docs/superpowers/plans/2026-08-19-ward-flow-phase-3-role-screens.md b/docs/superpowers/plans/2026-08-19-ward-flow-phase-3-role-screens.md index af9d04ee9b..a850bbc3cf 100644 --- a/docs/superpowers/plans/2026-08-19-ward-flow-phase-3-role-screens.md +++ b/docs/superpowers/plans/2026-08-19-ward-flow-phase-3-role-screens.md @@ -1429,7 +1429,13 @@ test("shows a department its own patients, both clocks, and one outstanding item - [ ] **Step 3: Build it** -Its own patients, filtered on `originEdId`. Each row carries **both clocks** — time in the department from `openedAt`, and the legal clock from `formedAt` where that is earlier, marked `data-community-formed="true"` when they differ — plus the four-hour access target, a police flag where `arrivalMode` says so, and **the single outstanding item**: a form, an examination, a transport request, or handover. +Its own patients, filtered on `originEdId`. Each row carries **both clocks** — time in the department from `openedAt`, and the legal clock from `formedAt` where that is earlier, marked `data-community-formed="true"` when they differ — plus the 24-hour access target, a police flag where `arrivalMode` says so, and **the single outstanding item**: a form, an examination, a transport request, or handover. + +> **Superseded 2026-08-22.** This step originally named the access target as four hours (240 +> minutes). The product owner — the spec's own author — changed it to 24 hours (1440 minutes) for +> this prototype, in response to a direct clinical question. `ED_ACCESS_TARGET_MINUTES` in +> `ward-model.ts` and its tests carry the current value; nothing else about how the figure is +> counted, rendered or safeguarded changed. Two forms: **raise a referral** (cohort, security, sex, specialling, legal status, urgency — dispatching `RAISE_REFERRAL`) and **record an examination** with its outcome (dispatching `RECORD_EXAMINATION`; `revoked` closes the movement). diff --git a/docs/superpowers/plans/2026-08-25-ward-flow-phase-4-specialist-boards.md b/docs/superpowers/plans/2026-08-25-ward-flow-phase-4-specialist-boards.md new file mode 100644 index 0000000000..d9266a2c89 --- /dev/null +++ b/docs/superpowers/plans/2026-08-25-ward-flow-phase-4-specialist-boards.md @@ -0,0 +1,1160 @@ +# Ward Flow Phase 4 — specialist boards, implementation plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Build the eleven Phase 4 items — a scarcer scenario, mid-flight urgency and legal-status +changes, the undo the prototype has never had, and six specialist boards — leaving the statutory +clock board deliberately unbuilt. + +**Architecture:** Every change follows the existing shape. New behaviour arrives as a reducer event +with a role gate and a `Rejection` on refusal; new reads arrive as pure derivations in +`ward-derivations.ts`; new screens are route components under `src/app/ward-management/` rendering +components under `src/components/ward-management/`. The reducer stays pure, `now` arrives on every +event, and nothing reads the wall clock outside `ward-clock.ts`. + +**Tech Stack:** Next.js 16 App Router, React 19, TypeScript 6 strict, CSS modules with `@theme` +design tokens, Vitest for unit and DOM tests, Playwright (Chromium) for journeys. + +**Spec:** `docs/superpowers/specs/2026-08-25-ward-flow-phase-4-specialist-boards-design.md` + +## Global Constraints + +Copied verbatim from spec §1. Every task's requirements implicitly include this section. + +1. **Never invent, infer, restate or "correct" any figure, requirement, title or classification from + the Mental Health Act.** If a legal quantity is needed it comes from the product owner or it does + not exist. Form titles resolve from the official register (`formTitleForCode`) or render as the + bare code. +2. **Synthetic data only.** No name, date of birth, medical record number, address, diagnosis, + narrative history or treatment. **Sex is the only permitted patient attribute. Free text counts.** +3. **Advisory only.** The system proposes; a human confirms or overrides, always, with the reason + recorded. Nothing auto-allocates and nothing defaults after a timeout. +4. **Conservative failure.** Missing data narrows what is shown. An absence renders as an explicit + absence, never as a substituted default. No `?? array[0]`, no `.find()!`. +5. **Not a medical device**, and the pages say so. +6. **Repo gates:** design tokens only (no raw hex); every `