Implementation plan / Session plan / Handover RC-4-S03
Handover RC-4-S03 Build: Patient administration¶
Card: RC-4-S03. Issue: cema-care/his#170. Branch: session/RC-4-S03. Slice: RC-4. Decision record: ADR-HIS-122.
Comes after RC-4-S01, whose contracts it serves: registration.v1 1.2, with contract points 1 to 6 of RC-4-S03 in contracts/adm/README.md. It also comes after RC-3-S08, and extends what RC-1-S09 built in MOD-ADM-002. As a client, it uses patient-identity.v1 1.3. No contract was changed.
What was built and where¶
All of it is in services/adm-patient-administration, plus ADR-HIS-122 and this handover. The unit's README.md is updated: its modules, settings, stand-ins, and what waits on adm-identity.
| Module | What was added |
|---|---|
mod-adm-002 (FR-ADM-REG-004) |
SpecialIdentities, with three operations of web/RegistrationController:
Placeholders: TANPA NAMA <facility>-<yymmdd>-<nnn>, from a sequence per facility and day, reserved by Idempotency-Key (ADR-HIS-122 point 1).Names and Demographics: a legal name change needs an evidence reference and a reason. The former official name is kept as use old, its period ended the day before the effective date. Aliases are added beside the legal name and never replace it. A correction is not a legal name change.FieldSets: the new field set newborn, selected by encounter type newborn-care. Placeholder names and estimated dates of birth count as outstanding (FieldSets.captured), and Registrations.completeRegistration applies the same rule: no completion as complete under a placeholder, and a partial completion keeps the name and date of birth outstanding.RegistrationStore: the placeholder, observation and newborn are stored on the registration. listRegistrations can filter by identityStatus. The registration's identity status follows identification (active) and the merge (merged, from the PatientMerged subscription registration-merges in Mod002Module).DemographicStore: Provenance.evidenceReference.api: PersonIndex.resolveIdentifier and reportIdentityWorkItem, implemented in clients/HttpPersonIndex, and the port EncounterLookup.Migration V2__special_identity_cases.sql: the registration's new columns, evidence_reference, related_encounter, and the tables placeholder_sequence, placeholder_name and identity_reconciliation |
mod-adm-004 (AC-03) |
Encounters: readEncounter of a merged identity answers the survivor as patient, with resolvedFromPatient, and asks the decision point about the survivor. listEncounters by patient includes every identity merged into the patient (MergeLinks.retiredInto, recursive; EncounterStore.listOfPersons). No row moves.EncounterPatients implements mod002.api.EncounterLookup, which checks that the mother's encounter is hers |
mod-adm-002 test fixtures |
FakePersonIndex serves patient-identity.v1 1.3:
AdmTestSupport gains the builders unidentifiedRegistration, registerUnidentified, newbornRegistration and reconciliationReason |
app |
The provider contract test also covers the 3 new operations (265 cases, 13 more than before). The consumer contract test covers the 1.3 calls (specialIdentities). SpecialIdentityJourneyTest covers AC-01 and AC-03 across MOD-ADM-002 and MOD-ADM-004, and the mother's encounter |
Events: PatientRegistered for each unidentified patient and each baby, on his.adm.patientregistration.v1. The unit now also consumes PatientMerged on his.adm.person.v1 to mark registrations merged.
Policy: CREATE on adm.Registration with the label unidentified-patient or mother-infant-link in attributes.labels. create-mother-unknown on adm.Registration. CREATE on adm.IdentityReconciliation. Every refusal is audited.
Lockfiles: unchanged. No dependency was added.
Checks and their result¶
The integration environment ran as HIS_SESSION=RC-4-S03 (his-rc-4-s03), light profile. Every check below passed on the branch after origin/main was merged into it on 2026-12-02.
| Check | Command | Result |
|---|---|---|
| Build, unit, module and contract tests | ./gradlew build in services/adm-patient-administration |
passed: 244 tests, 0 failed, 1 skipped (the existing KafkaEventTransportTest, which needs the full profile) |
| Provider contract | ProviderContractTest (his-contract verify of every operation, including the facility denial cases) |
passed: 265 cases, 0 failed; the published events pass validate-event |
| Consumer contract | ConsumerContractTest against his-contract serve of contracts/adm (patient-identity.v1 1.3), ess and fin |
passed, no violation recorded |
| Secret scan | platform/delivery-pipeline/bin/secret-scan code origin/main |
no secret found |
| Documentation | check_links.py, mkdocs build |
passed |
Requirements and test scenarios¶
| Requirement, criterion or rule | Test (class, method) |
|---|---|
| FR-ADM-REG-004 AC-01, PR-REG-004-1 (TEST-ADM-009) | UnidentifiedPatientTest.provisionalIdentityWithoutDuplicateCheck (with the matching engine down); unavailableThenRetried; placeholderIsNotCaptured (completeRegistration); SpecialIdentityJourneyTest.encounterFollowsTheMerge (the encounter opened at once) |
| FR-ADM-REG-004 AC-02, PR-REG-004-1 (TEST-ADM-033) | UnidentifiedPatientTest.simultaneousArrivals: twelve concurrent arrivals at two facilities |
| FR-ADM-REG-004 AC-03, PR-REG-004-2, PR-REG-004-3 (TEST-ADM-009) | SpecialIdentityJourneyTest.encounterFollowsTheMerge; IdentityReconciliationTest.existingPersonRoutedToSteward, possibleMatchRouted, completedInPlace |
| FR-ADM-REG-004 AC-04, PR-REG-004-4, DEC-ADM-002 (TEST-ADM-033) | NewbornRegistrationTest.twins, birthOrderRequired, allOrNone, namedAndUnnamed, motherRequiredOrUnknown, placeholderIsNotCaptured; SpecialIdentityJourneyTest.mothersEncounter |
| FR-ADM-REG-004 AC-05, BR-ADM-022 (TEST-ADM-009) | LegalNameAndAliasTest.legalNameChange, evidenceRequired, aliases |
| BR-ADM-003, BR-ADM-022 (an identifier another patient holds) | IdentityReconciliationTest.identifierOfAnotherPerson |
| Parts 7, 10 and 12: validation, decision point, outage, idempotency, audit | UnidentifiedPatientTest.validationAndPolicy; IdentityReconciliationTest.rulesAndPolicy; NewbornRegistrationTest.motherRequiredOrUnknown |
| NFR-ADM-005 Security | Every operation goes through the decision point, with the Sensitive labels. Refusals are audited (tests above). The pipeline's scans run on the pull request |
| NFR-ADM-009 Interoperability | ProviderContractTest, ConsumerContractTest |
| NFR-ADM-012 Observability | The kit's correlation identifier, logs and traces on every call. Every audit event carries the endpoint and the correlation identifier; the tests assert the endpoint |
| NFR-ADM-013 Localization | The placeholder date and "today" come from his.adm.time-zone. The patterns are configurable by registration governance (ADR-HIS-118 point 4) |
| NFR-ADM-014 Time integrity | UTC instants are stored. The day of the placeholder sequence, the effective date of a legal name change and a birth time not in the future are judged in the facility's zone (legalNameChange checks the period end in Asia/Jakarta) |
The tests tag FR-ADM-REG-004 and their TEST identifier. TEST-ADM-009 and TEST-ADM-033, the verification of the safety-critical function, pass.
The RC-4 end-to-end scenarios (e2e/scenarios/RC-4, RC-4-E2E-001 and 003 exercise this unit) list no unit yet. RC-4-S06 (integrate) adds the units once adm-identity serves patient-identity.v1 1.3. This card does not own e2e/, so "the listed test scenarios pass" is met by TEST-ADM-009 and TEST-ADM-033 above.
Safety-critical function "Unidentified and newborn registration"¶
This card implements the control of D01-ADM 11.1. The hazard is records attached to the wrong identity, or siblings confused. The control is unique provisional identities, the mother link with birth order, and reconciliation by the steward only.
- Unique provisional identities. Placeholder names are unique per facility and day, even under concurrency, and each patient gets a person and No. RM of their own. The placeholder name carries no observed or clinical detail. A retry never makes a second person.
- Mother link with birth order. It is required for a multiple birth, with distinct orders. Every baby of a birth is saved or none. A newborn is never matched for merge automatically: the exclusion flags are set by adm-identity, and its candidates become review items.
- Reconciliation by the steward only. Reconciliation to an existing person is always a work item for the steward. The complete path also routes any candidate not plainly a non-match. Records follow the steward's merge by link, and the temporary identifiers stay resolvable.
The control is built as specified. Two choices make it stricter, not weaker, and are recorded in ADR-HIS-122: the routing of point 5, and placeholders and estimates counting as outstanding (point 3). The placeholder sequence keeps its purpose but not the contract point's "same transaction" (point 1). The hazard log is the clinical safety register (architecture section 13), outside the repository. The clinical safety officer should note these three points in its entry when reviewing the merged work.
Done differently from the specification or contract¶
- Placeholder sequence (contract point 1, "taken in the same transaction as the registration"): reserved by Idempotency-Key in a transaction of its own, before adm-identity is called. Uniqueness is kept, and a gap in the day's numbers is possible. Reason: the person must carry the name before the registration exists, and a transaction cannot span the call to adm-identity (ADR-HIS-122 point 1).
- Routing of a complete reconciliation (contract point 3 names
same,unsureand the review band): a high-confidence or flagged candidate is also routed, even if answereddifferent(ADR-HIS-122 point 5). - The consent gate does not apply to registerUnidentifiedPatient or registerNewborn. It applies at completeRegistration (ADR-HIS-122 point 4).
- A correction of the official name (
correction: true) is not treated as a legal name change: it needs no evidence reference, and no former name is kept (part 6.6).DemographicProvenanceTest.reasonRequired, written by RC-1-S09, now also expects the evidence reference for a legal name change. - mothersName of a baby is set from the mother's official name.
Questions left for a person¶
None that blocked the work. The reviews are under "Needs a person" in the pull request.
Follow-ups outside this card¶
- adm-identity must serve patient-identity.v1 1.3 before RC-4-S06:
createPersonwithidentityStatus: unidentifiedornewborn,recordDemographicChangewithidentified,resolveIdentifier,reportIdentityWorkItem. No RC-4 card builds it (RC-4-S01's handover asks for a card). Until then the three new operations cannot complete against the real index. - D10 registrations (RC-1-S16), besides those the contract points list (resource type
adm.IdentityReconciliation, actioncreate-mother-unknown, the code lists, the encounter typenewborn-care): the privacy label codesunidentified-patientandmother-infant-link; the field setnewbornin CFG-ADM-004 when IF-ESS-012 replaces the stand-inFieldSets. - Screens (Domain 1 screen sessions): show the status "Unidentified" and the placeholder in the identity zone (safety duty), and the worklist of unidentified patients through
listRegistrations?identityStatus=unidentified.