Skip to content

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

Handover RC-1-S07 Build: Reference services (part 2 of 2)

Card: RC-1-S07. Issue: cema-care/his#21. Branch: session/RC-1-S07. Slice: RC-1. Decision record: ADR-HIS-056.

What was built and where

Two modules in services/ess-reference:

  • MOD-ESS-005 in mod-ess-005: master data, the governed store and the change proposals of WF-ESS-005.
  • MOD-ESS-010 in mod-ess-010: the registry and identifier resolution.

They serve every operation of master-data.v1 (19) and registry.v1 (8) at their contract paths, and publish MasterDataChanged (EVT-ESS-007) on his.ess.masterdata.v1. Everything is enterprise-scoped: no operation reads X-Facility. The unit's README.md has the summary; ADR-HIS-056 has the choices.

Part Classes What it does
Schema mod_ess_005 db/mod_ess_005/V1__master_data.sql entity_version: every version of every kind, registry entries included. identifier_index: unique within the authority, never reused. Also proposal, batch_row, domain_register, stewardship_item, idempotent_answer
Ports (mod005.api) EntityKindRules, GovernedEntities, Check, EntityRecord, StewardshipItems, Seeding, Kinds How MOD-ESS-010 contributes the rules of its kinds and reads the store
WF-ESS-005 Governance, Proposals Submit with validation, likely duplicates and dependants; decide (approve or reject) with If-Match, never by the author, never by a service identity; batch with quarantined rows under one approval. New versions are closed into a chain. MasterDataChanged goes out when a version is in force. Audit throughout
Master-data kinds MasterDataRules, Practitioners Organization and location hierarchy (PR-MDM-002-1), parents effective for the whole period, names unique among siblings, facility fixed at creation, localization codes, retirement blocked by active child locations (PR-MDM-002-2), SATUSEHAT flag and stewardship item (PR-MDM-002-4). Practitioners: identifiers, affiliations, SIP, SPK, RKK rules, statuses derived from validity dates, the privilege check and the expiry list
Reads Reads, MasterDataController Version at asOf with ETag; ancestors of a location; versions of an entity; domain register with withoutOwner; redaction of Confidential practitioner fields on the redact obligation
Job MasterDataJob Every 15 s: publishes versions whose start has come, and records lapses and privilege expiries as versions with their status
Registry kinds RegistryRules Authorities (namespace unique and fixed, registered identifier types, format rule), identifier types, naming systems (registered with TerminologyRegistration when hosting is given), external systems, cross-references (target exists, authority code and type completed, source registered, no second cross-reference of one identifier)
Registry reads and resolution Registry, RegistryController Lists and reads at asOf; all identifiers of an entity, from its cross-references and from its own record, current and historical (AC-04); resolution to the entity or unknown; with report, an unknown identifier raises a merged stewardship item
Seeds Seed (seed/master-data.json), RegistrySeed (seed/registry.json) Seeded: the domain register (11 domains, synthetic owners and stewards) and the facility register RSU-01 (Asia/Jakarta) and RSU-02 (Asia/Makassar), each with its organization and patientIdentifierAuthority. Also the identifier types and authorities of contracts/adm/README.md and the Indonesia profile, the naming systems, SATUSEHAT and BPJS Kesehatan. ADM's five code lists and the four ESS value sets that RC-1-S03 and RC-1-S06 named are registered with the terminology service

Build changes: - mod-ess-010 now depends on mod-ess-005 and mod-ess-004, through their api packages only (ModuleBoundaryTest passes). - Its gradle.lockfile was rewritten with ./gradlew dependencies --write-locks. - No new external dependency. - ContractTool (the contract test runner of RC-1-S06) is copied into mod-ess-010/src/test/.../contract/.

Checks and their result

The integration environment ran as HIS_SESSION=RC-1-S07 (his-rc-1-s07), light profile. Node.js is not on this server, so the contract tool ran in node:22.18-bookworm through the test's own runner.

Check Command Result
Build and every test of the unit ./gradlew build in services/ess-reference passed, 163 tests: mod-ess-004 59, mod-ess-005 35, mod-ess-010 39, service-kit 27, app 3
Provider contract test ./gradlew :mod-ess-010:test --tests '*MasterDataContractTest' passed. his-contract verify for each of the 27 operations (documented request, no credential, broken body). validate-event on MasterDataChanged (published, retired, lapsed). The unit's audit events sent to the ESS stub's submitAuditEvent, which recorded no violation
ESS contract (lint, stubs, compatibility with main) pnpm build, pnpm stub, pnpm test in contracts/ess (in node:22.18-bookworm) passed; master-data.v1 1.0 -> 1.1, compatible
Dependency scan platform/delivery-pipeline/bin/dependency-scan services/ess-reference 0 blocking (6 medium)
Image scan platform/delivery-pipeline/bin/image-scan services/ess-reference 0 blocking (15 low, 38 medium)
Static analysis platform/delivery-pipeline/bin/static-analysis services/ess-reference no blocking finding
Secret scan platform/delivery-pipeline/bin/secret-scan code origin/main HEAD, and docs no secret found
Documentation links, site check_links.py, mkdocs build 0 broken; builds

Ends when: - Every acceptance criterion has a passing test: the table below. - The listed test scenarios pass: TEST-ESS-019, 020, 021 and 033, the test classes tagged with them. - The contract tests pass: the provider contract test above. - The change touches only its unit, its contract tests and its migrations. Outside services/ess-reference there are only: - this handover; - ADR-HIS-056 and its row in the decision record index; - the compatible minor change of the ESS contract that GAP-ESS-017 directs (contracts/ess: master-data.v1 1.1, MasterDataChanged descriptions, TRACE.md, stubs).

Requirements and test scenarios

The MOD-ESS-005 tests are in mod-ess-005/src/test/java/care/cema/his/ess/mod005/, the MOD-ESS-010 tests in mod-ess-010/src/test/java/care/cema/his/ess/mod010/. Each class carries the requirement and scenario as JUnit tags, and every display name starts with them.

Requirement Criterion Test
FR-ESS-MDM-001 (TEST-ESS-019) AC-01 every DAT-001 domain has owner, workflow, effective dating GovernedMasterDataTest.ac01RegisterComplete
AC-02 unapproved change: consumers read the prior version (also approved but not yet in force) ac02PriorVersionServed
AC-03 retired entity resolves with name and retired status ac03RetiredResolves
AC-04 event with entity, version, effective period; future version published when in force, once ac04Event
PR-MDM-001-1 and part 13 (approval required, author never approves, service never approves, 412); PR-MDM-001-2 and part 10; PR-MDM-001-3; PR-MDM-001-4; CFG-ESS-020 routes; part 12; idempotency separationOfDuties, validation, withoutOwnerReported, likelyDuplicates, approvalRoutes, audited, idempotent
FR-ESS-MDM-002 (TEST-ESS-020) AC-01 ward resolves to floor, building, campus, organization, in two facilities FacilityRegistriesTest.ac01HierarchyResolves
AC-02 retirement of a ward with active rooms blocked ac02RetirementBlocked
AC-03 each facility's own time zone and locale; invalid zone or currency refused ac03TimeZones
AC-04 as-of structure ac04AsOf
AC-05 SATUSEHAT identifier, or flag and open stewardship item ac05Satusehat
PR-MDM-002-1, PR-MDM-002-3, part 10 (parent not effective, facility immutable, sibling names), part 6.4 childTypeNotPermitted, duplicateIdentifier, parentAndFacility, resources
FR-ESS-MDM-003 (TEST-ESS-021) AC-01 licence validity ends: lapsed, event to MOD-ESS-001, privileges unusable PractitionerRegistryTest.ac01QualificationLapses
AC-02 departed practitioner's name and role at the time ac02Departed
AC-03 external practitioner without account ac03External
AC-04 service with binding and owning unit ac04Service
AC-05 not-held with the missing privilege named ac05PrivilegeCheck
AC-06 SPK expiry: privileges Expired, published ac06SpkExpiry
AC-07 (revised) SIP on the 90-day expiry list; at expiry the SIP and its privileges show Expired, the change names the facility, credential status stays Current; a current SIP elsewhere keeps its privileges ac07SipExpiry, sipExpiryIsPerFacility
AC-08 (new) a Granted privilege group holds a current member at its level, unless the procedure's own entry decides; every holder listed before a group change (GAP-ESS-018 part 2) ac08PrivilegeGroup, groupRules, allHoldersListed
PR-MDM-003-2, PR-MDM-003-3, parts 6.8 to 6.11 (a SIP's expiry ends the privileges at its facility only), part 13 duplicateIdentifier, ac02Departed, appointmentRules, sipExpiryIsPerFacility, releasedByPurpose
FR-ESS-REG-001 (TEST-ESS-033) AC-01 legacy department code resolves RegistryTest.ac01LegacyCode
AC-02 identifier without authority rejected ac02WithoutAuthority
AC-03 unknown practitioner identifier: stewardship item and unknown ac03UnknownReported
AC-04 current and historical identifiers with authority and validity ac04AllIdentifiers
PR-REG-001-2, part 6.8, part 10, bulk load (part 3, 12), part 6.1, part 6.2 uniqueWithinAuthority, bulkLoad, authorities, namingSystems
IF-ESS-007, EVT-ESS-007, IF-ESS-008 Contract of master-data.v1, registry.v1, MasterDataChanged; audit intake contract/MasterDataContractTest

Non-functional targets designed for: - NFR-ESS-007: a policy decision on every request; separation of duties; persons only for decisions; Confidential practitioner fields released by purpose. - NFR-ESS-011: every operation passes the contract tool. - NFR-ESS-015: UTC throughout. Dates of licences end at midnight in the facility's own time zone. - NFR-ESS-016: facility locale, language, time zone and currency held for display. - NFR-ESS-017: logs with correlation; metrics his.masterdata.changes and his.registry.resolutions; traces from the kit.

Differences from the card or specification

  • Emergency override and the medical committee review (FR-ESS-MDM-003 AC-05, part 6.10, TEST-ESS-021) are not done here. master-data.v1 says "refusing the action and any emergency override are the asking domain's". The unit answers not-held with the missing privilege named. The override's audit (ess.mdm.privilege-override) and the review task are for the ordering session (follow-up).
  • The credential expiry list (AC-07, REP-ESS-008) has no operation in master-data.v1. It is a module service, Practitioners.expiring, tested, and its report needs a contract addition later.
  • Privileges are gated per facility (part 6.9, part 6.11): an SPK's privileges end with that SPK, the SIP for its facility, suspension or revocation. A lapsed credential status does not end them, and an expired SIP at another facility does not touch them (review round 1).
  • The end of one facility's SIP acts at that facility only (GAP-ESS-017, part 6.11 as revised). That SIP shows expired, the privileges under that facility's SPK end, and MasterDataChanged goes out with status sip-expired and the facility. The credential status lapses only when a qualification ends. The STR has no validity field in master-data.v1, so "the STR is no longer valid" can be recorded only by the credentialing owner setting credentialStatus to lapsed through a proposal (follow-up).
  • Privilege groups (GAP-ESS-018, part 6.8 as revised, AC-08) are services of category privilege-group with members.
  • The contract changed, compatibly, and only this way, as GAP-ESS-017 directs (session rule 4). master-data.v1 went 1.0 → 1.1 and adds two optional fields: PracticeLicence.status (current, expired) and ServiceReference.members. MasterDataChanged changed in the descriptions of facility and status only. TRACE.md maps the new fields, the stubs are regenerated, and his-contract check against main passes ("1.0 -> 1.1").
  • An SPK, temporary ones included, needs the SIP for its facility. The SPK's expiry is never after the end of that SIP (DE-ESS-011).
  • Author ≠ approver on both routes, which meets part 13 and section 9 rule 5 together (ADR-HIS-056).
  • A proposal carries the whole entity: a change replaces the attributes, it does not merge them.
  • SATUSEHAT identifier of own facilities and units is not mandatory at creation. Which units SATUSEHAT exchange references is not known here, and part 6.8 asks that it be held.
  • Qualification and specialty codes are checked for shape, not against value sets. MOD-ESS-004 has no runtime port for other modules yet (follow-up).
  • Dependants other domains report (part 6.5 dependency check API) have no contract yet. Only the unit's own children are listed.
  • The contracts disagree on the SATUSEHAT IHS namespace. contracts/adm/README.md uses https://fhir.kemkes.go.id/id/ihs and a query example of master-data.v1 uses .../ihs-number. The seed registers ADM's.

Questions for a person

None left. The two questions of review round 1 were answered on issue #21 and recorded in the specification as GAP-ESS-017 (Q1) and GAP-ESS-018 (Q2) by #113. The unit builds them (below).

Review round 1

The review asked for four changes:

  • Privileges at every facility were refused once the credential status was lapsed. Fixed. Practitioners.grant no longer looks at the credential status, only at the privilege and the SPK and SIP of the facility asked (part 6.9, 6.11). The handover's account now matches the code.
  • A test with SIPs at two facilities, one expired. Added: PractitionerRegistryTest.sipExpiryIsPerFacility. The RSU-02 SIP and SPK expire, and the privilege at RSU-01 still holds.
  • Q1 settled by a default. It cannot be settled from the specification, so the session stops on it under rule 3.
  • Q2 settled by a default. Same: the session stops on it under rule 3.

The answers to Q1 and Q2 (after #113)

  • GAP-ESS-017 (Q1, answer b). Practitioners.derive no longer lapses the credential status on a SIP's end; it sets the SIP's status. statusChange names the change sip-expired, and Governance.publish adds the facility whose SIP ended. Tests: ac07SipExpiry (revised AC-07) and sipExpiryIsPerFacility.
  • GAP-ESS-018 (Q2). MasterDataRules validates groups: members are procedures of the list, no groups, at least one, and no members on other services. A change or retirement of a group lists its holders as dependants. Practitioners.grant lets the procedure's own entry decide, then falls back to Granted group entries. RKK codes must be services of the list, groups included. Tests: ac08PrivilegeGroup (AC-08) and groupRules.

Review round 2

The review asked for two changes, both made on this branch:

  • The handover said "No contract was changed." That line is gone. The compatible change of master-data.v1 (1.0 → 1.1) is the one contract change, recorded under "Differences" and in "Ends when".
  • The holders of a privilege group were cut at 200. Practitioners.holders now reads page by page until the last page, so every holder is listed as a dependant before a group is changed or retired (GAP-ESS-018 part 2). Test: PractitionerRegistryTest.allHoldersListed (seven holders, read in pages of three).

ADR-HIS-056 awaits approval by the Enterprise Architecture Board (it is under "Needs a person" in the pull request).

Follow-ups outside the card

  • The ordering, scheduling and documenting sessions (D03, D01): at order time and again at scheduling or performance, call checkPractitionerPrivilege. Refuse on not-held. On an emergency override with the reason "Emergency, no current privilege", audit it (ess.mdm.privilege-override) and raise the medical committee review task (MOD-ESS-008, within 7 days).
  • RC-1-S16 and RC-1-S17 (policy decision service): rules for the actions and resource types in the unit's README:
  • the steward's assignment by stewardIds and the owner by ownerId;
  • the route in approvalRoute;
  • domainHasOwner for PR-MDM-001-3;
  • the redact obligation on practitioner reads for purposes without release.
  • MOD-ESS-001 (identity unit): consume MasterDataChanged with status lapsed (suspend the account and its roles) and sip-expired with facility (suspend the dependent roles at that facility only), BR-ESS-003, GAP-ESS-017.
  • ESS contract owners: an STR validity or status field (GAP-ESS-017 part 2, "the STR is no longer valid"), as a later compatible minor version.
  • MOD-ESS-011 (data governance): take over StewardshipItems, with owners and routing.
  • ESS contract, a later minor version of master-data.v1:
  • the credential expiry list (REP-ESS-008);
  • the dependency check API of part 6.5;
  • registration of a master-data domain and owner change (audited events of part 12, now seed only).
  • MOD-ESS-004: a runtime validation port for other modules, so that qualification, specialty and service codes are validated against their value sets.
  • RC-1-S26 (integrate): add ess-reference to e2e/scenarios/RC-1/stack.json; the seed already holds the stub facilities and ADM's authorities.
  • Service template: a shared ContractTool (now copied in two modules of this unit); explicit bean names for module beans whose simple class names repeat across modules (Access, Store, Idempotency).
  • ADM contract owners: settle the IHS namespace (ihs or ihs-number).
  • Design system: none from this session.