Skip to content

Implementation plan / Session plan / Handover RC-3-S05

Handover RC-3-S05 Build: Identity (slice RC-3)

Card: RC-3-S05. Issue: cema-care/his#61. Branch: session/RC-3-S05. Slice: RC-3. Decision record: ADR-HIS-087. Comes after RC-1-S08, whose unit it extends, and RC-3-S03; its contract is that of RC-3-S02 (patient-identity.v1 1.2, contract points of RC-3-S05 in contracts/adm/README.md).

What was built and where

Everything is in services/adm-identity. No other folder changed, apart from this handover and the decision record with its row in the decision record index.

Version 1.2 of patient-identity.v1: twelve operations (contract points 1 to 8 of RC-3-S05).

Requirement Operations Where
FR-ADM-MPI-004 stewardship work queues reportIdentityWorkItem; resolveIdentityMatch with different-persons and defer; readStewardshipReport; listIdentityMatches?itemType; the work-item fields of IdentityMatch (itemType, priority, evidenceNotes, resolution, mergeId, notes) mod001/Stewardship, IdentityMatches, review/
FR-ADM-MPI-005 reversible merge and unmerge resolveIdentityMatch with merge; listMerges; readMerge; unmergePersons; listUnmergeAttributions; attributeAfterUnmerge; signOffUnmerge; Person.identityUnderReview after an unmerge mod001/Merges, merge/
FR-ADM-XRF-002 cross-reference and demographics query crossReferenceIdentifier; queryDemographics mod001/CrossReferences

Three new events, each published from the outbox in the transaction of its change and validated by the contract test: - PatientMerged and PatientUnmerged on his.adm.person.v1, each with IdentityUpdated of the survivor; - IdentityReviewResolved on his.adm.identitymatch.v1.

Persistence: migration mod-adm-001/.../db/mod_adm_001/V3__stewardship_and_merge.sql. - The RC-3 attributes of DE-ADM-004 on identity_match. - merge_event (DE-ADM-005), append-only by trigger. - unmerge_attribution and unmerge_sign_off (section 7.3). - unmerge_request, the unmerge work items. - known_encounter and known_appointment. - person.attribution_pending. - review_task_request now also queues task completions.

What the unit now reads and calls: - It subscribes to his.adm.encounter.v1, his.adm.appointment.v1 and his.ess.task.v1 (activity/ActivitySubscriptions, review/TaskSubscriptions). - It completes D10 tasks (TaskServiceClient.completeTask). - After an unmerge it calls correctEncounter of adm-patient-administration (merge/HttpEncounterCorrections, setting his.adm.encounters.url). - The service-token logic moved into mod001/ServiceTokens, shared by both clients. The settings are unchanged.

MOD-ADM-003 gains IdentifierRegistry.setPreferred, for the one preferred No. RM per facility of PR-MPI-005-1.

Unit README: what the unit serves, the new settings (his.adm.encounters.url, his.adm.merge.open-encounter-policy, his.adm.review.deferred-*) and two new stand-ins.

Kit: only its test fixtures gained TestTokens.stepUp (review round 1). The kit changes of RC-1-S26 (#158), merged on main, came in with the merge of main without conflict, and the unit builds and passes its tests with them.

Dependencies: none added. The lockfiles are unchanged.

The decisions are in ADR-HIS-087, with its row in the decision record index (87 records after the merge of main, which brought ADR-HIS-076 and ADR-HIS-088). ADR-HIS-086 is reserved by the open pull request #203 (RC-3-S04); whichever merges second raises the count by one. 1. A merge moves and deletes nothing. The survivor answers with the identifiers of the persons merged into it. The merge event records the demographics and preferred flags an unmerge restores. 2. Merge events are append-only. Attribution and sign-off are kept beside them. 3. Encounters and appointments are known from their events. An attribution is a correctEncounter call. 4. D10 owns the tasks, their assignment and their escalation, and the unit follows them from TaskStateChanged. 5. The policy actions merge, unmerge and approve on adm.Merge, and cross-reference and demographics-query on adm.Patient. The obligations restrict-authorities and disclose-enterprise-id.

Checks and their result

The integration environment ran as HIS_SESSION=RC-3-S05 (his-rc-3-s05), light profile.

Check Command Result
Build and all tests ./gradlew build in services/adm-identity passed, 135 tests after the merge of main:
  • mod-adm-001: 89, 29 of them new;
  • mod-adm-003: 9;
  • kit: 34 (7 new from RC-1-S26), with the Kafka adapter test skipped (full profile only);
  • unit: 3, the module boundary test included.
Contract test PatientIdentityContractTest (tag contract): his-contract verify contracts/adm --operation <id> for each of the 23 operations the unit serves, permitted for RSU-01 and RSU-02 and denied for any other facility; then his-contract validate-event contracts/adm on everything published verify passed, 62 of 62 cases (33 before). validate-event passed, PatientMerged, PatientUnmerged and IdentityReviewResolved included
Static analysis platform/delivery-pipeline/bin/static-analysis services/adm-identity no blocking finding; no clinical artifact
Secret scan platform/delivery-pipeline/bin/secret-scan code origin/main HEAD no secret, in the files or the commits
Dependency scan platform/delivery-pipeline/bin/dependency-scan services/adm-identity 0 blocking (5 medium, unchanged; no dependency added)
Documentation python3 docs/implementation_plan/tools/check_links.py; mkdocs build 0 broken links, 0 duplicate anchors; the site builds

Requirements and test scenarios

Every test is tagged with its requirement and scenario (session rule 5). The classes are in mod-adm-001/src/test/java/care/cema/his/adm/mod001/.

Requirement, criterion Test Scenario
FR-ADM-MPI-004 AC-01 (a review-band match is a work item with its evidence) StewardshipWorkqueueTest.reviewBandMatchIsAWorkItem TEST-ADM-004
FR-ADM-MPI-004 part 5 (a reported duplicate; its task in the answer) StewardshipWorkqueueTest.reportedDuplicate TEST-ADM-004
FR-ADM-MPI-004 AC-04, PR-MPI-004-1 (no second item; evidence appended, by a report or a new match) StewardshipWorkqueueTest.noDuplicateItem, reportedDuplicate TEST-ADM-004
FR-ADM-MPI-004 AC-02, PR-MPI-004-3 (outcome and reason code mandatory and stored; the task completed; IdentityReviewResolved; audited) StewardshipWorkqueueTest.resolutionNeedsOutcomeAndReason TEST-ADM-004
FR-ADM-MPI-004 part 10 (an item already resolved: second save refused) StewardshipWorkqueueTest.secondSaveRefused TEST-ADM-004
FR-ADM-MPI-004 different persons: the pair is not queued again StewardshipWorkqueueTest.differentPersonsNotQueuedAgain TEST-ADM-004
FR-ADM-MPI-004 defer with a review date, return to pending review with a new task StewardshipWorkqueueTest.deferAndReturn TEST-ADM-004
FR-ADM-MPI-004 part 6.4 (an open encounter raises the priority) StewardshipWorkqueueTest.openEncounterPriority TEST-ADM-004
FR-ADM-MPI-004 AC-03, PR-MPI-004-2, part 6.6 (report: volume, ageing, past threshold, escalation, assignment, reason, outcome; no patient) StewardshipWorkqueueTest.queueReport TEST-ADM-004
FR-ADM-MPI-004 part 13 (stewards only; a refusal audited, nothing changed) StewardshipWorkqueueTest.refusedResolution
FR-ADM-MPI-005 AC-01, parts 6.1 to 6.5, PR-MPI-005-1, 2 and 4, part 12 MergeUnmergeTest.mergeKeepsEverything, which covers:
  • every No. RM, source identifier and the encounters answer under one identity;
  • both No. RMs of a facility are kept, one preferred;
  • the selected group is taken;
  • the retired person is kept;
  • the identifiers are never reissued;
  • PatientMerged and IdentityUpdated come from one transaction;
  • both identities are audited, with each selection.
TEST-ADM-005
FR-ADM-MPI-005 part 3, DEC-ADM-002 (second approval, not the executor) MergeUnmergeTest.secondApproval TEST-ADM-005
FR-ADM-MPI-005 part 7, CUX-64 (the second person authenticated in place; any other signature refused, audited) SecondApprovalStepUpTest.unauthenticatedSecondPerson, stepUpUsedOnce TEST-ADM-005
FR-ADM-MPI-005 part 3, DEC-ADM-002 (the second person's merge authority, decided for them) SecondApprovalStepUpTest.unauthorizedSecondPerson TEST-ADM-005
FR-ADM-MPI-005 part 3 (the sign step of merge, unmerge and sign-off) SecondApprovalStepUpTest.executorStepUp TEST-ADM-005
FR-ADM-MPI-005 part 13 (authorization before existence) SecondApprovalStepUpTest.authorizationBeforeExistence
FR-ADM-MPI-005 AC-05 (no merge authority: refused, audited, nothing merged; a merge request instead) MergeUnmergeTest.noMergeAuthority TEST-ADM-005
FR-ADM-MPI-005 part 10, part 11; FR-ADM-MPI-004 part 10 MergeUnmergeTest.alreadyMerged: no merge of a merged record; other items name the survivor with a note; merge events append-only TEST-ADM-005
FR-ADM-MPI-005 AC-02, part 6.6 MergeUnmergeTest.unmergeRestores, which covers:
  • the Head of HIM only;
  • both persons equal their pre-merge state: identifiers with preferred flags, demographics, authorship and source;
  • PatientUnmerged;
  • a merge is reversed once.
TEST-ADM-005
FR-ADM-MPI-005 AC-04, PR-MPI-005-3, parts 6.7, 6.9.1 and 6.9.2 MergeUnmergeTest.postMergeRecordsHeld, which covers:
  • post-merge records are held and none is attributed;
  • "Identity under review after unmerge" shows on both identities;
  • an attribution is a correctEncounter with the unmerge;
  • an outage changes nothing;
  • an appointment stays pending;
  • the sign-off is refused while records await attribution.
TEST-ADM-032
FR-ADM-MPI-005 part 6.9.5, part 3 (unmerge request) MergeUnmergeTest.signOff: the request is a high-risk adm.unmerge-request; the sign-off needs every reviewing domain confirmed; it closes the work item and completes its task TEST-ADM-032
FR-ADM-XRF-002 AC-01, part 6.1, part 12 CrossReferenceTest.facilityAToB TEST-ADM-011
FR-ADM-XRF-002 AC-02, part 6.3 CrossReferenceTest.mergedIdentifier TEST-ADM-011
FR-ADM-XRF-002 AC-04 CrossReferenceTest.unauthorizedConsumer TEST-ADM-011
FR-ADM-XRF-002 PR-XRF-002-1, BR-ADM-004 CrossReferenceTest.unknownAndUnqualified TEST-ADM-011
FR-ADM-XRF-002 PR-XRF-002-2, part 6.5 CrossReferenceTest.authorityRestriction TEST-ADM-011
FR-ADM-XRF-002 part 6.2, PR-XRF-002-3 CrossReferenceTest.demographicsQuery, purposeRequired TEST-ADM-011
Every operation of patient-identity.v1 that the unit serves contract/PatientIdentityContractTest.providerVerify

What these tests cannot show by themselves, and where it is shown: - FR-ADM-MPI-005 AC-03 (acknowledgement of each consumer tracked; a missing one on the reconciliation worklist). This unit publishes PatientMerged and PatientUnmerged in the transaction of the change, tested above. The delivery tracker that follows each consumer's acknowledgement is adm-patient-administration's, built by RC-3-S06 (ADR-HIS-083 point 5, contract point 7 of RC-3-S06). - TEST-ADM-032 across the consuming domains. The procedure also needs the records of Domains 3 to 7 to move with an attributed encounter, the domains' own review items, and the invoice credited and reissued. Domain 1's part is tested above: held records, attribution through EncounterCorrected, the sign-off waiting for every domain. The rest runs end to end in RC-3-E2E-004 (RC-3-S24) and in each consuming domain's build. - FR-ADM-XRF-002 AC-03 (conformance pack of the selected profiles). The pack is run against the D02 FHIR facade (PIXm, PDQm; RC-3-S15). Behind it, the operations pass the provider contract test.

Safety-critical function "Merge and unmerge" (D01-ADM 11.1; hazard: loss or misattribution of history): - Its verification passes. TEST-ADM-005 is covered by the five MergeUnmergeTest cases tagged with it. Domain 1's part of TEST-ADM-032 is covered by the two tagged with it. - The controls are implemented as specified: - identifiers and authorship are preserved: nothing is moved, the retired identity is kept, and the merge event is append-only; - the merge is reversible: the unmerge restores exactly the state before the merge; - the attribution queue holds every post-merge record, none attributed by default; - the events reach consumers through the outbox, for their acknowledgement tracking. - No specified control was altered, so no hazard log entry changes. The hazard log is the clinical safety register (architecture section 13), outside the repository.

Safety duty (validate any change to matching rules or thresholds; the merge stays reversible and preserves identifiers and authorship): no matching rule, weight or threshold was changed. Reversibility and preservation are the controls above.

Non-functional targets designed for: - NFR-ADM-005 (security). Every operation goes to the decision point: - merge authority, unmerge and sign-off are distinct actions (ADR-HIS-087 point 5); - refusals are audited under adm.identity.match, adm.identity.merge and adm.person.search; - an outage answers 503; - national values are masked in PatientMerged and PatientUnmerged and wherever mask applies; - the enterprise identifier goes to a consumer only with disclose-enterprise-id; - the scans are clean. - NFR-ADM-009 (interoperability). All contract cases pass and the events validate. The HL7 v2 A40 is made by Domain 2 from PatientMerged. - NFR-ADM-012 (observability). The kit's traces, logs and correlation identifier; the counters of the review task queue (now completed too); a new counter his.adm.xref.persons.returned (SEC-010, enumeration by a consumer). - NFR-ADM-013 (localization). The review date and the report period are in the configured zone (his.adm.time-zone). - NFR-ADM-014 (time integrity). Every instant is stored in UTC to the millisecond.

Differences from the specification or the contract

  • The demographics query answers only the high-confidence band. The contract says "no candidates below the match threshold", and minimum necessary applies to external disclosure. A review-band candidate is not answered (Q2 below).
  • The purpose of use is required for both queries, from every consumer. Part 7 makes it mandatory for external consumers. The unit cannot tell an external consumer from an internal one, and the audit of record access needs a purpose (D10-ESS 9.5). Callers already send it (RC-1-S08 follow-up).
  • The sign-off needs CLI, ANC, FIN, HIM and PEX confirmed. These are the consuming domains of part 6.9.3 that hold records and review them. Domains 8 and 9 rebuild from the events (Q3).
  • Unmerge restores the survivor's selected groups to their values before the merge. The groups the steward took from the retired person go back. A change made to such a group on the survivor after the merge is therefore not kept in the index's current demographics. Its version stays in DE-ADM-006 with adm-patient-administration. Today no such change reaches this unit, because recordDemographicChange is not built yet (Q4).
  • An open encounter on either record warns and lets the merge proceed by default (his.adm.merge.open-encounter-policy=warn). WF-ADM-002 names both possible policies, and governance confirms which one applies (Q1).
  • "Both records hold clinical activity" is read as an encounter of each, in any state but cancelled, as the contract README says (RC-3-S05 point 3).
  • reportIdentityWorkItem answers 503 while the D10 task service is down, with the item kept. The contract requires taskId in its answer, and only D10 assigns it. A repeat with the same Idempotency-Key answers the item with its task.
  • attributeAfterUnmerge refuses an appointment on its item ("Appointments cannot be attributed yet."). The contract keeps appointments pending until scheduling.v1 has a patient correction. So a post-merge appointment keeps the sign-off waiting.
  • Escalation is D10's. The contract point says to escalate items past CFG-ADM-006 with an adm.identity-review-escalation task. The D10 registration of adm.duplicate-review (services/ess-coordination) names adm.identity-review-escalation as the task type's escalation policy, which D10 applies at the task's due time. The unit sets the due time and reports the escalation from TaskStateChanged, rather than creating a second task (ADR-HIS-087 point 4).
  • Step-up is read from the token (ADR-HIS-087 point 6), because there is no IF-ESS-002 verification service.
  • The executor of a merge, an unmerge or a sign-off needs a session with acr aal2 and an auth_time within 5 minutes.
  • The second person's signatureId is their own step-up token, validated by the unit and used once, and the policy decision point decides for them.
  • The executor's signatureId is recorded as the reference of their sign step.
  • The sign-off takes domainsConfirmed on the Head of HIM's word. It is not checked against the consumers' acknowledgements of PatientUnmerged and EncounterCorrected, which part 6.9.5 also requires. Those acknowledgements and the reconciliation worklist by domain are adm-patient-administration's delivery tracker (RC-3-S06, ADR-HIS-083 point 5), which does not exist yet. A follow-up has the sign-off read listEventReconciliationItems for the unmerge once it does.
  • identityUnderReview is set only after an unmerge. Its open-review-item part belongs to the RC-1-S08 fix, as do recordIdentityReview and recordDemographicChange. None of these is served by this session.
  • listUnmergeAttributions carries the evidence the steward recorded, not the registration's own evidence. That evidence (document checked, wristband, consent) is on the encounter in adm-patient-administration.

Review round 1

The review asked for five changes. All five are made on this branch: 1. Second approval. The second approval is now the second person's own step-up token, validated by the unit, and the policy decision point decides for that person (ADR-HIS-087 point 6, StepUp, migration V4__step_up_use.sql). 2. Tests of the refusals. SecondApprovalStepUpTest refuses an invalid signature, another person's token, a token without a second factor, a stale or expired one, a service identity, a second person without merge authority, and a replayed step-up. 3. Executor step-up. A merge, an unmerge and a sign-off are refused in a session that is not stepped up. 4. Authorization before existence. unmergePersons, attributeAfterUnmerge, listUnmergeAttributions, signOffUnmerge, readMerge, resolveIdentityMatch and reportIdentityWorkItem ask the decision point before they say whether a merge, record, match or person exists. 5. domainsConfirmed. The sign-off's dependence on the Head of HIM's word is stated under "Differences", with a follow-up for when RC-3-S06's worklist exists.

The kit's test fixtures gained TestTokens.stepUp. The contract test calls with a stepped-up token. Afterwards the build (128 tests; 135 after the merge of main), the contract test (62 of 62), the scans and the documentation checks pass again.

Contract changes

None. The unit serves patient-identity.v1 1.2 as RC-3-S02 fixed it.

Questions for a person

None of these stops this session. Each is under "Needs a person" in the pull request.

# Question Owner What the unit does now
Q1 WF-ADM-002: when either record of a merge has an open encounter with in-flight activity, is the configured policy "proceed with notification" or "defer"? Registration and HIM governance Proceeds, with the warning on the merge (warn). defer refuses the merge, with no code change
Q2 FR-ADM-XRF-002 and the contract: the demographics query returns "no candidates below the match threshold". Is that threshold the upper one (high-confidence band only), or the lower one (the review band too)? Owner of D01-ADM, privacy officer High-confidence band only
Q3 FR-ADM-MPI-005 part 6.9.5: whose review items must the Head of HIM confirm closed before signing off? Owner of D01-ADM, HIM The five domains of part 6.9.3: CLI, ANC, FIN, HIM, PEX
Q4 At unmerge, a demographic group the survivor took from the retired person goes back to the survivor's value before the merge. Should a change made to that group after the merge be kept instead? HIM governance Back to the value before the merge. The later version stays in the DE-ADM-006 history

Follow-ups outside the card

  • RC-1-S16 (D10 policy): register in enterprise-access:
  • on adm.Merge: merge (identity stewards with merge authority, recertified, SEC-004), unmerge and approve (the Head of HIM only), view and update (stewards);
  • on adm.IdentityMatch: create (clerks and clinicians, for reports) and update (stewards);
  • on adm.StewardshipReport: view (HIM lead, registration supervisors, data governance);
  • on adm.Patient: cross-reference and demographics-query (consuming domain services, onboarded partners);
  • the obligations restrict-authorities (with systems) and disclose-enterprise-id.

Starter roles: the Head of HIM (dev.himhead), a second steward for the second approval. - RC-1-S15 (D10 workflow): register the task types adm.merge-request and adm.unmerge-request in the queue adm.identity-stewardship, with the escalation policy adm.identity-review-escalation, as adm.duplicate-review has. - D02 topic register (platform/event-backbone): adm-identity is now a consumer of his.adm.encounter.v1, his.adm.appointment.v1 and his.ess.task.v1. - RC-3-S24 (integrate): - set his.adm.encounters.url to adm-patient-administration; - add the synthetic users dev.himhead and a second steward. - Note: RC-3-E2E-004 reads status on a person, where the contract field is identityStatus. - RC-3-S06 (adm-patient-administration): accept correctEncounter with attributes.patient and unmergeId from the adm-identity service identity (contract point of RC-3-S02). The delivery tracker follows PatientMerged and PatientUnmerged (FR-ADM-MPI-005 AC-03). - The RC-1-S08 fix (adm-identity): - recordIdentityReview and recordDemographicChange (patient-identity.v1 1.1); - identityUnderReview for open review items; - Q4 above, once demographic changes reach the unit. - A later ADM contract and the scheduling build: the patient correction of an appointment, so post-merge appointments can be attributed and the sign-off can complete when one exists. - D10 identity service: an IF-ESS-002 verification of step-up signatures, to replace the token check of StepUp (ADR-HIS-087 point 6). - Development realm and RC-3-S24: the realm his issues acr and auth_time as the token profile says. The stewards, the Head of HIM and a second steward (dev.steward2) can step up. RC-3-E2E-004 merges and unmerges with stepped-up sessions. - Sign-off against the acknowledgements (after RC-3-S06): refuse signOffUnmerge while the reconciliation worklist (adt.v1 listEventReconciliationItems) holds an open item for PatientUnmerged or an EncounterCorrected of the unmerge. - Service template: TestTokens.stepUp in the kit's test fixtures (added here), for every unit with a sign step. - Screen session for UI-ADM-002 (stewardship workqueue): still in no RC-3 card (RC-3-S02 follow-up). Every operation it needs is now served. - Design system: none from this session.

Needs a person

  • Clinical safety officer and HIM governance: review of the change to identity matching, merge and unmerge, on the merged work (card "Needs a person"). No threshold or matching rule was changed, so no governance threshold approval is asked for.
  • Enterprise Architecture Board: approval of ADR-HIS-087.
  • Q1 to Q4 above.