Implementation plan / Session plan / Handover RC-5-S02
Handover RC-5-S02 Contract: Contracts and stubs: D3 CLI, and the failing scenario test¶
Card: RC-5-S02, issue #177. Decision record: ADR-HIS-126.
What was built and where¶
The first D03-CLI contracts, in contracts/cli/, for MOD-CLI-001 to 005 and MOD-CLI-012. All are version 1.0 and new.
| Contract | Unit | Requirements |
|---|---|---|
clinical-context.v1 |
cli-orders | FR-CLI-RSP-003 |
clinical-record.v1 (with IF-CLI-001) |
cli-clinical-record | FR-CLI-EHR-001 |
record-imports.v1 (IF-CLI-008) |
cli-clinical-record | FR-CLI-EHR-002 |
problems-allergies.v1 |
cli-clinical-record | FR-CLI-PRB-001, PRB-002 |
clinical-documentation.v1 |
cli-clinical-record | FR-CLI-DOC-002, DOC-003 |
clinical-content.v1 |
cli-clinical-record | FR-CLI-DOC-001; FR-CLI-OBS-002 instruments |
observations.v1 |
cli-clinical-record | FR-CLI-OBS-001, OBS-002 |
care.v1 (with IF-CLI-010) |
cli-clinical-record | FR-CLI-CAR-001 to CAR-003 |
downtime-entries.v1 |
cli-clinical-record | WF-CLI-008 for notes and observation sets |
Beside the contracts:
- Events EVT-CLI-001 to 011, on seven topics
his.cli.*.v1. - The shared types in
schemas/cli-types.v1.json. - The stubs, generated.
- TRACE.md: every field to its source.
- CONTRACT-POINTS.md: what RC-5-S06 to S16 must meet, with notes for OR-1, OR-6, PA-2 and BC-4.
scripts/cross-references.ts,scripts/verify-stub.shandscripts/ends-when-rc-5.sh.
Cross-domain references repaired in contracts/ess/. Both are example values only, so no version changes:
document-reference.v1:signatureStatusRefnamed a non-existentcli.NoteSignature; it now namescli.ClinicalDocument.configuration.v1: five examples named the contractcli.forms; they now namecli.clinical-content.
The ESS stubs were regenerated. Every other reference between the cli, ess, adm, ise and fin contracts resolves (below).
Section 7.3 additions to D03-CLI section 7.3, marked "Added by the RC-5 contracts":
- The allergy status per encounter (with DE-CLI-004).
- A section Records added by the RC-5 contracts: attribution review, escalation, clinical context, content version, imported item, downtime item, care-plan proposal and immunization.
No new entity identifier: each is kept with the entity it names.
The scenario test in e2e/scenarios/RC-5/: stack.json, builders.ts and rc-5.scenario.ts. Cases RC-5-E2E-001 to 006 cover the six scenario steps. RC-5-E2E-007 is a contract walk through the stubs of CLI, ESS and ADM.
Checks and their result¶
| Check | Command | Result |
|---|---|---|
| Lint and compatibility, each domain (cli, ess, adm, ise, fin) | pnpm build && pnpm test in each, or scripts/ends-when-rc-5.sh step 1 |
passed |
| Stub answers every provider case | scripts/verify-stub.sh |
cli 567 cases, ess 647, adm 566, ise 340, fin 10; no violation |
| Cross-references | node scripts/cross-references.ts (cli, adm, ise) |
passed (343 references); one later-slice event reported (MedicationReconciliationCompleted, OR-6, named by ADM adt.v1) |
| Full profile: schemas register, sample events round-trip the backbone, stubs on the session network with a realm token | HIS_SESSION=RC-5-S02 contracts/cli/scripts/ends-when-rc-5.sh step 3 |
passed: 11 CLI and 17 ESS sample events registered, published, read back and valid; both stubs on the session network with no violation |
| Scenario: 001 to 006 fail only with "not in this stack", 007 passes; RC-4 unchanged | step 4 | passed: RC-5-E2E-001 to 006 fail at adm-identity, the first unit each calls; RC-5-E2E-007 passes; RC-4-E2E-001 to 004 fail as before and RC-4-E2E-005 passes |
| Type check of the scenario | pnpm build in e2e/harness |
passed |
| Documentation | check_links.py, mkdocs build |
passed |
All four steps of ends-when-rc-5.sh passed on 2026-12-02 under HIS_SESSION=RC-5-S02, and the environment was reset afterwards. Evidence records of the scenario runs are in e2e/harness/out/evidence/RC-5/ and RC-4/ (ignored by git).
The first run found two faults in the scenario, both fixed. The cross-reference check read the scenario's client variable cli.get(...) as a cli. name, so the variable is now chart. The walk's reportUnmappedCode lacked its Idempotency-Key. The run also showed that a consent directive restricts a sensitive category (mental-health), not a label code (PSY): consent.v1's scope.labels are the seven DEC-ESS-009 categories, which the label taxonomy maps labels to (TaxonomyLabel.category), so the builder records the category.
Requirements and test scenarios¶
| Requirement | Test scenario | Covered by |
|---|---|---|
| FR-CLI-RSP-003 | TEST-CLI-044 | RC-5-E2E-001 (context, switch, refused write); RC-5-E2E-007 |
| FR-CLI-EHR-001 | TEST-CLI-001, 002 | RC-5-E2E-001 (record and timeline with labels and consent) |
| FR-CLI-EHR-002 | TEST-CLI-003 | RC-5-E2E-006 |
| FR-CLI-PRB-001, PRB-002 | TEST-CLI-004, 005 | RC-5-E2E-002 |
| FR-CLI-OBS-001, OBS-002 | TEST-CLI-010, 011 | RC-5-E2E-003 |
| FR-CLI-DOC-001, DOC-002, DOC-003 | TEST-CLI-006 to 009 | RC-5-E2E-004. TEST-CLI-047 (structured documentation report) is left to RC-5-S09's tests: it is not a scenario step |
| FR-CLI-CAR-001, CAR-002, CAR-003 | TEST-CLI-012, 013, 014 | RC-5-E2E-005. TEST-CLI-051 and 053 are left to RC-5-S10's tests |
| FR-ESS-AUZ-003, FR-ESS-CNS-002 | TEST-ESS-010, 013 | RC-5-E2E-001; the decide and directive calls in RC-5-E2E-007 |
| FR-ESS-TRM-003 | TEST-ESS-017, 018 | RC-5-E2E-002, 006; translateCode and reportUnmappedCode in 007 |
| FR-ESS-DOC-001 | TEST-ESS-032 | RC-5-E2E-006; upload, registration, resolution and retrieval in 007 |
| WF-CLI-001, WF-CLI-007 | RC-5-E2E-004, 005 | |
| WF-ESS-003, WF-ESS-004 | Up to the stewardship item (002, 006). The steward's resolution is RC-5-S04's and UI-ESS-003's |
Contract changes (session rule 4)¶
contracts/cli: new.contracts/ess: two example values corrected (above); compatible, and the ESS check passes againstorigin/main.
Differences from the card or specification¶
- Downtime entry is not a step of the slice scenario. Its contract covers notes and observation sets now. Orders (OR-1) and administrations (OR-6) join by minor versions.
- Copy-forward of medication (FR-CLI-DOC-003) flags a copied medication value stale until OR-6 gives the reconciled list. Pending orders in the handover (FR-CLI-CAR-003) wait for OR-1. The scenario asserts neither.
- Reference type
Serviceis used for services and teams, because the commonReferenceTypehas noHealthcareServiceorCareTeam. Adding them is FN-S04's (follow-up 3). - Stub sample of AllergyChanged. Its
aggregateidis the allergy identifier, because the stub tool takes the first…Idfield. The contract says the aggregate id is the patient, and the units must follow the contract. Consumers must not take the partition key from the stub's sample (follow-up 7).
Review round 1¶
The review found that the contract points kept unconfirmed imported allergies out of decision support, which contradicts FR-CLI-EHR-002 part 6.6 and FR-CLI-CDS-002 part 4. Fixed from the specification:
clinical-record.v1listClinicalFacts(IF-CLI-001, which the CDS service reads) now answers an imported allergy not yet accepted as a fact withconfidence: low,verificationStatus: unconfirmedand itsimportedItemId. An uncoded allergy is answered withconfidence: lowtoo. Both fields are new and optional, in the 1.0 contract this pull request adds.- CONTRACT-POINTS (RC-5-S07 point 6, RC-5-S08 point 2), the clinical safety list below and the scenario step title say the same.
- The stub tool's AllergyChanged sample key is recorded as follow-up 7 (FN-S04), with a warning in CONTRACT-POINTS.
After the fix, the CLI contract check, the stub verification (567 cases, no violation), the cross-references, the scenario type check and the link check pass. The full-profile run was not repeated: the fix changes no event, no call the scenario makes, and no ESS or ADM contract.
Needs a person¶
- Review of the contracts and the section 7.3 additions:
- the D3 CLI domain lead;
- the D10 ESS domain lead, for the two repaired ESS examples and the D10 names CLI registers.
- Clinical safety review of the behaviours the contracts fix, as the specification sets them, which the build will apply as written:
- an incomplete score shows no band;
- an uncoded allergy, and an imported allergy not yet accepted, reach decision support as low-confidence inputs:
listClinicalFactsanswers them withconfidence: low, and a rule that needs them answers "Cannot be checked reliably" or "Unconfirmed allergy", never a silent pass (FR-CLI-EHR-002 part 6.6, FR-CLI-CDS-002 part 4). An imported allergy stays out of the verified allergy list and the allergy status until accepted (part 6.2); - a refuted allergy is excluded from decision support;
- "no known allergies" is refused while an allergy is active;
- only the named receiver acknowledges a handover.
- Enterprise Architecture Board approval of ADR-HIS-126.
- No question is left open.
Follow-ups outside the card¶
- Topic register (
platform/event-backbone/mod-ise-004/src/main/resources/backbone/topic-register.yaml). It must gain the seven CLI topics, producercli-clinical-record:his.cli.clinicalentry.v1,his.cli.allergyrecord.v1,his.cli.observationset.v1,his.cli.escalation.v1,his.cli.referral.v1,his.cli.caretask.v1,his.cli.handover.v1. ItsRegisterTestrequires every contract topic. Owner: the session onplatform/event-backbone. - Realm users (
platform/dev-environment, FN-S02 owner, or RC-5-S16 through"provision"): a second nursedev.nurse2, and provisioned sign-on userse2e.clinician.aande2e.nurse.afor the step-up assertion of a signature. - Common reference types (
contracts/common, FN-S04 owner):HealthcareServiceandCareTeam. - Event catalogue. No event is catalogued for the outcome of an attribution review or of an imported item's review, and CLI publishes none. EVT-CLI-030 ClinicalControlTotalsReported (MOD-CLI-001, to D08) is not in these contracts: it follows the D08 control-total contract and belongs with the slice that contracts D08's control totals. The catalogue owner decides whether the review outcomes need events.
- Declined transfer handover. D01-ADM has no channel for a declined transfer handover (question Q2 of RC-3-S02). CLI publishes only the acknowledgement.
- Isolation orders. The
sourceOrderIdof an ADM isolation is a CLI order, which exists from OR-1. - Stub tool: the sample aggregate id (
contracts/common/src/events.tssampleEvent, FN-S04 owner). The tool takes the sample event'saggregateidfrom the first…Idfield of the payload. For an event whose aggregate key is not such a field, the sample gets the wrong partition key. AllergyChanged is one: its aggregate is the patient (patient), but the sample carriesallergyId. The tool should take the aggregate key from the contract, for example anaggregateKeyfield per event incontract.yaml, so consumers do not test against the wrong partition key. Until then CONTRACT-POINTS and the event description say the key is the patient.