Implementation plan / Session plan / Handover RC-3-S18
Handover RC-3-S18 Screens: ADM screens (part 1 of 2)¶
Card: RC-3-S18. Issue: cema-care/his#74. Branch: session/RC-3-S18. Slice: RC-3. Decision record: ADR-HIS-109.
What was built and where¶
This session added two screen folders to the ADM workspace and changed nothing else in web/.
| Folder | Screen | Workspace, nav order | Calls |
|---|---|---|---|
web/domains/adm/UI-ADM-003/ |
UI-ADM-003 Encounter and ADT console | W09 Front desk, 15 | encounters.v1 listEncounters, readEncounter, listEncounterHistory, transitionEncounter (end-visit, cancel), correctEncounter (attributes; reverse admit, discharge, end-visit); adt.v1 createAdmissionRequest, listAdmissionRequests, confirmAdmission, admitFromEmergency, recordLeave, recordReturn, recordDischargeDecision, recordDischarge, readEncounterClosure, closeEncounter; beds.v1 readBedReservation, readBed; patient-identity.v1 searchPersons, readPerson; contracts/ess master-data.v1 listServices, listOrganizations, listPractitioners; terminology.v1 expandValueSet |
web/domains/adm/UI-ADM-004/ |
UI-ADM-004 Bed board and bed management | W10 Patient flow, 5 (the workspace home) | beds.v1 listBeds, readBed, listBedHistory, changeBedState, changeBedIsolation, searchEligibleBeds, reserveBed, readBedReservation, releaseBedReservation, readBedCensus, listCleaningTasks; adt.v1 listAdmissionRequests, decideAdmissionRequest; patient-identity.v1 readPerson; terminology.v1 expandValueSet |
UI-ADM-003 Encounter and ADT console. The code is in EncounterConsole.tsx, Transactions.tsx, panels.tsx and model.ts.
- Opening an encounter. The console opens with no patient (ADR-HIS-069 point 6).
- The user finds the patient by No. RM or NIK and opens one of their encounters. Open encounters are listed first.
- Or the user arrives from the bed board with an encounter.
- A patient with no open encounter gets the empty state, with a link to Patient registration. The console creates no encounter.
- Layout (brief 1 to 6):
- The patient context zone (counter variant) carries the encounter line (type · facility · location · team · clinician) and "Continues from …", which opens the earlier encounter (PH-05).
- The encounter header has the state label (CUX-06), the "Pending discharge", "On leave · expected back … · bed held/released", "Transfer pending" and "Attribution pending" markers, and the summary fields. No. Registrasi is shown on demand (PH-01).
- A location withheld under a privacy label reads "Location not disclosed".
- The transaction area holds one transaction at a time [A].
- The side panels are the admission request tracker (Requested → Accepted → Bed allocated → Admitted, with times), the closure criteria for a Discharged or Closed encounter, and the care episode trail on demand.
- The state history is listed newest first [A], with Corrected entries and their before and after values. An entry corrected later is marked so.
- The action bar offers only what the state model permits (
model.ts permittedActions). Destructive actions are apart (CUX-11). Closed and Cancelled encounters are read-only, except a correction of a Closed one. "Open transfer panel" is disabled with its reason. - Transactions:
- Request admission: admitting service, acuity, ward or unit, bed type, isolation need (no default), requested time (now) and requesting clinician (the signed-in one, if the registry links them).
- Confirm admission: in the bed reserved for the encounter (read from the request's reservation) or in a bed chosen on the bed board, with responsible unit, care team, attending practitioner and time. A refused bed shows the unit's message and sends the user to the finder for alternatives.
- Admit from emergency: on an emergency encounter with a request. Its confirmation summary says the emergency encounter is closed as "Admitted" and an inpatient encounter is opened and linked. The new encounter then opens.
- Record leave: the expected return must be after the leave time ("Expected return must be after the leave time."). The bed hold follows the leave policy, or is held or released explicitly, with a reason from the list.
- Record return: into the held bed, or a bed from the bed board when the bed was released.
- Discharge decision: recorded or withdrawn. It is a marker, not a state.
- End visit (outpatient and emergency) [A]: time and disposition, with "Discharge time is earlier than admission." and "Select a discharge disposition.". The confirmation summary shows the state change.
- Discharge patient (inpatient): held (review round 1). Its confirmation must show the Domain 3 medication reconciliation check (FR-ADM-ADT-003 part 6.2, CFG-CLI-013), which no contract serves yet. The form says so in amber, the action is disabled with its reason, and nothing is sent. The form, the summary (state change, bed to Cleaning, end of responsibility, destination organization) and the call to
recordDischargeare in place for when the check can be read. - Waive criteria and close encounter: the unmet criteria. Those that cannot be waived are marked so. Each waivable one has its own check box, with a reason and an expiry. "Encounter cannot be closed: (unmet criteria listed)." if any is left.
- Cancel encounter, Cancel admission, Reverse discharge, Correct encounter details: a confirmation summary, then the PH-03 sign step.
- Cancel encounter says the owning domains are notified and their records are not deleted. The unit's "Supervisor authority required: encounter has linked activity." is shown as sent.
- Cancel admission returns the encounter to Registered or Cancelled.
- Reverse discharge offers a new bed when the old one is no longer free.
- A correction shows the values before and after.
- Every command:
- carries If-Match and one Idempotency-Key per intent;
- disables its button while it runs;
- after a lost answer, offers "Check again whether it was saved" with the same key.
- A stale version (412) reloads the encounter, says what changed and keeps the entries.
UI-ADM-004 Bed board. The code is in BedBoard.tsx, board.tsx, grid.tsx, BedPanel.tsx, RequestQueue.tsx, Finder.tsx, CleaningTasks.tsx, WallDisplay.tsx and model.ts.
- Census header: counts by state that add up to the total, with "Isolation in force" counted apart (PH-04). It shows "As at [time]", and "Not updated for [n] minutes" in amber when the unit flags the board stale or the copy is older than 5 minutes (CFG-ADM-021, CUX-53). The board is read every 5 seconds, and its watermark goes to the status line.
- Unit select: taken from the census. Empty state: "No beds defined for this unit".
- Beds by room (OV-23 bed layout).
- The room header marks an "Isolation room" whether or not isolation is in force.
- Each tile shows the state as the main label, with a symbol, never colour alone. The label is the unit's own ("Blocked · isolation", "Cleaning · terminal clean").
- It also shows the isolation badge "Isolation · Droplet" (the precaution, never the organism), "Isolation exposure · review", "Cohort only", "Transfer pending" and the registry flag.
- It shows the occupant as the unit discloses it to the role, the reservation expiry and the expected availability.
- Bed panel: the bed's details and append-only history (entry, state, effective and recorded time, actor, reason, ADT cause, cleaning time). Actions by state (
model.ts bedActions): - block and unblock;
- out of service and back;
- start and complete cleaning by step;
- designate isolation (precaution type, source order, reason, the policy for a shared room) and end it;
- release a reservation.
- A bed "Blocked · isolation" offers no unblock and says when it is released. Occupancy is never set from the board.
- "Open encounter console" hands the encounter to UI-ADM-003.
- A change needing a reason cannot be saved without one ("Enter the reason.").
- Admission requests (OV-22): patient name and No. RM, service and acuity, requirements and requested time. A request can be accepted for its unit, have a bed found (or changed, when one is allocated), or be cancelled with a reason from the list.
- Eligible bed finder (OV-21): the eligible beds, and apart from them the beds failing only a soft constraint, each with what it fails.
- "Reserve bed".
- A 409 refreshes the list with "Bed was just reserved by another user. List refreshed.".
- "Reserve with override" requires a reason. "Supervisor approves here" is disabled with its reason (ADR-HIS-078 point 1), and a 403 names the supervisor.
- Opened from the console, the finder hands the reserved or chosen bed back (ADR-HIS-109 point 2).
- Cleaning tasks: the open tasks, embedded on the board (OV-115), with "Cleaning · terminal clean" and the steps. Start and complete call the bed turnover transaction with the bed's version.
- Wall display at
/adm/ui-adm-004/display?unit=<unit>: read-only, large type, no action, no occupant, the isolation precaution shown. A refusal reads "This display is not configured for this unit.".
Shared files (ADR-HIS-109 point 1):
- Identical in both folders: api/adt.ts, api/beds.ts, handoff.tsx, fields.tsx, confirm.tsx.
- Identical to UI-ADM-008's: failure.tsx, intents.ts, ui.tsx, time.ts, fake-gateway.ts, patients.tsx, api/persons.ts, api/terminology.ts, check-against-stubs.sh.
- api/http.ts is UI-ADM-011's.
- UI-ADM-003 alone has api/encounters.ts and api/registry.ts.
ADR-HIS-109 records eight decisions. Its row is in the decision record index, which now holds 106 records. ADR-HIS-108 is taken by the open pull request #264 (RC-3-S13), checked against origin/main and every open pull request on 2026-11-30.
Checks and their result¶
| Check | Command | Result |
|---|---|---|
| Type check | pnpm build in web/domains/adm |
passed |
| Component and accessibility tests | pnpm test in web/domains/adm |
178 passed, 19 skipped (the ten stub test files). New: UI-ADM-003 17, UI-ADM-004 15 |
| The pipeline's web job for the shell | web/shell/scripts/ci.sh web/shell |
passed; the shell bundles EncounterConsole and BedBoard, and screen discovery passes |
| Against the contract stubs | each new folder's stubs.test.tsx against his-contract serve contracts/adm and contracts/ess |
passed: UI-ADM-003 2 tests, UI-ADM-004 3; neither stub recorded a violation |
| Static analysis | platform/delivery-pipeline/bin/static-analysis web/domains/adm/UI-ADM-003 web/domains/adm/UI-ADM-004 |
no blocking finding; no clinical artifact |
| Secret scan | platform/delivery-pipeline/bin/secret-scan code origin/main HEAD, secret-scan docs origin/main HEAD |
no secret |
| Documentation links and site | python3 docs/implementation_plan/tools/check_links.py; mkdocs build |
0 broken links, 0 duplicate anchors; the site builds |
How the stub check was run. The host's Node.js 22.22.1 cannot run his-contract (as RC-2-S07 and RC-2-S08 found), so the steps were:
1. contracts/common was installed in node:22.18-bookworm.
2. The ADM and ESS stubs ran there, with node contracts/common/src/cli.ts serve contracts/<domain> --host 127.0.0.1, on the host network.
3. Each stubs.test.tsx ran on the host with HIS_ADM_STUB_URL and HIS_ESS_STUB_URL, after POST /__stub/reset.
4. GET /__stub/violations answered [] on both.
check-against-stubs.sh runs exactly these steps on a host whose Node.js strips types.
What the stubs can and cannot show:
- The stub keeps one record per example identifier and operation. The encounter readEncounter knows (4b6d…) is not the one the adt.v1 examples use (7d9f…), so admission, leave, discharge and closure cannot be walked through the stub on one encounter. Through the stub the console shows:
- the encounter, its patient, history and request;
- a cancellation (transitionEncounter) and a correction (correctEncounter), each with the sign step.
- The stub answers each transition with its example, a Discharged encounter, whose closure it does not hold. So the test tolerates "not found" in the closure panel after the answer, and no other alert.
- The ESS stub's terminology service holds no adm. list. Through the stub, reasons are given in words and the disposition list is unavailable, so "End visit" is disabled with its reason, as designed.
- Through the stub the bed board shows:
- the board with census and freshness;
- a bed's history, and a block;
- accepting a request;
- the finder and a reservation, through the handoff with the example request;
- the cleaning tasks and the wall display.
- The admission transactions and the closure are covered by the component tests, and against the built unit by RC-3-S24.
"Ends when", line by line:
- Each screen meets its brief and the clinical UX safety rules: see above, the tests below, and "Differences". What the contracts, the shell or D10 do not offer yet is shown disabled or stated, with its reason.
- Component and accessibility checks pass: pnpm test. Every test of a full screen state runs expectNoAxeViolations (WCAG 2.0 to 2.2 A and AA; NFR-ADM-008, UX-ADM-002). Controls are React Aria and keyboard operable, and every state is text with a symbol (UX-ADM-005).
- The screen works against the stubs of the contracts: the two stubs.test.tsx, as above.
- The change touches only the folders of its screens: git diff --name-only origin/main lists web/domains/adm/UI-ADM-003/, web/domains/adm/UI-ADM-004/, this handover, ADR-HIS-109 and the decision record index.
Requirements, test scenarios and tests¶
Tests are in UI-ADM-003/EncounterConsole.test.tsx, UI-ADM-004/BedBoard.test.tsx and each stubs.test.tsx. Each describe names its requirement and test scenario.
| Requirement | Scenario | What the screens do | Tests |
|---|---|---|---|
| FR-ADM-ENC-001 | TEST-ADM-012 | Find the patient, list their encounters, open one; the encounter line, header, No. Registrasi on demand; empty state with the link to registration; care episode and "Continues from" | "UI-ADM-003 encounter, header and history" (4); stub test of 003 |
| FR-ADM-ENC-002 | TEST-ADM-013 | Only permitted transitions offered; the unit's refusal shown with its reason; stale version reloaded with the entries kept; history with Corrected entries; cancellation and correction with summary and sign step; supervisor refusal; read-only Closed and Cancelled | "UI-ADM-003 encounter, header and history" (4), "cancellation and correction" (2); stub tests of 003 (2) |
| FR-ADM-ENC-003 | TEST-ADM-014 | The console shows the context the validation service answers: current location, responsible unit, team and attending, the same as the bed board's (part 6.6). The validation service itself is not a screen | covered by the header test of 003; the service by RC-3-S07 |
| FR-ADM-ADT-001 | TEST-ADM-015 | Request admission; confirm into the reserved bed; the bed finder round trip; lost answer checked with the same key; admit from emergency with summary; leave with hold and the time rule; return needing a bed after release; accepting and cancelling requests on the board | "UI-ADM-003 admission" (6); "UI-ADM-004 admission requests and the eligible bed finder" (accept and cancel) |
| FR-ADM-ADT-003 | TEST-ADM-017 | Inpatient discharge held while the medication reconciliation check cannot be read; end of visit with disposition, time rule and summary; closure criteria (unmet when not reported), waivers, refusal with unmet listed; reversal with sign step, three failures | "UI-ADM-003 discharge, closure and reversal" (5) |
| FR-ADM-BED-001 | TEST-ADM-018 | Census and freshness; beds by room with isolation, Blocked · isolation, exposure review; history; block, out of service, isolation; cleaning by step; lost answer; role refusal; wall display | "UI-ADM-004 bed board" (7), "cleaning tasks" (1), "wall display" (2); stub tests of 004 (3) |
| FR-ADM-BED-002 | TEST-ADM-019 | Eligible and soft-constraint beds apart; reservation; conflict refreshes the list; override with reason and supervisor refusal; the finder opened from the console | "UI-ADM-004 admission requests and the eligible bed finder" (5); stub test of 004 |
| FR-ADM-TRF-001, FR-ADM-FLW-002 | "Open transfer panel" disabled with its reason; the wall display mode of the board component | wall display tests of 004 | |
| NFR-ADM-008 | WCAG 2.2 AA rules with axe-core on each screen state | expectNoAxeViolations in both test files |
Safety rules with a test of their own: - CUX-06: state labels with a symbol. - CUX-10, 11, 12: summaries in place with the patient visible, "Cancel" focused, and the action repeated. - CUX-34, 35, 36: one key per intent, the button disabled while running, lost answers checked with the same key. - PH-03: the sign step, the credential sent with one request only, three attempts. - PH-04: isolation as a badge with the precaution, never a state; "Blocked · isolation" not unblockable. - CUX-53, BR-ADM-024: As at, and stale by the unit's flag or by age. - UX-ADM-008: the wall display with no action and no occupant. - BR-ADM-013, 014: beds failing a hard rule are not offered; a conflict refreshes the list.
Review round 1¶
The review asked for three changes, all made on this branch: - The discharge no longer goes ahead without the medication reconciliation check. Following CFG-CLI-013's default, an inpatient discharge is held in the console until Domain 3 serves the check, and the test asserts that nothing is sent. The Domain 3 contract is recorded as a dependency (session rule 4). - The question is on issue #74, for the owner of D01-ADM and the clinical safety officer, rather than only under "Needs a person". - The death statement shown with every disposition is removed. The owner is asked how the death member is identified.
Afterwards pnpm build, pnpm test (178 passed), check_links.py and the secret scan pass again.
Differences from the brief, the contract or the design¶
- Inpatient discharge is not confirmed in the console yet (FR-ADM-ADT-003 part 6.2, CFG-CLI-013; review round 1). The confirmation must show the Domain 3 medication reconciliation check and send an override reason when it warns. No Domain 3 contract serves the check, so "Discharge patient" is disabled with its reason. This follows the specification's default (reconciliation due before the discharge is confirmed). It is a dependency on a Domain 3 contract (session rule 4), and the owner's question is on issue #74.
- Death disposition (PR-ADT-003-3): the screen cannot tell which member of
adm.discharge-dispositionis a death without holding a code of the list (ADR-HIS-078 point 7). It shows no death statement of its own; the unit carries out the rule. Asked on issue #74. - Registration completeness is not shown in the header: no contract serves it to the console.
- Correction offers start time, service and attending practitioner. Encounter class and type wait for their lists in the terminology service.
- Care team is chosen among the facility's organizations:
master-data.v1has no care-team type (ADR-HIS-109 point 4). - The bed finder is reached by a handoff, not opened over the console (OV-21; ADR-HIS-109 point 2). Without an admission request, it asks for the isolation need instead of assuming none. An override is possible only on a reservation, which needs a request.
- Effective time of manual bed changes is "now" (the contract's default). The board does not offer back-dating a manual change.
- Pending discharge on a bed tile:
beds.v1does not carry it. The ward board of UI-ADM-012 shows it. - Wall display: shows no occupant at all, stricter than "initials and bed" (ADR-HIS-109 point 3). It runs inside the shell frame, as UI-ADM-012's does.
- Open transfer panel: disabled with its reason. UI-ADM-009 is RC-3-S19's.
- Read-only and downtime modes come from the shell banner, which gives a screen no signal yet (as in RC-1-S21, RC-2-S07 and RC-2-S08).
- Who may act (the supervisor's cancellation, the bed manager's override, housekeeping's cleaning-only role, the waiver authorities) is the unit's decision. The screens offer the action, and show the unit's refusal (ADR-HIS-078 point 1).
Needs a person¶
None of these blocks the merge.
- Enterprise Architecture Board: approval of ADR-HIS-109.
- Owner of D01-ADM, with the clinical safety officer (asked on issue #74), not blocking:
- Q1, medication reconciliation check: until Domain 3 serves the CFG-CLI-013 check, the console holds inpatient discharges (the specification's default). Should they stay held, or is another interim behaviour wanted, for example recording the discharge with a recorded override reason? Either is a small change.
- Q2, death disposition: how does a screen tell the death member of
urn:his:adm:discharge-disposition, for the summary of PR-ADT-003-3? For example, a property of the value set in D10 terminology.
Follow-ups outside the card¶
- Contracts:
- D03: a medication reconciliation check readable by Domain 1 (CFG-CLI-013). Until it exists, inpatient discharge is held in UI-ADM-003 (session rule 4 dependency).
- D01
beds.v1: an occupant privacy setting or initials for the wall display, and pending discharge on the bed. - D10
master-data.v1: a care-team entity type. - D10 terminology: the
adm.encounter-classandadm.encounter-typelists, and a death property on the disposition list. - D10 registrations: the value sets the screens read:
adm.admission-acuity,adm.bed-type,adm.encounter-type;adm.discharge-disposition,adm.leave-reason,adm.closure-waiver-reason;adm.encounter-correction-reason,adm.encounter-cancellation-reason;adm.bed-block-reason(also used for out of service),adm.isolation-reason;adm.reservation-release-reason,adm.admission-request-cancellation-reason.- Also the
accountlink of practitioners, for the requesting clinician's default. - RC-3-S19 (UI-ADM-009): reach the bed finder through the same handoff, adding a purpose to
handoff.tsx. Enable "Open transfer panel" in both screens. - Shell and SDK: navigation with a payload, a step-up host, a read-only and downtime signal, and a wall-display frame. The shared copies then move there.
- Design system: the select, radio group and checkbox of
ui.tsxandTransactions.tsx; the bed tile and census header (with the flow board's, OV-04); the in-place confirmation summary. - Host tooling: as before, the server's Node.js cannot run the contract tool.