Skip to content

Architecture / Decision records / ADR-HIS-067

ADR-HIS-067 Slice RC-2 contracts: scheduling and flow APIs, encounter transitions, payer and consent references, the pair review, and an upstream FIN contract

Status Accepted
Decided 2026-11-25 by session RC-2-S01
Record Drafted 2026-11-25; approved 2026-11-25 by the Enterprise Architecture Board
Where the rule lives contracts/adm/ (its README.md, contract.yaml, api/, events/, TRACE.md); contracts/ess/ (consent.v1, notification.v1); contracts/fin/; D01-ADM section 7.3; D10-ESS section 7.3; e2e/scenarios/RC-2/

Context

The contract session of slice RC-2, RC-2-S01, fixes what the outpatient visit exposes before it is built: MOD-ADM-004 (encounter transitions), MOD-ADM-007 (scheduling), MOD-ADM-008 (queues and flow boards), MOD-ADM-010 (payer and consent references), MOD-ESS-003 (consent directives) and MOD-ESS-007 (notifications). It builds on the D01-ADM contracts of RC-1 (ADR-HIS-049) and the D10-ESS contracts of RC-1 (ADR-HIS-048). Its contracts bind the build sessions RC-2-S02 to S06, the screen sessions RC-2-S07 to S09 and the integrate session RC-2-S10.

The issue of the card (#46) added a change to the RC-1 contract that RC-1-S09 is blocked on: answer A to its question Q-S09-4, an operation by which adm-patient-administration records a pair review with adm-identity, a field for an open review item that is not high-risk, and the INT-ADM-001 handoff of an existing person's changed demographics.

What was open: - Which API serves scheduling and flow. IF-ADM-006 and IF-ADM-007 are served by one new unit, adm-scheduling-flow (MOD-ADM-007 and 008). - The order of queue events. D01-ADM 8.5 orders queue events per encounter, and the encounter topic his.adm.encounter.v1 is sequenced by adm-patient-administration. A second producer on that topic would break its sequence (architecture 6.3). - How far FR-ADM-ENC-002 reaches in RC-2. The state model of section 4.3 includes admission, leave, return, inpatient discharge and closure, which are ADT transactions of MOD-ADM-005 (RC-3) needing beds and other modules. The pre-admitted to registered arrival has no event in the catalogue. - Where payer and consent references live. FR-ADM-REF-001 stores coverage references on the encounter; FR-ADM-REF-002 on the patient or encounter; DE-ADM-021 is keyed by CIN and sequence. - Payer verification. FR-ADM-REF-001 calls Domain 5 (IF-FIN-003), which no RC-2 session builds and which has no contract yet; Domain 5's contract session is in slice BC-1, which RC-2 enables. - How a reason code is returned for a refused transition (IF-ADM-003: "invalid transitions return the reason code"). The shared Problem has only pointer and message per error. - Appointment references. The shared ReferenceType has no Appointment, and only foundation sessions change contracts/common. - Field shapes shared with D10-ESS: the consent type, the notification subject and recipient, and the delivery status.

Decision

  1. Two APIs on one new unit. scheduling.v1 (IF-ADM-006, 33 operations) and flow.v1 (IF-ADM-007, 11 operations) are served by services/adm-scheduling-flow. Every operation is facility-owned; a record addressed by path of another facility is hidden (scheduling, queues and boards are administrative and operational functions, architecture 7.5). The one exception is readFlowState, an encounter's flow state, which is clinical encounter context: across facilities the policy decision point decides, as for readEncounter (Q-RC2-1, answered by the person). Slots are derived, not stored: a slot is an opaque slotId from searchSlots, which bookAppointment checks again at commit, so availability is decided once, at the reservation.
  2. Versioned definitions with a decision step. Templates (DE-ADM-015) and resource calendars (DE-ADM-016) are created as drafts and versioned with revise…; decide…Version approves or retires a version, which becomes effective from its date. An appointment keeps the template version it was booked under. Queue and board definitions, and the CFG-ADM-016 to 021 settings, stay D10 configuration items, read through flow.v1.
  3. Queue events have an aggregate of their own. QueueStateChanged is published on his.adm.encounterflow.v1 with aggregate EncounterFlow and the encounter identifier as aggregate id, sequenced per encounter by adm-scheduling-flow. This gives the per-encounter order of 8.5 without a second producer on the encounter topic. Appointment events (and ResourceReleased of scheduled resources) share his.adm.appointment.v1, ordered per appointment, so a release never overtakes the change that caused it; WaitlistEntryChanged has his.adm.waitlistentry.v1.
  4. Encounter transitions in RC-2 are those of the outpatient visit. encounters.v1 1.1 adds transitionEncounter with end-visit (Registered to Discharged, publishing PatientDischarged, EVT-ADM-011, as the end of visit of section 4.3) and cancel (publishing EncounterCancelled), correctEncounter (attribute correction or reversal of the latest end-visit, publishing EncounterCorrected) and listEncounterHistory (DE-ADM-009). MOD-ADM-005 (RC-3) adds its transitions as new values of transition, which is compatible for a request. The pre-admitted to registered arrival is left to RC-3 with pre-admission, because the catalogue has no event for it.
  5. A refused transition carries its reason code in detail. The 400 validation-failed names /transition or /effectiveTime in errors with the user message of part 10, and its detail is a TransitionRejection code. This keeps the shared Problem unchanged.
  6. Payer references on the encounter, consent references on the registration. capturePayerReference and listPayerReferences are sub-resources of the encounter (DE-ADM-021, keyed by encounter and sequence), and Encounter.payerContext summarises the current one. runConsentCheck, recordConsentReference and listConsentReferences belong to the registration (DE-ADM-022), with the encounter as an optional link, because the general consent is per patient and facility. The consent check links a valid existing directive itself; the desk captures a missing one through the D10 consent service (UI-ESS-006) and then records the reference. Domain 1 keeps only a snapshot of the directive's status.
  7. An upstream contract for D05-FIN. contracts/fin version 1 holds only the eligibility part of IF-FIN-003 (requestEligibility, readEligibilityRequest) and CoverageVerified (EVT-FIN-011), as the card's "stub for every upstream module the slice needs but does not build". The D05-FIN contract session of slice BC-1 owns the folder from then on and extends it compatibly. In the first release a request answers pending-verification, so the ADM build tests both the available and the unavailable path (TEST-ADM-029).
  8. The pair review is adm-identity's (answer A to Q-S09-4). patient-identity.v1 1.1 adds recordIdentityReview (POST /v1/identity-reviews: an IdentityMatch, its D10 task and DuplicateReviewRequested for each pair to review, with the held matching data on the match), Person.identityUnderReview, and recordDemographicChange (POST /v1/persons/{personId}/demographic-changes, the INT-ADM-001 handoff). The handoff is ordered by demographicsVersion: an applied version changes nothing, a gap is 412, so delivery can be at least once without loss or reordering.
  9. Appointments are referenced by identifier. Until contracts/common adds Appointment to ReferenceType, an appointment is appointmentId (UUID) in ADM and FIN, and {type: adm.Appointment, id} as an ESS subject.
  10. The producer's names and types win across domains (architecture 6.6): the ADM consent type is the ESS ConsentType string, the reminder recipient is {kind: patient, id} and the patient patient, and the reminder's delivery status carries the ESS notification states after the ADM-only scheduled and pending.

The open questions, decided on common practice

The person reviewing the pull request approved the contracts and asked the session to decide the seven questions of its handover on common practice (2026-11-25), as RC-1-S09 did for Q-S09-1 to 3. The specification is not changed by this record; the owners confirm the answers into it. The review agent (round 2) held that Q-RC2-1, 3 and 6 are access, safety and privacy behaviour that a general delegation does not settle (session rule 3, section 4). The person then answered them one by one on 2026-11-25: Q-RC2-1 and Q-RC2-3 "yes", and for Q-RC2-6 "make your best judgement, use best common practice".

# Decision In the contract
Q-RC2-1 Answered by the person (2026-11-25, "yes"): an encounter's flow state may be read at another facility under a care relationship. readFlowState follows the policy decision point across facilities, as readEncounter does; boards and queues stay hidden flow.v1 readFlowState x-his-cross-facility: policy
Q-RC2-2 older-adult is derived at arrival from the date of birth (60 or more, the usual priority for lansia) and cannot be removed by hand; pregnant, disability and child with a carer are set by the clerk as observed or declared, each change audited. No flag is stored on the person PriorityFlag
Q-RC2-3 Answered by the person (2026-11-25, "yes"): staff of the service point may call out of order with a reason only. The reason is shown and audited; passing over a waiting item of a higher triage category still needs supervisor authority. The call moves no position; moving an item is the supervised override of BR-ADM-018 actOnQueueItem
Q-RC2-4 Wall-display views are logged per device and board, not per patient, as FR-ADM-FLW-002 part 12 proposes: a display opens no record, and it shows initials and bed only Unchanged
Q-RC2-5 A complete directive with a future start stays proposed until its effective time: D10-ESS 4.3 makes Active need the effective time reached. UI-ESS-006 shows it as "Recorded · applies from [date]" Unchanged; consent.v1 description
Q-RC2-6 Decided by the session on common practice at the person's explicit request for this question (2026-11-25: "make your best judgement, use best common practice"). Until Domain 7 delivers to patients, a reminder goes by Domain 2 SMS, or WhatsApp where the patient's communication preference names it, as hospitals commonly send appointment reminders. The mobile number is read from D01-ADM at send time and not kept. A preference excluding a channel or reminders is honoured; otherwise the operational reminder is sent under the general consent. Content is facility, date and time only (minimum-content rule). No permitted channel is delivery-failed; delivered only from a provider receipt; every attempt audited notification.v1 description and RecipientSpec; ESS contract point 4 of RC-2-S03; a D10 rule for ess-coordination
Q-RC2-7 A change of a user's channel settings is audited as ess.iam.account, an attribute change of the account in D10-ESS 9.5 updateNotificationSettings

Consequences

  • RC-1-S09 continues against the stub of patient-identity.v1 1.1 (session rule 12); adm-identity serves it in the RC-1-S08 fix that the RC-1 gate files (#40).
  • The ADM, ESS and FIN contracts pass his-contract check against origin/main: every change is a compatible minor version or a new API or event.
  • The scenario of RC-2 (e2e/scenarios/RC-2) fails until the units land; its contract walk passes now. The harness's stubs cannot seed records of sub-resource operations for its own facilities, so the walk covers creations, reads and lists; scripts/verify-stub.sh covers every operation.
  • MOD-ADM-005 (RC-3) extends transitionEncounter, PatientDischarged and EncounterCorrected compatibly, and decides the arrival of a pre-admitted encounter.
  • The D05-FIN contract session of BC-1 starts from contracts/fin version 1.

Alternatives considered

  • QueueStateChanged on the encounter topic. Rejected: two producers on one sequenced topic (architecture 6.3).
  • Ordering queue events per queue item. Rejected: 8.5 asks for order per encounter, and an encounter has linked items at successive service points.
  • A scheduling API and a flow API on separate units. Rejected: the unit list of architecture 5.2 puts MOD-ADM-007 and 008 in one unit, and check-in spans both.
  • Payer verification left without a contract (a queued request with no endpoint until BC-1). Rejected: the build and the scenario would have nothing to test "Domain 5 available" against, and the request shape would be decided by the consumer.
  • A reason-code field in Problem. Rejected: only foundation sessions change contracts/common; it is a follow-up there.