Implementation plan / Session plan / Handover RC-1-S08
Handover RC-1-S08 Build: Identity¶
Card: RC-1-S08. Issue: cema-care/his#22. Branch: session/RC-1-S08. Slice: RC-1. Decision record: ADR-HIS-053. Comes after RC-1-S03, whose contract it serves.
What was built and where¶
The unit services/adm-identity, made from the service template (new-unit.sh adm-identity MOD-ADM-001 MOD-ADM-003). Its README.md documents the modules, the settings and the stand-ins.
| Module | What it holds |
|---|---|
mod-adm-003 (identifiers, FR-ADM-XRF-001) |
api/IdentifierRegistry, the only way into the module. It holds:
|
mod-adm-001 (MPI, FR-ADM-MPI-001 to 003) |
The person (DE-ADM-001) with current demographics, search names and blocking keys (person/).The matching engine behind IdentityMatcher (matching/): CFG-ADM-001 weights, Indonesian name normalisation, Jaro-Winkler, phonetic blocking, DET-NIK-DOB, exclusion flags and high-risk cases.Versioned matching configuration ( MatchingConfigurations, CFG-ADM-001@1 seeded from D01-ADM 13).Match records (DE-ADM-004) and their routing ( review/ReviewRouter); stewardship tasks to D10 through a local queue (review/ReviewTasks).The duplicate check, search and resolution, benchmarks, and the HTTP API of all 12 operations of patient-identity.v1 (web/) |
Both topics the unit owns carry events, each validated against the contract:
- his.adm.person.v1: PatientResolved and IdentityUpdated;
- his.adm.identitymatch.v1: DuplicateReviewRequested.
The unit's copy of the kit, which is the unit's own code since new-unit.sh:
- HisException carries errors (JSON pointer and message), and ProblemAdvice writes them into the Problem. The contract's refusals name the field.
- The audit payload follows the intake schema of contracts/ess, as services/ess-audit does (RC-1-S04). AuditEmitter, AuditProperties, PolicyEnforcer (refusal audit per action) and DomainEventPublisher were copied from there.
- AuditRecord gains resourceVersion, changedFields and queryCriteria, which the audit catalogue's categories require.
- PolicyRequest is written as the ESS DecisionRequest: patientRef and encounterRef, with no nulls.
- snappy-java 1.1.10.9 and lz4-java 1.11.4 are constrained in service-kit/build.gradle.kts, because kafka-clients brings versions with HIGH CVEs. Every lockfile of the unit was rewritten with ./gradlew dependencies --write-locks. No other dependency was added.
ADR-HIS-053 and its row in the decision record index (53 records).
Checks and their result¶
The integration environment ran as HIS_SESSION=RC-1-S08 (his-rc-1-s08), light profile.
| Check | Command | Result |
|---|---|---|
| Build and all tests | ./gradlew build in services/adm-identity |
passed: 99 tests in all:
|
| Contract test | PatientIdentityContractTest (tag contract): his-contract verify contracts/adm --operation <each of the 12> against the unit on a random port, with a token 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, 33 of 33 cases, the facility cases of assignFacilityIdentifier included; validate-event passed |
| Dependency scan | platform/delivery-pipeline/bin/dependency-scan services/adm-identity |
0 blocking (after the two pins above; before them 12 blocking HIGH) |
| Image scan | platform/delivery-pipeline/bin/image-scan services/adm-identity |
0 blocking |
| 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 |
no secret, in the files or in the commits |
| Documentation | python3 docs/implementation_plan/tools/check_links.py; mkdocs build; secret-scan docs origin/main HEAD |
0 broken links, 0 duplicate anchors; the site builds (its one warning is an existing link of FN-S05's handover); no secret |
Requirements and test scenarios¶
Tests are tagged with the requirement and the scenario (session rule 5). The classes named below are in mod-adm-001/src/test/java/care/cema/his/adm/mod001/, except IdentifierRegistryTest, which is in mod-adm-003.
| Requirement, criterion | Test | Scenario |
|---|---|---|
| FR-ADM-MPI-001 AC-01 (facility A No. RM from facility B: one person, both identifiers) | PersonSearchTest.searchByOtherFacilityIdentifier, sameAnswerFromEveryFacility (part 6.6) |
TEST-ADM-001 |
| FR-ADM-MPI-001 AC-02 (alias with date of birth) | PersonSearchTest.searchByAlias, nameNormalisation (part 6.5) |
TEST-ADM-001 |
| FR-ADM-MPI-001 AC-03, PR-MPI-001-1 (unqualified identifier refused, no match) | PersonSearchTest.unqualifiedIdentifierRefused |
TEST-ADM-001 |
| FR-ADM-MPI-001 AC-04, PR-MPI-001-2 (merged identity resolves to the survivor) | PersonSearchTest.mergedIdentityResolvesToSurvivor (readPerson, searchPersons, resolveIdentifier, PatientResolved) |
TEST-ADM-001 |
| FR-ADM-MPI-001 parts 10, 12, 13; PR-MPI-001-3; CFG-ADM-003 | PersonSearchTest.insufficientCriteriaRefused, noMatch, refineSearch, unknownIdentifierNotFound, searchesAndViewsAudited, nationalIdentifiersMaskedByPolicy, policyDenyAndOutage; AuditConformanceTest |
|
| FR-ADM-MPI-002 AC-01 (deterministic, with rule) | matching/PairScorerTest.deterministicMatch |
TEST-ADM-002 |
| FR-ADM-MPI-002 AC-02 (transposed date and spelling variant, evidence per attribute) | PairScorerTest.probabilisticScoreWithEvidence |
TEST-ADM-002 |
| FR-ADM-MPI-002 AC-03 (steward sees score, rules, attributes, version) | MatchRoutingTest.decisionExplained; restricted to stewards: evidenceRestrictedByPolicy |
TEST-ADM-002 |
| FR-ADM-MPI-002 AC-04 (benchmark, production unchanged until approved and effective) | BenchmarkTest.benchmarkLeavesProductionUnchanged (also part 6.7 and the part 10 approval rule), IdentitySafetySetTest.benchmarkOnSafetySet |
TEST-ADM-002 |
| FR-ADM-MPI-002 PR-MPI-002-1 to 3; part 10 (engine failure; no effective configuration) | PairScorerTest.missingDataNeitherInflatesNorDeflates, excludedAttributeNotUsed, deterministicConflictGoesToReview, deterministicFallback; MatchRoutingTest.engineFailure, noEffectiveConfiguration |
|
| FR-ADM-MPI-003 AC-01 (twins: no merge, review item) | MatchRoutingTest.twins, PairScorerTest.twinFlag |
TEST-ADM-003 |
| FR-ADM-MPI-003 AC-02 (newborn and mother not merged) | MatchRoutingTest.newbornAndMother, PairScorerTest.newbornAndAliasFlags |
TEST-ADM-003 |
| FR-ADM-MPI-003 AC-03 (changed name: review item, records separate) | MatchRoutingTest.changedName |
TEST-ADM-003 |
| FR-ADM-MPI-003 AC-04 (policy none: no merge above the upper threshold) | MatchRoutingTest.automaticMergeNone |
TEST-ADM-003 |
| FR-ADM-MPI-003 AC-05 (decision explained) | MatchRoutingTest.decisionExplained |
TEST-ADM-003 |
| FR-ADM-MPI-003 part 6.3 (flags force review in any band); FR-ADM-REG-003 part 6.3 and RC-1-S03 Q3 (unsure: created provisional, WF-ADM-001); Q-S08-2 (no newborn age assumed); PR-REG-003-2 under concurrency | ReviewRoundOneTest.flagForcesReviewInNonMatchBand, unsureCreatesProvisional, noNewbornAgeAssumed, concurrentCreationsSeeEachOther; UnsureConfiguredTest.unsureConfiguredActive |
TEST-ADM-003 |
| FR-ADM-MPI-003 PR-MPI-003-2; part 10 (task service down; thresholds invalid); EVT-ADM-003 | MatchRoutingTest.previousNonMatch, taskServiceUnavailable, duplicateReviewRequested, creationHoldsTheCheck; PairScorerTest.invalidThresholds |
|
| FR-ADM-MPI-002, MPI-003 identity safety set (twins, aliases, changed demographics, shared contact data): no unsafe silent merge | IdentitySafetySetTest.noUnsafeSilentMerge, on the 15 synthetic pairs of src/test/resources/reference/identity-safety-set.json |
TEST-ADM-031 |
| FR-ADM-XRF-001 AC-01 (enterprise identifier and facility A No. RM, with authority) | IdentifierRegistryTest.enterpriseIdentifierAndMrn, IdentifierApiTest.createAndAssign |
TEST-ADM-010 |
| FR-ADM-XRF-001 AC-02 (facility B No. RM, both resolve) | IdentifierRegistryTest.secondFacility, IdentifierApiTest.secondFacility |
TEST-ADM-010 |
| FR-ADM-XRF-001 AC-03 (value of a merged or deceased person never reissued) | IdentifierRegistryTest.neverReissued, correctionRetainedInHistory |
TEST-ADM-010 |
| FR-ADM-XRF-001 AC-04 (simultaneous registrations, different values) | IdentifierRegistryTest.concurrentAllocation (24 at once), IdentifierApiTest.concurrentAssignments |
TEST-ADM-010 |
| FR-ADM-XRF-001 PR-XRF-001-2, part 6.6, part 10, ARC-7.5, EVT-ADM-002 | IdentifierApiTest.identifierCollision, correction, correctionRules, staleVersion, facilityScope, idempotentCreation, identityUpdated; IdentifierRegistryTest.checks, oneMrnPreferred |
TEST-ADM-010 |
| FR-ADM-XRF-001 PR-XRF-001-3 (downtime numbers) | IdentifierRegistryTest.downtimeBlocks, downtimeBackEntry |
TEST-ADM-036, the identifier part |
Every operation of patient-identity.v1 (contract points 1 to 10) |
contract/PatientIdentityContractTest.providerVerify |
The results on the synthetic safety set, printed by IdentitySafetySetTest as evidence for the gate:
- Recall. CFG-ADM-001@1 sends every same-person pair to a steward (recall 1.0).
- No silent merge. No pair is merged or linked, and every twin pair carries the twin flag.
- Where pairs landed. 7 high-confidence, 5 review, 3 non-match; precision 0.58.
- One false upper-band match. One pair of different persons reached the high-confidence band: twins at 91.89, with the twin flag, and so reviewed. The weights and thresholds are to be re-tuned on the legacy data before go-live (CFG-ADM-002).
Safety-critical functions (D01-ADM 11.1):
- Identity matching and automatic merge. Its verification, TEST-ADM-003 and TEST-ADM-031, passes. The controls are implemented as specified: three bands, the exclusion flags, automatic merge disabled, and steward review.
- Patient search and selection. TEST-ADM-001 passes. TEST-ADM-008 belongs to RC-1-S09 (FR-ADM-REG-003). This unit supplies its parts: qualified identifier search, the duplicate prompts, and readPerson with name, No. RM, identity status and the ambiguity flag for the identity zone.
No specified safety control was altered, so there is no hazard log entry to update. The hazard log is the clinical safety register (architecture section 13), outside the repository.
Non-functional targets designed for:
- NFR-ADM-005 (security). Every request goes to the decision point with the caller's facility and purpose. Refusals are audited, and an outage answers 503, never a grant. National identifiers are masked on the mask obligation and in events. Every audit event meets its category (AuditConformanceTest). The scans are clean.
- NFR-ADM-009 (interoperability). The contract test passes all cases, and the events validate.
- NFR-ADM-012 (observability). The kit's traces, logs and correlation identifier. The unit adds the metrics his.adm.matching.run, his.adm.matching.fallback, his.adm.review.task.requests and his.adm.search.persons.returned (SEC-010).
- NFR-ADM-013 (localization). The time zone is configuration (his.adm.time-zone). The Indonesian rules are those of CFG-ADM-001 and CFG-ADM-008: name normalisation, NIK and BPJS formats.
- NFR-ADM-014 (time integrity). Every instant is stored in UTC to the millisecond. Business dates (the newborn age once set, working days) use the configured zone.
Differences from the specification or the contract¶
- Merge links are read, not made. Resolving a retired identity to its survivor (FR-ADM-MPI-001 AC-04) is built and tested. The merge that sets the link is FR-ADM-MPI-005 (RC-3), so the test leaves the retired identity in the state a merge leaves it.
- Exclusion flags (review round 1). Every exclusion flag sends a pair to review in any band, the non-match band included, and the pair is prompted to the clerk (FR-ADM-MPI-003 part 6.3, FR-ADM-REG-003 part 6.2). That is the specification as written. It may queue more items than the bands alone, for example every candidate pair of a person who has an alias. The queue volume is for HIM to watch once the D10 queue reports exist.
- Audit of record changes carries field names, not values. The audit catalogue (D10-ESS 9.5, as
services/ess-auditapplies it) keeps only changed field names for record-change events, so the audit event references the record with its version. The values, the reason, the actor and the score with its thresholds stay in the record's own history: DE-ADM-002 corrections and DE-ADM-004 matches. The contract says identifier changes are "audited with the new value"; the new value is in that history. - A search that returns no person is audited without a patient.
adm.person.searchis registered patient-scoped, so the audit service quarantines it until the registration is changed (follow-ups). Nothing is lost. - Stand-ins for D10 (ADR-HIS-053): the assigning authorities, the matching configuration versions, and the reference data sets. The NIK area code is checked for its shape only, and working days exclude weekends but not holidays.
- Downtime back-entry has no API yet. The register's operations are built and tested (TEST-ADM-036, the identifier part). The back-entry operation and the reconciliation are FR-ADM-FLW-003 and the merge of RC-3.
- Concurrent creations (review round 1).
createPersontakes a transaction-scoped advisory lock on each blocking key of the new data, in sorted order. Under those locks it runs the duplicate check again inside its transaction. A registration of the same new person at the same moment waits, sees the first one, and is refused as a new possible duplicate (ReviewRoundOneTest.concurrentCreationsSeeEachOther). The earlier check outside the transaction stays, so an engine failure still gives the provisional path of FR-ADM-MPI-002 part 10. - The identity status after "unsure" follows WF-ADM-001 (review round 2, RC-1-S03 Q3). As FR-ADM-REG-003 part 6.3 and the
createPersoncontract require, an "unsure" answer creates the person, with a review item on the match. The person is created provisional: WF-ADM-001 registers an uncertain identity against "a provisional record with visible uncertainty status". The settinghis.adm.registration.identity-status-after-unsure(defaultprovisional, oractive) carries registration governance's answer to Q3 when it comes. The contract test runs with the default. - No newborn age is assumed (review round 1, Q-S08-2). CFG-ADM-001@1 has no
newbornAgeDays, so no newborn flag is derived from a date of birth until registration governance and the clinical safety officer set one in a new configuration version. The flag's mechanism is built and tested with a test configuration. A newborn registered as such (FR-ADM-REG-004, RC-4) will mark the record itself.
Questions for a person¶
None of these stops this session, and each is under "Needs a person" in the pull request.
| # | Question | Owner | What the unit does now |
|---|---|---|---|
| Q-S08-2 | The newborn flag has no age in the specification. Up to what age is a record a newborn's (for example 28 days)? | Registration governance, clinical safety officer | No age assumed: no newborn flag from the date of birth until a configuration version sets newbornAgeDays |
| Q-S08-3 | PR-MPI-001-3 names a configured maximum of search results without a value. | Registration governance (CFG-ADM-003) | 50 (search.maxResults of CFG-ADM-001@1) |
| Q-S08-4 | The score is normalised over the compared attributes, with a minimum evidence weight of 13 (ADR-HIS-053). With the starting weights, this is part of the threshold tuning that governance approves. | HIM and registration governance (CFG-ADM-001, CFG-ADM-002) | As in CFG-ADM-001@1 |
| RC-1-S03 Q3 | Still open: after "unsure", is the new person active or provisional? | Registration governance, HIM | Provisional, following WF-ADM-001, with the review item on the match. An answer of "active" is the setting his.adm.registration.identity-status-after-unsure, with no code change |
Follow-ups outside the card¶
- Service template (
services/_template, a session whose card covers it): bring this unit's kit changes into the template. They are needed by every unit: HisExceptionerrors;- the audit emitter of RC-1-S04, with
resourceVersion,changedFieldsandqueryCriteriaonAuditRecord; PolicyRequestas the ESS DecisionRequest;- the
snappy-javaandlz4-javapins. - Audit catalogue (
services/ess-audit): - register
adm.person.searchas patient-scoped "where a person is returned", or not patient-scoped, with the reason (GAP-ESS-016). A search that returns no one has no patient; - give refusals of
createPersonand of benchmarks a form that the categories accept (no record exists yet).
RC-1-S04 asked the ADM build sessions to register adm.bed.change and adm.record.export. They are in services/ess-audit, a folder this card does not own, and this unit emits neither. That registration belongs to the session that brings beds or exports.
- RC-1-S09 (adm-patient-administration):
- patient-identity.v1 has no operation through which the registration unit hands its demographic changes to adm-identity (INT-ADM-001, "Topic ownership" in the contract README). An ADM contract session adds one as a compatible minor version, or RC-1-S09 records it as its contract change.
- Until then, createPerson takes the demographics at creation, and re-matching runs on identifier changes.
- RC-1-S03 Q2 and Q3 decide what RC-1-S09 sends.
- RC-1-S26 (integrate):
- add adm-identity to e2e/scenarios/RC-1/stack.json;
- set his.adm.tasks.url to the D10 workflow service;
- give the unit a client adm-identity in the realm his (client credentials) for createTask;
- add the synthetic user dev.steward (RC-1-S03 follow-up).
- Callers send X-Purpose-Of-Use. Record access events need a purpose (D10-ESS 9.5); without it the audit service quarantines them.
- D10 clients: the registry of assigning authorities (IF-ESS-007), the configuration service for CFG-ADM-001 to 003 versions and their approvals (IF-ESS-012), the Kemendagri area value set for the NIK check, and the holiday calendar for working days. Each replaces one class (ADR-HIS-053).
- ASM-ADM-002: a way to load the adjudicated sample of the legacy data as a reference data set. Today it is Benchmarks.loadReferenceDataSet, with no API.
- RC-3 (FR-ADM-MPI-004, 005): the steward's decisions set state and adjudication on the match records; merge sets survivor_person_id; the scheduled duplicate scan; ageing and escalation. The downtime reconciliation merges a second No. RM of one person (PR-XRF-001-3).
- Design system: none from this session.