Architecture / Decision records / ADR-HIS-126
ADR-HIS-126 The D03-CLI contracts of slice RC-5: the patient context checked by the service, one entry topic, governed content in one API, coded values that carry their stewardship state, and documents held in D10 only¶
| Status | Accepted |
| Decided | 2026-12-02 by session RC-5-S02 |
| Record | Drafted 2026-12-02; awaiting approval by the Enterprise Architecture Board |
| Where the rule lives | contracts/cli/ (the nine APIs of api/, the events of contract.yaml, schemas/cli-types.v1.json, CONTRACT-POINTS.md, scripts/cross-references.ts); D03-CLI section 7.3 |
Context¶
The contract session RC-5-S02 writes the first D03-CLI contracts, for slice RC-5 and modules MOD-CLI-001 to 005 and MOD-CLI-012. Section 8 of D03-CLI names few interfaces for them (IF-CLI-001, 008 and 010); most of what the modules offer is the API their own screens and the shell call. Five questions were left to the contract:
- How the service enforces the persistent patient context of FR-CLI-RSP-003 (PR-RSP-003-01: an action started for one patient is never submitted in another's context).
- How the eleven catalogued events EVT-CLI-001 to 011 map to topics and aggregates.
- Where governed clinical content lives: document templates and flowsheet layouts (FR-CLI-DOC-001) and assessment instruments (FR-CLI-OBS-002) share one lifecycle (draft, review, approval by someone other than the author, activation, rollback).
- How a coded value shows what governed terminology made of it (BR-CLI-004, FR-ESS-TRM-003).
- Where attachment and imported document content is held.
The card also asks that every reference between the domains' contracts resolve. Two references of the ESS contracts named CLI resources that did not exist.
Options considered¶
- Patient context:
- (a) the client keeps the context and the service trusts the body's patient;
- (b) a context resource in cli-orders (MOD-CLI-012), named on every clinical write by a header, and checked by the writing unit before it acts.
- Event topics:
- (a) a topic per event;
- (b) a topic per aggregate, with entry events on one topic for clinical entries of every kind.
- Governed content:
- (a) templates in the documentation API and instruments in the observations API, each with its own lifecycle;
- (b) one content API for every kind, with the kind as a field.
- Coded values:
- (a) FHIR CodeableConcept as it is, with stewardship in a separate list;
- (b) a CLI coded value that carries
codeStatus,uncoded,stewardshipItemIdand the concept mapmapping. - Document content:
- (a) content in CLI records;
- (b) registered in the D10 document service (ADR-HIS-125), with CLI holding
documentIdandversionIdonly.
Decision¶
- The service checks the patient context (1b).
clinical-context.v1(served bycli-orders, the unit of MOD-CLI-012) holds a context per user and window. Selecting another patient is an explicit command that replaces the current context and lists the unsigned work it leaves.- Every clinical write of the CLI APIs carries the header
X-Clinical-Context. The writing unit callscheckClinicalContextand refuses a missing, closed, foreign or mismatching context with 400 at/X-Clinical-Context. The mismatch is audited (cli.context.mismatch). A service identity delivering imports sends none. - A header rather than a body field, so that every write of every API carries it the same way, and the shell can add it without each screen doing so.
- Option 1a leaves PR-RSP-003-01 to every screen, which is the failure the requirement exists to prevent.
- One topic per aggregate (2b).
- ClinicalEntryCreated, Signed and Amended are on
his.cli.clinicalentry.v1, keyed by the entry: a consumer reads an entry's creation, signature and amendment in order.entryTypenames the kind. - AllergyChanged is on
his.cli.allergyrecord.v1, keyed by the patient and enterprise-scoped, because the allergy status is per patient across facilities. Every other event is facility-owned. - Tasks (TaskAssigned, Completed, Overdue) share
his.cli.caretask.v1. Observation sets, escalations, referrals and handovers have their own topics. - Event fields follow D01-ADM:
patient,encounterId,cin,facility. The APIs name the encounterencounter, as the ESS APIs do. - One content API (3b).
clinical-content.v1holds document templates, flowsheet layouts and assessment instruments as versions with akind. The validation, submission, approval, return, promotion, rollback and retirement are the same for each. A document and an assessment keep the content version they were made with (BR-CLI-007). The content API is served bycli-clinical-record, beside both modules that use it. - Coded values carry their state (4b).
ClinicalCodeofschemas/cli-types.v1.json: codeStatusisactive,inactive-flagged,unmappedorambiguous; a Safety-relevant binding refuses what a Standard binding flags (BR-CLI-004).uncodedmarks free text in a coded field, andstewardshipItemIdnames the D10 item it was reported as.mappingnames the concept map version a translated code came from.- Option 4a would leave the screen and decision support to join two sources to learn whether an allergy is unverified.
- Services and teams are referenced with the common reference type
Service. The common types are FN-S04's, and addingHealthcareServiceandCareTeamthere is a follow-up. - Documents are held in D10 (5b). Attachments and imported documents are uploaded to the address
createDocumentUploadanswers, and registered withregisterDocumentunder acli.document type. CLI's records and events holdDocumentRefonly, and a reader resolves it through D10, which decides and audits the read. - Names other domains use are registered and checked. The policy resource types, document types, audit event types and notification types CLI uses are listed in
contracts/cli/README.md.scripts/cross-references.tsfails when a contract of any domain uses acli.name that is neither listed nor a CLI API. It reports, without failing, the references to events of slices not yet contracted (today MedicationReconciliationCompleted, OR-6). - Two ESS references are repaired, without a version change. In
document-reference.v1the examplesignatureStatusRefnamed acli.NoteSignatureresource that does not exist; it now namescli.ClinicalDocument. Inconfiguration.v1the examples named the contractcli.forms; they now namecli.clinical-content. Both are example values, so the compatibility check passes and no consumer changes.
Consequences¶
- RC-5-S06 builds the context service in
cli-orders; RC-5-S07 to S10 build the other eight APIs incli-clinical-record, each ascontracts/cli/CONTRACT-POINTS.mdlists. - The shell sends
X-Clinical-Contextfrom its patient context, so every CLI screen gets the check without code of its own. - The event backbone's topic register (
platform/event-backbone) must gain the sevenhis.cli.topics ofcontract.yaml(producercli-clinical-record). ItsRegisterTestfails until it does, as it did for earlier contract topics. - Orders (OR-1) and medication (OR-6) add their APIs and events beside these, and extend the downtime item kinds and the handover's pending work by minor versions.
- A change of the common reference types (
HealthcareService,CareTeam) is FN-S04's to make. Until it is made, CLI usesService.