Skip to content

Implementation plan / Session plan / Handover RC-1-S03

Handover RC-1-S03 Contract: Contracts and stubs: D1 ADM, and the failing scenario test

Card: RC-1-S03. Issue: cema-care/his#17. Branch: session/RC-1-S03. Slice: RC-1. Decision record: ADR-HIS-049.

What was built and where

The D01-ADM contracts of the slice, in contracts/adm/, in the layout of contracts/common/example/. Its README.md says what is offered, how it is built, the identifier systems, the names ADM registers in D10, and the contract points of each later session.

  • Three APIs (OpenAPI 3.1, version 1.0, 22 operations), one per serving unit:
API Interface Unit Operations
patient-identity.v1 IF-ADM-001, person index part services/adm-identity (MOD-ADM-001, 003) 12: search, resolve by identifier, duplicate check, create and read person, add and correct identifiers, assign the facility's No. RM, list and read identity matches, start and read a matching benchmark
registration.v1 IF-ADM-001, registration part services/adm-patient-administration (MOD-ADM-002) 7: register, list, read and complete registrations; read demographics now or as at a time, change them with provenance, list their versions
encounters.v1 IF-ADM-003 services/adm-patient-administration (MOD-ADM-004) 3: create (with CIN), list by patient or CIN, read
  • Shared types schemas/adm-types.v1.json: PersonId, HumanName, Address (Indonesian administrative levels), ContactPoint, Demographics (the Indonesia profile field set), PatientIdentifier, Cin, match bands and flags, the duplicate prompt and its answer, verification, related person, referral and provenance.
  • Five events, version 1.0, each in the event catalogue with ADM as producer:
Event Topic Scope
PatientResolved (EVT-ADM-001) his.adm.person.v1 enterprise
IdentityUpdated (EVT-ADM-002) his.adm.person.v1 enterprise
DuplicateReviewRequested (EVT-ADM-003) his.adm.identitymatch.v1 enterprise
PatientRegistered (EVT-ADM-007) his.adm.patientregistration.v1 facility
EncounterOpened (EVT-ADM-008) his.adm.encounter.v1 facility

The encounter topic and type are the ones the ISE examples already used. - Generated stubs in stubs/. package.json and pnpm-lock.yaml link @his/contract-tools only; no dependency was added. - TRACE.md: every field to its section 7.3 attribute, requirement or business rule. - Scripts: - scripts/verify-stub.sh: the provider contract test against the stub; - scripts/cross-references.ts: the slice's cross-domain reference check; - scripts/ends-when.sh: this card's "Ends when", repeatable by any later session.

Section 7.3 of D01-ADM data, for approval by the domain leads, each attribute with its source and a classification line: - new entity sections DE-ADM-004 IdentityMatch, DE-ADM-007 RelatedPerson and DE-ADM-023 IdentityVerification; their 7.2 rows now link to them; - the registration record: completeness, field set, referral and review items, beside DE-ADM-006, which FR-ADM-REG-001 part 9 names as the registration record. It is not a new entity identifier; - additions to DE-ADM-001 (ambiguity reasons, duplicate check pending), DE-ADM-002 (system, facility, correction), DE-ADM-006 (version, validity, change reason, correction, and the fields of each attribute group) and DE-ADM-008 (encounter_id, source, separate visit reason, creation provenance).

No existing attribute was changed.

Cross-domain references. Step one of the card: check every reference between the slice's contracts and repair those that do not resolve. - Every $ref of contracts/adm, ess and ise resolves. - Every ADM name used by ESS or ISE is defined by ADM: topics, event types, units, policy resource types, task types, queue, escalation policy, feature flag, audit event types, patient identifiers and facility identifier systems. cross-references.ts checks this; 302 references in all. - Repaired in contracts/ess, examples only. No schema, version or operation changed, and the stubs were regenerated: - the enterprise person identifier P-000000017 became the UUID that the same examples already used as the adm.Patient id; - the audit event type adm.reg.patient, which is not in D01-ADM 9.5, became adm.person.change; - sourceEndpoint /v1/patients became /v1/registrations; - the illustrative feature flag became adm.coverage-verification-request (UI-ADM-001). - Nothing in contracts/ise needed repair.

The scenario test of the slice, in e2e/scenarios/RC-1/: stack.json, builders.ts (synthetic ADM entities), rc-1.scenario.ts and README.md. - RC-1-E2E-001 to 004 walk the scenario through the units: - 001: steps 1 to 5 and 7; - 002: step 6, the duplicate review task; - 003: two facilities; - 004: the failure branches. - RC-1-E2E-005 walks the same calls through the ADM, ESS and ISE stubs and asserts no contract violation.

ADR-HIS-049 and its row in the decision record index (49 records).

Checks and their result

Node.js is not installed on this server. The Node.js checks ran in the node:22.18-bookworm image with pnpm 10.34.9 through corepack, after pnpm install --frozen-lockfile in contracts/common and in the contract folder. The integration environment ran as HIS_SESSION=RC-1-S03 (his-rc-1-s03) and was reset afterwards.

Check Command Result
Conventions pnpm build in contracts/adm passed
Compatibility with origin/main, stubs up to date pnpm test in contracts/adm, contracts/ess, contracts/ise passed (adm: new; ess: compatible, examples only)
Stub against the provider contract test scripts/verify-stub.sh in contracts/adm; and in contracts/ess after the repair adm 72 of 72 cases, ess 454 of 454; no violation
Cross-domain references node scripts/cross-references.ts passed, 302 references. A planted wrong topic, event type, resource type, unit, patient identifier, identifier system and subscription each failed it
Scenario folder type check pnpm build in e2e/harness passed
Ends when HIS_SESSION=RC-1-S03 contracts/adm/scripts/ends-when.sh passed, see below
Dependency scan, static analysis, secret scan platform/delivery-pipeline/bin/dependency-scan on contracts/adm and contracts/ess; static-analysis on contracts/adm, contracts/ess and e2e/scenarios/RC-1; secret-scan code and secret-scan docs from origin/main 0 components and 0 blocking; no blocking finding; no secret. The first secret scan flagged a literal UUID sent as Idempotency-Key in the scenario (a false positive); it is now a named constant, and the commit was amended before any push
Documentation links python3 docs/implementation_plan/tools/check_links.py 0 broken, 0 duplicate anchors
Documentation site mkdocs build builds

The steps of ends-when.sh:

  1. The ADM contract passes the check, and the stub answers all 72 provider cases with no violation. The ESS and ISE contracts still pass theirs.
  2. The cross-references pass.
  3. On the full profile:
  4. the five schemas register in Apicurio, unchanged on the second run;
  5. the four topics are created;
  6. five sample events are published, read back from Kafka and validated;
  7. the stub on the session network passes all 72 cases with a token of the realm his (user dev.registrar).
  8. The scenario runs. RC-1-E2E-005 passes. RC-1-E2E-001 to 004 each fail with unit "adm-identity" is not in this stack, the only failure the step accepts.

How the "Ends when" lines are met: - Contracts pass the compatibility check: step 1. - Every contract field traces to a requirement, a business rule or a section 7.3 attribute: contracts/adm/TRACE.md, with the 7.3 additions above. - Stubs run in the integration environment: step 3. - The scenario test runs and fails only because the behaviour is not built: step 4.

Requirements and test scenarios

A contract session covers requirements by contract. Each ADM requirement of the card, with what serves it and what proves it:

Requirement Contract Checked by Scenario
FR-ADM-MPI-001 searchPersons, resolveIdentifier, readPerson, PatientResolved verify cases of the three operations; sample event RC-1-E2E-001, 003, 004 (TEST-ADM-001)
FR-ADM-MPI-002 runDuplicateCheck, readIdentityMatch (evidence), startMatchingBenchmark, readMatchingBenchmark verify cases RC-1-E2E-002 (TEST-ADM-002)
FR-ADM-MPI-003 createPerson routing, IdentityMatch.route, DuplicateReviewRequested, the D10 task of the ESS workflow API verify cases; sample event; ESS createTask in RC-1-E2E-005 RC-1-E2E-002 (TEST-ADM-003)
FR-ADM-XRF-001 assignFacilityIdentifier, addPersonIdentifier, correctPersonIdentifier, IdentityUpdated verify cases, including the facility cases RC-1-E2E-001, 003 (TEST-ADM-010)
FR-ADM-REG-001 registerPatient, listRegistrations, readRegistration, completeRegistration, PatientRegistered verify cases, including the hidden case across facilities RC-1-E2E-001 (TEST-ADM-006)
FR-ADM-REG-002 readDemographics (as at), updateDemographics (If-Match, provenance, not applied), listDemographicVersions verify cases RC-1-E2E-001 (TEST-ADM-007, provenance part)
FR-ADM-REG-003 the duplicate check and its answer, the verification, the ambiguity flag of readPerson verify cases RC-1-E2E-001, 002 (TEST-ADM-008)
FR-ADM-ENC-001 createEncounter, listEncounters, readEncounter, EncounterOpened verify cases RC-1-E2E-001 (TEST-ADM-012)

The test scenarios of section 15.2 belong to the build sessions: RC-1-S08 (TEST-ADM-001, 002, 003, 010, 031, 036) and RC-1-S09 (TEST-ADM-006, 007, 008, 012, 035). contracts/adm/README.md names, for each session, what in the contract it must meet. The slice scenario also covers the ESS and ISE requirements of its steps: - FR-ESS-IAM-002, AUZ-001, AUD-001 and WFL-002; - FR-ISE-GWY-001, EVT-001, EVT-002 and OBS-001.

Review round 1

The review asked for four changes, all made on this branch:

  • Q3 is no longer settled by the scenario. RC-1-E2E-002 had asserted that an "unsure" answer leaves both persons active. It now asserts only what BR-ADM-001 requires: a review item exists, the match is pending review, and neither record is merged. Whether the new person is active or provisional stays Q3. WF-ADM-001 registers a high-risk case against a provisional record.
  • The questions are on the issue (comment on #17): Q1 to Q3, and Q4, the contradiction over FR-ADM-REG-001 AC-03 (below).
  • The repaired ESS audit example named GET /v1/registrations/{patientId}, which is no ADM operation. It is now GET /v1/persons/{personId} of adm-identity (readPerson, a view of adm.Patient), with actorService and sourceSystem set to adm-identity. cross-references.ts now also checks that every sourceEndpoint of an example naming an ADM unit is an operation that unit serves. It found that one example, and passes since the repair.
  • The steward reads the match as a user. RC-1-E2E-002 reads the identity match with a token of dev.steward instead of a service token, so the user-level authorization of FR-ADM-MPI-002 part 13 is exercised. The development realm has no such user yet (follow-ups).

Differences from the card or specification

  • Payer and consent references at registration (FR-ADM-REG-001 part 6.3, AC-03 "payer reference and consent reference") are not in version 1. The specification contradicts itself on this point (Q4). Part 6.3 captures them "through MOD-ADM-010", whose requirements FR-ADM-REF-001 and 002 come in RC-2. RC-2's ADM contract session adds them as a compatible minor version. Until then, RC-1-S09 tests AC-03 for the other captured data only. The registration form of UI-ADM-001 shows coverage as "Not verified", as its brief says for stages 1 to 4.
  • The steward's decisions on UI-ADM-002 (merge, different persons, defer; unmerge) are FR-ADM-MPI-004 and 005, in RC-3. Version 1 offers the work list (D10 tasks) and the comparison (readIdentityMatch, readPerson). The screen session shows the resolution bar disabled, with its reason, until RC-3.
  • The encounter's key. IF-ADM-004 names the CIN as the events' aggregate identifier. The contract uses encounterId, a UUID one-to-one with the CIN (DE-ADM-008 encounter_id, added), as the aggregate id and the reference id. The CIN is in every encounter payload. The reason is in ADR-HIS-049: the key of DE-ADM-008 is the CIN with its authority, a pair, and the CIN's format is a per-facility setting.
  • The CIN's facility code. CFG-ADM-008 gives the CIN a 2-character facility code, and the D10 facility codes are longer (RSU-01), as RC-1-S01 noted. The contract fixes only "up to 14 letters and digits". It reads the 2 characters as a per-facility setting of CFG-ADM-008, which the configuration level "Enterprise / Facility" allows. Question 1 below asks the owner to confirm it.
  • Refusals of business rules answer 400 validation-failed with the field or person in errors: a missing mandatory field, a high-risk ambiguity, a duplicate identifier, a blocked second encounter. This follows RC-1-S02's choice until contracts/common has a code for a refused precondition (RC-1-S02's follow-up).
  • The registration record is written into 7.3 beside DE-ADM-006, not as a new entity identifier in 7.2. Its attributes trace to FR-ADM-REG-001 parts 6.5, 7, 9 and 11.
  • The ESS contract was changed in its examples only, as the card's cross-reference repair asks. Version and compatibility are unchanged.
  • IdentityUpdated has one producer, adm-identity, though MOD-ADM-002 produces it in section 8.5. adm-patient-administration hands its demographic changes to adm-identity through INT-ADM-001, so the topic has one owner and the sequence per person has no gaps (architecture 6.3). This is the unit split of IF-ADM-001, not a change of what is published.

Questions for a person

All four are posted on issue #17. None blocks this session. Each is under "Needs a person" in the pull request.

# Question Owner What the contract does now
Q1 CFG-ADM-008: the CIN's "facility code (2)" cannot be the D10 facility code (RSU-01). Is it a 2-character code set per facility in CFG-ADM-008? Registration governance (owner of CFG-ADM-008) The contract allows any 14 letters and digits; the 2-character code is read as a per-facility setting
Q2 FR-ADM-REG-003 part 6.3: when the clerk answers "same person" and policy cannot link (no link in release 1, DEC-ADM-002), does registration continue against the selected existing person, with a review item only for the pair? Registration governance, HIM It continues against the selected person (personId), and the unit records the pair's response on the match. Nothing is linked or merged
Q3 FR-ADM-REG-003 part 6.3: when the answer is "unsure", is the new person created as active with the review item, or as provisional? WF-ADM-001 registers a high-risk case against a provisional record Registration governance, HIM The contract leaves identityStatus to the unit, and the scenario asserts only "not merged". RC-1-S09 builds this point once it is answered
Q4 FR-ADM-REG-001 AC-03 asks for payer and consent references in the registration, while the scope of MOD-ADM-002 (FA-ADM-004) excludes them and part 6.3 captures them through MOD-ADM-010 (RC-2). Is that part of AC-03 tested in RC-1 or in RC-2? Owner of D01-ADM, registration governance No reference fields in version 1. RC-2 adds them compatibly, and RC-1-S09 tests AC-03 for the other data

Follow-ups outside the card

  • RC-1-S26 (integrate):
  • add the units to e2e/scenarios/RC-1/stack.json as they land;
  • make the D02 event operations API reachable as event-backbone, which the harness has no way to start, or change step 5;
  • add an e2e-probe subscription on his.adm.encounter.v1;
  • set "policy" to none when the decision service exists.
  • Harness (FN-S07's folder e2e/harness):
  • a way to name a platform API endpoint in stack.json;
  • --out outside the repository is not mounted into the runner, so scenario run --out /tmp/… fails in global setup. Use a folder under the repository;
  • the harness does not export Playwright's APIRequestContext type, so the scenario declares the part it uses.
  • Development realm (FN-S02 or RC-1-S16):
  • no MFA claims (amr, acr), as RC-1-S01 noted. Step 1 of RC-1-E2E-001 asserts them;
  • no identity steward user. RC-1-E2E-002 reads the match as dev.steward, a synthetic user with the identity steward role, which the realm needs.
  • D10 registrations before ADM goes live:
  • RC-1-S06 and RC-1-S07: assigning authorities for the systems of contracts/adm/README.md ("Identifier systems");
  • RC-1-S16: the policy resource types adm.Patient, adm.Registration, adm.Encounter, adm.IdentityMatch and adm.MatchingBenchmark;
  • RC-1-S15: the task types and the queue;
  • RC-1-S04: the 17 audit event types of D01-ADM 9.5;
  • the value sets urn:his:ess:identifier-type, administrative-sex, kemendagri-area and relationship, and the ADM code lists urn:his:adm:encounter-type, verification-method, identity-document, demographic-change-reason and identifier-correction-reason.
  • contracts/common: the code for a refused precondition (RC-1-S02's follow-up) would let the ADM refusals move off validation-failed in a minor version.
  • Design system (RC-1-S21): none from this session.