Implementation plan / Session plan / Handover RC-1-S28-F2
Handover RC-1-S28-F2 Fix: adm-identity serves patient-identity.v1 1.1¶
Card: RC-1-S28-F2. Issue: cema-care/his#207. Branch: session/RC-1-S28-F2. Slice: RC-1. Owner of the work: RC-1-S08. Comes after the gate RC-1-S28 and RC-1-S28-F1. Decision record: ADR-HIS-093.
Issue #207 holds the gate's evidence: version 1.1 of patient-identity.v1 was added by RC-2-S01 (#46) for RC-1-S09, which calls it against its stub. The built adm-identity served neither operation, and set identityUnderReview only after an unmerge, so a registration whose change needs a review item could not complete against the built unit (identity safety report, finding I-2; traceability, FR-ADM-REG-003 "Deviation"). No other answer from a person was needed: the behaviour is in the contract (contracts/adm/README.md, "The RC-1-S08 fix") and in the specification (PR-REG-003-3 to 5, GAP-ADM-011, GAP-ADM-012).
What was built and where¶
Everything is in services/adm-identity/mod-adm-001. No contract, dependency or lockfile changed.
| Part | Where | What it does |
|---|---|---|
recordIdentityReview, POST /v1/identity-reviews |
IdentityReviews, ReviewRouter.routeAnswered, web/PersonController |
Contract point 1. It runs the check again on the data the answered check was run on, holding the clerk to every prompt and refusing a new candidate (PR-REG-003-2). It refuses "same" for another person than personId, for two candidates, or on a change. Each answered prompt is stored as a DE-ADM-004 match:
identityUnderReview and ambiguityFlag. One answer per Idempotency-Key. Policy action update on adm.Patient for the person, since the answers are the clerk's change of the patient (ADR-HIS-093 point 5); each match is audited as adm.identity.match |
recordDemographicChange, POST /v1/persons/{personId}/demographic-changes |
PersonCommands.recordDemographicChange, applyGroups |
Contract point 3, INT-ADM-001. The changes are applied in order of demographicsVersion: one already applied answers the person unchanged, and a gap is 412. The listed groups take the change's values, and the person is re-indexed. A verification sent with the change makes the person verified. IdentityUpdated demographics-changed is published in the same transaction. Policy action update on adm.Patient; audited as adm.person.change |
Person.identityUnderReview |
PersonStore (Person.identityUnderReview()), PersonViews |
Contract point 2. True while any review item of the person is open (pending review or deferred), high-risk or not, and while records of an unmerge await attribution. It is derived from the items, so creation, review, report, resolution and deferral all keep it right |
| A "same person" item cannot be merged | Stewardship.resolve |
Its pair is the selected person on both sides (ADR-HIS-093 point 2). A merge is refused with a message, and "different persons" or "defer" resolve it |
Migration V5__identity_review_and_handoff.sql |
src/main/resources/db/mod_adm_001/ |
duplicate_check.subject (the data a check ran on), identity_match.registration_id, held_demographics, held_identifiers, the pair-order check relaxed to "not after", person.demographics_version |
| Tests | IdentityReviewTest (8), DemographicChangeTest (7), contract/PatientIdentityContractTest |
See below. The contract test now verifies all 25 operations, the two of 1.1 included |
| Unit README | services/adm-identity/README.md |
Version 1.1 listed as served; the rule of identityUnderReview |
ADR-HIS-093 records the five choices that the contract left open: the check keeps its data, the "same person" pair is one person, identityUnderReview is derived, the policy action is a change of the patient, and the handoff is applied in order and then matched again. Its row is in the decision record index (93 records). It was numbered 092 at first. #235 (RC-3-S09), opened earlier, also took 092, and RC-1-S28-F5 left 093 for the later of the two, so this record is 093.
Checks and their result¶
The integration environment ran only as HIS_SESSION=RC-1-S28-F2 (his-rc-1-s28-f2).
| Check | Command | Result |
|---|---|---|
| The test fails before the repair | ./gradlew :mod-adm-001:test --tests '*PatientIdentityContractTest', light profile, with mod-adm-001/src/main/java as on main (the new migration kept so the fixtures load; the new classes and tests set aside) |
failed: recordIdentityReview and recordDemographicChange answered 404 to the documented request and to the invalid one ("No static resource v1/identity-reviews", "… /demographic-changes"). This is the gate's "Version 1.1 not served". IdentityReviewTest and DemographicChangeTest cannot compile against main, which has neither operation |
| The unit's build and every test, after the repair | ./gradlew cleanTest build --no-build-cache in services/adm-identity, light profile |
passed (review round 1): 150 tests, 0 failed, 1 skipped (the Kafka adapter test, full profile only). Contract verify of patient-identity.v1: 68 cases, 0 failed, every operation of 1.0 to 1.2 (validate-event passed). Every test of RC-1-S08, RC-3-S05 and RC-1-S28-F1 passes |
| Static analysis | platform/delivery-pipeline/bin/static-analysis services/adm-identity |
no blocking finding |
| Secret scan | platform/delivery-pipeline/bin/secret-scan code origin/main HEAD, and docs |
no secret |
| The slice scenario | HIS_SESSION=RC-1-S28-F2 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh, full profile |
Review round 1, run 20261129T090752Z-b1f9 (load average 8 to 16): 11 of 12 passed, RC-1-E2E-001 to 005, 007, 008 and 010 to 013. RC-1-E2E-006, the registration through the screen, failed on one 503 "access cannot be checked". adm-patient-administration's own call to the decision point did not answer in time (338 ms) and was denied (correlation 9509318c-…, its log). adm-identity received no request of that registration, and the case registers a person with no candidate, so the code changed here does not run in it. It also failed this way in RC-1-S28-F1's runs; it passed in the gate's run. Round 0, run …070346Z-4785 (load average 16 to 45): 9 of 12, with 001, 006 and 013 failing on decision point timeouts. Runs …064234Z-ea8f, …065757Z-62c7 and …085931Z-0b42 stopped before any case: the ESS stub started before contracts/common's install finished (#216, RC-1-S28-F10) |
| The 1.1 path end to end (an extra check, not committed) | The stack of e2e/scenarios/RC-1 with one extra scenario, RC-1-E2E-901, in an uncommitted copy of the folder, full profile |
Run 20261129T074422Z-9bbf, against the built units:
|
| Documentation links | python3 docs/implementation_plan/tools/check_links.py |
0 broken links, 0 duplicate anchors |
| Documentation site | .venv/bin/mkdocs build |
Builds. Its warnings are the four existing links out of docs/ (ADR-HIS-062, FN-S05, RC-1-S11, RC-1-S12); none from this session |
What the gate line now shows¶
The gate line is criterion 4 (ACC-001) of slice gate RC-1: every Must requirement meets its acceptance criteria (FR-ADM-REG-003, FR-ADM-MPI-003). It also covers IF-ADM-001 of criterion 6, "Version 1.1 not served". After this change:
- IF-ADM-001: the built adm-identity serves patient-identity.v1 1.1. The provider contract test verifies recordIdentityReview and recordDemographicChange with every other operation.
- FR-ADM-REG-003, PR-REG-003-4: a registration against an existing person answered "same person" completes with a review item for the pair. The differing data is held on the item and not written onto the person, and the person shows "Identity under review".
- FR-ADM-REG-003, PR-REG-003-5: a new person after "unsure" on a pair that is not high-risk is active (RC-1-S28-F1) and now shows "Identity under review".
- INT-ADM-001: a change of an existing person's demographics reaches the index.
The unit tests show all three. So does the extra end-to-end check against the built units (above): "same person" and "unsure" through adm-patient-administration, and the handoff seen in the verification status. RC-1-E2E-002 of the slice scenario passes again, and 11 of the 12 cases pass in one run. The next gate round, RC-1-S28-G2, confirms the line in its own run.
Requirements and test scenarios of the card¶
| Requirement, rule | Test | Scenario |
|---|---|---|
| FR-ADM-REG-003 PR-REG-003-4, GAP-ADM-011: "same person" at a registration, a review item for the person with the held data, nothing created or merged, Identity under review, the task and DuplicateReviewRequested | IdentityReviewTest.samePersonRecordsReviewItemWithHeldData |
TEST-ADM-008 |
| PR-REG-003-4: "same" refused for another person, for two candidates, on a change | IdentityReviewTest.samePersonRefusedOtherwise |
TEST-ADM-008 |
| PR-REG-003-5: "unsure" on a change, a review item for the pair, both persons under review | IdentityReviewTest.unsureOnChangeRecordsItem |
TEST-ADM-003 |
| PR-REG-003-5, GAP-ADM-012 (1): a new person after "unsure" is active and shows Identity under review | IdentityReviewTest.unsureCreationShowsIdentityUnderReview; ReviewRoundOneTest.unsureNotHighRiskCreatesActive (F1) |
TEST-ADM-003 |
| PR-REG-003-3: "different" on a flagged pair still reviewed, high-risk and flagged; on an unflagged pair a non-match with no item | IdentityReviewTest.differentOnFlaggedStillReviewed |
TEST-ADM-003 |
| PR-REG-003-2: held to the check (unanswered prompt, new candidate, check of another person, missing registration) | IdentityReviewTest.heldToTheCheck |
TEST-ADM-008 |
| IF-ISE-001 idempotency; PR-MPI-004-1 one item per pair | IdentityReviewTest.idempotentAndOneItemPerPair |
|
| identityUnderReview clears on resolution; a "same person" item cannot be merged | IdentityReviewTest.resolutionClearsIdentityUnderReview |
TEST-ADM-008 |
| INT-ADM-001, FR-ADM-MPI-001 part 6.1, FR-ADM-REG-002 part 6.6: the change applied, re-indexed, IdentityUpdated | DemographicChangeTest.changeAppliedAndReindexed, applyGroups |
|
| FR-ADM-REG-003 part 11: verification status from the change | DemographicChangeTest.verificationSetsStatus |
|
| INT-ADM-001: in order, a repeated version unchanged, a gap 412 | DemographicChangeTest.orderedWithoutGaps, refusals |
|
| PR-REG-002-3, FR-ADM-MPI-002 part 5, INT-ADM-001: a handed-over change of matching-relevant data is matched again (fails with the matching turned off: expected 1 item, got 0) | DemographicChangeTest.changeIsMatchedAgain |
TEST-ADM-003 |
| PR-REG-003-3: the clerk's "different person" for the change stands when it is matched again | DemographicChangeTest.answeredDifferentStands |
TEST-ADM-003 |
| IF-ADM-001 1.1, every operation | contract/PatientIdentityContractTest.providerVerify |
Safety. This changes the controls of the safety-critical function "Patient search and selection" (D01-ADM 11.1): the review item and "Identity under review" after "same person" and "unsure", and the block of a high-risk pair. They are now built as the specification states. Nothing is linked or merged: a "same person" item cannot be merged, and the clerk's captured data is held for the steward, not written onto the person. The high-risk pair still sets the ambiguity flag, and the caller blocks routine registration on it. No control is weakened. The hazard log is the clinical safety register outside the repository. Registration governance and the clinical safety officer confirm on the merged change that its entries for "same person" and "Identity under review" match GAP-ADM-011 and GAP-ADM-012 ("Needs a person").
On this host. A contract test run after a scenario run cannot install the contract tools. The harness's stub container installs contracts/common with its own pnpm, and the test's copy then refuses to purge it without a TTY (#216). To run the unit tests again here, contracts/common/node_modules was moved aside into this session's scratchpad.
Differences from the specification or the contract¶
- The steward cannot read the held data through the API yet.
IdentityMatchinpatient-identity.v1has no field forheld_demographics,held_identifiersor the registration, which D01-ADM 7.3 adds to DE-ADM-004. They are stored on the match. An ADM contract session adds them toIdentityMatchas a compatible minor version (follow-ups); this card does not owncontracts/adm. - A "same person" item names one person twice. The contract's example does the same. D01-ADM 7.3 says the pair of DE-ADM-004 is "different persons"; GAP-ADM-011 makes this pair "the selected person and the matched candidate data" (ADR-HIS-093 point 2).
- "Different" on an unflagged candidate in the review or high-confidence band is stored as a non-match with no item, as contract point 1 says.
createPersonstill routes such a pair by band, as RC-1-S08 built it. The two operations differ here because their contract points differ. recordDemographicChangematches again (review round 1). The contract's point 3 lists only re-indexing, but INT-ADM-001 submits changed identity data "for matching", and PR-REG-002-3 requires matching again on a matching-relevant change. A change of a compared group is matched after its commit; the clerk's answers for the same change stand (ADR-HIS-093 point 6).- A check stored before this version cannot be used for
recordIdentityReview: it has no data, and the caller is told to run the check again.
Questions for a person¶
Answered (review round 1, #207): may adm-patient-administration, as a service, hand demographic changes to adm-identity? The owner chose option A on 2026-11-29: a D10 policy rule for this one handoff, with a scope of its own given only to adm-patient-administration (ADR-HIS-093, consequences). The rule and the scope are outside this card's folders. A fix session on services/ess-runtime-decision makes them, and needs a person to start it (below). adm-identity's code does not change for it: it asks the decision point for update on adm.Patient for every handoff, and the new rule answers the service's call.
Also:
- Registration governance and the clinical safety officer: confirm the hazard log entries for "same person" and "Identity under review" against GAP-ADM-011 and GAP-ADM-012, on the merged change (above).
- Start the fix session on services/ess-runtime-decision for option A of #207 (the rule and the scope above). This card cannot create it.
- Enterprise Architecture Board: approve ADR-HIS-093.
Follow-ups outside the card¶
contracts/adm(an ADM contract session): addheldDemographics,heldIdentifiersandregistrationIdtoIdentityMatch, as a compatible minor version, so the steward's screen can show the held data of a "same person" item.e2e/scenarios/RC-1(the integrate session's folder): RC-1-E2E-002 can checkidentityUnderReviewon the new person, and its soft check of the status can become a hard one (as RC-1-S28-F1 said). No case covers "same person" or a change with prompts. The extra check of this session (above) shows what one would do.services/ess-runtime-decisionand the stacks' service identities: option A of #207, chosen by the owner. A fix session adds the following:- in
mod-ess-002/src/main/resources/policy/enterprise-access.v1.json, the rule{"id": "adm-identity-handoff", "effect": "permit", "source": "INT-ADM-001: adm-patient-administration hands an existing person's demographic changes to adm-identity (recordDemographicChange, patient-identity.v1 1.1); option A of #207", "resourceTypes": ["adm.Patient"], "actions": ["update"], "subjectKinds": ["service"], "scope": "adm.identity-handoff:write"}, with cases inenterprise-access.v1.test-pack.json: permit with the scope, deny a service without it, and deny the scope on any other action or resource type; - the scope
adm.identity-handoff:writefor adm-patient-administration's service identity only, ine2e/scenarios/RC-1/provision/identities.jsonand the other stacks that run the unit (e2e/scenarios/RC-2/provision/identities.json), and in the registration of service identities of MOD-ESS-001.
Until then, a handoff delivered by the relay outside a person's request is refused, and the person's later handoffs wait behind it. A handoff delivered right after the person's change carries the person's token and is permitted. - Steward's screens (web/domains/adm): a "same person" item has one person on both sides. The work queue and the item view should show the held data instead of a second record. - ADR-HIS-053: still names the removed "unsure" setting (RC-1-S28-F1's follow-up, still open). - Design system: none.