Skip to content

Architecture / Decision records / ADR-HIS-075

ADR-HIS-075 The encounter lifecycle and the payer and consent references of the patient administration unit: supervisor privileges as policy actions, history in the encounter's transaction, references behind module ports, and consent as a completion gate

Status Accepted
Decided 2026-11-26 by session RC-2-S04
Record Drafted 2026-11-26; approved 2026-11-26 by the Enterprise Architecture Board; amended 2026-11-26 (a declined required consent blocks completion, review round 4), amendment approved 2026-11-30 by the Enterprise Architecture Board
Where the rule lives services/adm-patient-administration/ (its README.md; mod-adm-004/ EncounterLifecycle, api/, migration V2__state_history.sql; mod-adm-010/; mod-adm-002/ api/RegistrationConsents, api/RegistrationDirectory)

Context

RC-2-S04 adds to the unit of ADR-HIS-057: - FR-ADM-ENC-002, the governed encounter state machine with correction and cancellation (MOD-ADM-004); - FR-ADM-REF-001 and FR-ADM-REF-002, the payer and consent references captured at registration (MOD-ADM-010, a new module of the unit).

It serves encounters.v1 and registration.v1 1.1 (ADR-HIS-067). The specification and the contract leave these points open: - how the supervisor privileges of FR-ADM-ENC-002 part 13 and CFG-ADM-011 are enforced; - how state, history and event stay consistent, and how concurrent transitions are decided (part 6.3, PR-ENC-002-4); - where downstream activity is known from (part 6.4), when no Domain 3 to 6 event has a contract yet; - how MOD-ADM-010 reaches the encounter and the registration without crossing module boundaries, and how the encounter shows its payer context; - how the payer request reaches Domain 5 when Domain 5 is down (PR-REF-001-1); - how "completion needs the general consent" (part 10, DEC-ADM-013) works, when the consent references are recorded on a registration that must exist first.

Decision

  1. Supervisor privileges are policy actions of their own on adm.Encounter, asked of the decision point after the standard transition:
  2. correct: correction and reversal;
  3. cancel-with-activity: cancelling an encounter with downstream activity;
  4. backdate: an effective time older than the CFG-ADM-011 tolerance (24 hours).

The decision point grants them to the registration supervisor, and SEC-004 recertification sees them as distinct grants. A deny is answered with the message of part 10 and audited. Beyond the tolerance a clerk gets backdating-beyond-tolerance: CFG-ADM-011 sets the limit "without supervisor authority", so a supervisor may go further. 2. One transaction under the encounter's row lock holds the state, the DE-ADM-009 history entry, the audit and the event (PatientDischarged, EncounterCancelled, EncounterCorrected), with the update conditional on the version of If-Match. Of two concurrent transitions on one version, one waits on the lock, finds the version moved and is answered 412 (AC-04). - The history is append-only, enforced by a trigger, and numbered from 1 with the creation as entry 1. - A correction is an entry of its own that names the entry it corrects and holds the values before and after. The audit records the changed fields and the history sequence, since the kit's record-change events keep no values. - Every refused transition is audited in its own transaction, with its TransitionRejection code as the problem's detail and the user message on the field. 3. Downstream activity is a store behind a port. mod004.api.DownstreamActivity records what an owning domain reported for an encounter. The rule of part 6.4 reads that store. The subscriptions to the D01-ADM 8.5 events (OrderPlaced, ClinicalEntryCreated, InvoiceIssued and the others) write to it once their contracts exist; until then no encounter has activity. 4. MOD-ADM-010 reaches the other modules through their api packages only: - mod004.api.EncounterDirectory: the encounter, and its payer context written in the caller's transaction; - mod002.api.RegistrationDirectory: the registration, its field set and its related persons.

The payer context is the DE-ADM-008 attribute on the encounter row, a summary of the current DE-ADM-021 capture. It does not move the encounter's version, so an asynchronous coverage update never makes a clerk's transition stale. It is left out for callers whose permit carries a redact obligation naming it (FR-ADM-REF-001 part 13). The fields the contract requires are never redacted. 5. The eligibility request waits in the capture's own row (delivery = queued), written in the capture's transaction. It is sent at once after commit and, while Domain 5 is unavailable, retried by a relay with backoff under the capture's identifier as Idempotency-Key. Domain 5's answer and later CoverageVerified events set the status in the registration words of part 11 and the layers in Domain 5's order, inactive ones left out. 6. The consent requirement is a completion gate that MOD-ADM-002 asks through its own api interface RegistrationConsents, which MOD-ADM-010 implements: - The required consents of the field set are outstanding fields, consentReferences.<type>. - completion: complete with one outstanding is refused on /consentReferences ("Required consent has not been recorded."). - completion: incomplete saves the registration with it outstanding. - A required consent counts only when it is given: a captured reference whose directive Domain 10 still holds active. - A selected person's valid directive in Domain 10 is linked in the registration's transaction (PR-REF-002-1). - A declined required consent does not count (amended 2026-11-26). The decline is recorded and linked, and the planned registration stays incomplete, refused with "The patient declined a consent this registration requires." The sources: - DEC-ADM-013 sets the general consent apart from "a refused optional consent never blocks registration"; - registration.v1 recordConsentReference says a decline "does not block registration unless the type is required for completion".

 The looser wording of the API description ("neither a captured nor a declined reference") is read with these. A declined optional consent never blocks, and an emergency type defers every consent.
  • A capture pending because the consent service is unavailable satisfies the gate while pending-permits-completion holds (PR-REF-002-2, BCP-007), never over a consent known to have lapsed or been declined.

So a new planned patient is registered incomplete, the consent is captured on that registration, and the registration is completed. Without MOD-ADM-010 (a module test of MOD-ADM-002) no consent is required. 7. The consent policy and the payer fields are stand-ins of the D10 configuration (ConsentPolicy, PayerFields), as FieldSets is for CFG-ADM-004, each with one class to replace.

Consequences

  • An outpatient or emergency visit ends, and a mistaken end of visit is reversed, through the governed states, with a history that answers who, when and why. Admission, leave, return, inpatient discharge and closure add their transitions to the same model and history (MOD-ADM-005, slice RC-3).
  • Until the owning domains publish their events, an encounter with downstream activity cannot be told apart, so any clerk may cancel a Registered encounter. The handover names the subscriptions to add.
  • Registration never waits for Domain 5, and a payer capture made during an outage is delivered without anyone retrying it.
  • The registerPatient example of registration.v1 (a new person, completion: complete) is refused under the DEC-ADM-013 policy. The provider contract test runs under a policy that requires no consent before completion, which the contract allows ("where the consent policy requires it"). The scenarios of RC-1 and RC-2, and the screens, register a new planned patient as incomplete first. The handover lists these as follow-ups, with the example for the next ADM contract session.
  • The decision point must know the three supervisor actions before ADM goes live (RC-1-S16), like view-history of ADR-HIS-057.

Alternatives considered

  • Role checks in the unit for the supervisor privileges. Rejected: authorization belongs to the decision point (architecture 8.1), and a role name in code escapes recertification and facility scoping.
  • Optimistic locking alone, without the row lock. Rejected: the second transition would build its history entry on a stale history before failing. The lock makes the version check and the next sequence one decision.
  • The payer context computed on every encounter read from MOD-ADM-010. Rejected: MOD-ADM-004 would depend on MOD-ADM-010, which depends on it, and every read would cost a second query. DE-ADM-008 holds payer_context as an attribute anyway.
  • A separate outbox table, or the kit's event outbox, for the eligibility request. Rejected: the request is an HTTP call that answers data the capture needs (the coverage and its status). Keeping it in the capture's row keeps the capture and its delivery state in one place.
  • Downgrading completion: complete to incomplete silently when the consent is missing. Rejected: registration.v1 says completion is refused on /consentReferences, and a clerk who asked to complete must be told it did not happen.
  • Letting a declined general consent complete the registration, as the API description's "captured or declined" alone would allow. Rejected (amendment of 2026-11-26): DEC-ADM-013 and recordConsentReference read a declined required consent as blocking, and completing without the consent the policy requires would undo the rule.
  • Letting registerPatient complete and enforcing the consent at completeRegistration only. Rejected: DEC-ADM-013 makes the general consent a condition of a complete planned registration, whichever operation completes it.