Skip to content

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

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

Card: RC-1-S06. Issue: cema-care/his#20. Branch: session/RC-1-S06. Slice: RC-1. Decision record: ADR-HIS-051.

What was built and where

The unit services/ess-reference, made from the service template. This was the first session on the unit, so it ran services/_template/new-unit.sh ess-reference MOD-ESS-004 MOD-ESS-005 MOD-ESS-010. - mod-ess-005 and mod-ess-010 are the empty modules of the template, for RC-1-S07. - The unit's README.md describes the modules, the build and how this unit's kit differs from the template.

MOD-ESS-004 Terminology Service in mod-ess-004, serving every operation of terminology.v1 (IF-ESS-006, 19 operations) at its contract path. All of them are enterprise-scoped, so none reads X-Facility.

Part Classes What it does
Schema mod_ess_004 db/mod_ess_004/V1__terminology.sql artifact (registered code systems and value sets), version (DE-ESS-008 and DE-ESS-009 with the section 4.3 lifecycle and revision), concept, stewardship_item, idempotent_answer
Registration api/TerminologyRegistration, CatalogueService The port through which MOD-ESS-010 registers code systems and value sets (FR-ESS-TRM-001 part 4). Value set binding behaviour follows the safety class (CFG-ESS-012). Audited
Catalogue CatalogueService listCodeSystems, listCodeSystemVersions, listValueSets. The current version is the one in force now
Authoring AuthoringService, ImpactAnalysis Create (duplicate codes refused with line detail, licence statement required, registration required), the impact report, submit, second review, return, approve, rollback, retire. Activation at the effective time with the prior version superseded. TerminologyPublished on his.ess.terminologyartifact.v1. Export of a published version
Runtime RuntimeService, Resolver, Units Lookup, validation against a version, an as-of date or a value set (with its binding behaviour), expansion with paging and text filter, UCUM validation and commensurability, binding validation for the pipeline, failure reports
Local copy api/LocalTerminologyCopy The caller-side read-only copy of FR-ESS-TRM-002 part 6.6: validates from the export with the copy's version, flags staleness (CFG-ESS-011, 24 h) and says when TerminologyPublished calls for a refresh
Stewardship StewardshipItems (port), JdbcStewardshipItems Items merged per code, code system and source, with a count. Held here until MOD-ESS-011 exists, as RC-1-S01 asked
Duties Access, Idempotency, Refusal, TerminologyAdvice, ActivationJob One policy decision per request; Idempotency-Key replay of the original answer; If-Match on the revision; 400 refusals with field pointers; the activation job

The rules that are a choice, not a quotation of the specification, are in ADR-HIS-051: - resolution by effective period; - the registration port; - the unit as store of record, with HAPI FHIR as the RC-3 facade; - stewardship severity; - the impact report's resolution rule; - the Java contract test runner.

This unit's copy of the kit differs from the template in three places (unit README): - ProblemAdvice now goes ahead of Spring Boot's problem-details handler and answers framework errors as Problems. Before this, a malformed body was answered without type and code, and his-contract verify failed every unit made from the template on that case. - AuditEmitter and AuditRecord send the payload of the audit intake schema, as RC-1-S04 did for services/ess-audit: no nulls, beforeAfter, no emittedTime, schemaversion 1.0, plus the item version and the category fields of D10-ESS 9.5. - Constraints raise snappy-java to 1.1.10.9 and lz4-java to 1.11.4. The dependency and image scans blocked on CVE-2026-93451, CVE-2026-108106 and CVE-2026-106451 (HIGH) in transitive dependencies of kafka-clients.

Dependency added: org.fhir:ucum 1.0.10 (BSD-3-Clause, no runtime dependencies), in gradle/libs.versions.toml and mod-ess-004/build.gradle.kts. All lockfiles of the unit were rewritten with ./gradlew dependencies --write-locks.

Checks and their result

The integration environment ran as HIS_SESSION=RC-1-S06 (his-rc-1-s06), 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, 91 tests: mod-ess-004 59, service-kit 27, app 3, mod-ess-005 1, mod-ess-010 1. The kit's Kafka test runs on the full profile only
Provider contract test ./gradlew :mod-ess-004:test --tests '*TerminologyContractTest' passed: his-contract verify for each of the 19 operations (documented request, no credential, broken body); his-contract validate-event on TerminologyPublished for an activation and a rollback; the unit's audit events against the ESS stub's submitAuditEvent with no violation, and a planted null caught
Dependency scan platform/delivery-pipeline/bin/dependency-scan services/ess-reference 0 blocking (6 medium), after the constraints above
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 no secret found
Documentation links python3 docs/implementation_plan/tools/check_links.py 0 broken
Documentation site mkdocs build builds

One run of the full build had a failure in the kit's HttpPolicyDecisionClientTest (a Permit read within the 250 ms policy timeout). The test passed alone three times and in the following full builds. It is timing-sensitive under a loaded build (follow-up for the template).

Ends when: - Every acceptance criterion has a passing test: the table below. - The listed test scenarios pass: TEST-ESS-015 and TEST-ESS-016, the test classes tagged with them. - The contract tests pass: the provider contract test above. - The change touches only its unit, plus its contract tests and migrations. Outside services/ess-reference there is only this handover, ADR-HIS-051 and its row in the decision record index.

Requirements and test scenarios

Tests are in services/ess-reference/mod-ess-004/src/test/java/care/cema/his/ess/mod004/. The test classes carry the requirement and scenario as JUnit tags, and every display name starts with them.

Requirement Criterion Test
FR-ESS-TRM-001 (TEST-ESS-015) AC-01 new release at current once effective; pinned lookups still succeed GovernedVersionsTest.ac01PublishRelease
AC-02 release inactivating a code in an active value set blocked; impact report lists it ac02InactivationBlocked
AC-03 owner, approver, approval time, effective period ac03PublishedRecord
AC-04 as-of expansion returns the membership then ac04AsOfExpansion, RuntimeServicesTest.expansionKeepsInactiveMembers
AC-05 decision-support value set blocked until a second steward reviews ac05TwoPersonReview
AC-06 Fornas addendum member from the decree's date; earlier date tests against the prior version ac06FornasAddendum
PR-TRM-001-1, -3, -4; part 4; part 10 (duplicate, author approves, unresolvable reference); part 11 (rollback, retire, return); part 12 (audit); parts 3 and 13 (policy, persons) publishedImmutable, licensedWithoutStatementRefused, pinnedValueSetUnchanged, unregisteredRefused, duplicateCodeRefused, approverIsAuthor, unresolvableValueSetReference, rollbackAndRetire, returnToAuthor, audited, policyAndPersons, safetyClassNotLowered, classConfirmedByClinicalGovernance (part 6.10), effectiveNotBeforeApproval, concurrencyAndIdempotency
FR-ESS-TRM-002 (TEST-ESS-016) AC-01 inactive code is inactive, with the binding's reject or flag RuntimeServicesTest.ac01InactiveCode
AC-02 code valid in an earlier version, as of a date in its period ac02AsOf
AC-03 invalid unit invalid with reason ac03Units
AC-04 service unreachable: local copy validates and records its version ac04LocalCopy
AC-05 binding to a non-existent value set fails ac05Bindings
PR-TRM-002-2, -3, -4; parts 6.1, 6.2, 6.4, 6.5, 6.7, 10, 12 unknownCode, ac04LocalCopy (stale), notLicensed, lookupCarriesVersion, notInValueSet, expansionPaging, failureReports, errors, lookupsNotAudited, problems
IF-ESS-006, EVT-ESS-006 Contract of terminology.v1 and TerminologyPublished; audit intake (IF-ESS-008) contract/TerminologyContractTest (verify for each operation, events, auditEventsMeetIntakeSchema, coversEveryOperation)

Non-functional targets designed for: - NFR-ESS-007: policy on every request; separation of duties; persons only for approvals; no patient data in requests. - NFR-ESS-011: every operation passes the contract tool. - NFR-ESS-015: UTC throughout, with a 5 s skew tolerance on effective times. - NFR-ESS-017: logs with correlation, metrics his.terminology.validation.failures and his.terminology.failure.reports, traces from the kit. - NFR-ESS-016 (localization): displays are single-language, as terminology.v1 has no designations (follow-up).

Differences from the card or specification

  • No contract was changed.
  • Registration of code systems and value sets is a Java port, not an API operation, because terminology.v1 has none (ADR-HIS-051). The registry module of RC-1-S07 calls it. Until then, an environment holds terminology content only after registration through the port.
  • "Explicitly accepted" impacts (PR-TRM-001-2, WF-ESS-004 exception) have no operation in terminology.v1. A use is resolved only by a later value set version that drops the code, so publication stays blocked until then: the restrictive side (Q2).
  • Safety class confirmation (part 6.10, review round 1). Clinical Governance confirms the class at first publication. So approving a first publication, or a version that changes the class, needs the approver to be permitted ess.trm.safety-class.confirm by the policy decision point. Otherwise the approval is refused with 403. The version records who confirmed, and the audit event names them.
  • "At least one of author and second reviewer is clinically qualified" (part 6.11) is decided by the policy decision point, which holds that subject attribute (DEC-ESS-008). The unit sends the author as an attribute, and enforces the other separation rules itself.
  • contentRef (the D02 storage channel, RC-2) is accepted and stored. The impact report blocks such a draft until its content is loaded.
  • A rollback with no earlier version is refused, and the version is retired instead. Section 4.3 restores "the version it superseded", and there is none.
  • Retiring: an Active version is retired from now or later, never retroactively. A Superseded version keeps the end it already has.
  • An expansion returns the membership as defined (AC-04, review round 1), inactive members included. Validation answers inactive for them, and the binding rejects or flags them. The export of a value set version states each member's real status.
  • Stewardship items: severity follows CFG-ESS-027 with part 6.11 (review round 1).
  • Critical for Safety-relevant content, whose binding rejects the code and so blocks the data, and for content nobody has classified yet.
  • Medium for Standard content, whose binding accepts the code with a flag.
  • A merged report never lowers it.
  • An unregistered code system named in a lookup or validation raises an item per caller (FR-ESS-TRM-002 part 10).
  • A named version wins over asOf when a request gives both, as the contract's documented requests do.

Questions for a person

One question is left. It does not block this session; it is posted on issue #20 and listed under "Needs a person" in the pull request.

# Question Owner What the unit does now
Q2 PR-TRM-001-2 lets publication go ahead when each use is "resolved or explicitly accepted". Should acceptance be possible in RC-1 (UI-ESS-007), and by whom? terminology.v1 has no operation for it Terminology owner No acceptance; a use is resolved by a later value set version that drops the code. Publication stays blocked until then

Q1, Q3 and Q4 of the first round are no longer questions. The review (round 1) asked that they be settled from the specification, and they now are (differences above): - Q1 by part 6.10's "Clinical Governance confirms it at first publication"; - Q3 by AC-04's "the membership effective on that date"; - Q4 by CFG-ESS-027 with the reject or flag rule of part 6.11.

Review round 1

The review asked for four changes, all made on this branch: - the three questions above settled from the specification rather than by the session's own choice; - the safety class confirmed only by someone the policy lets act for Clinical Governance (ess.trm.safety-class.confirm), not by any approver: GovernedVersionsTest.classConfirmedByClinicalGovernance; - expansions no longer leave out inactive members: RuntimeServicesTest.expansionKeepsInactiveMembers; - stewardship items get Critical where a Safety-relevant binding blocks the data: RuntimeServicesTest.failureReports.

Follow-ups outside the card

  • RC-1-S07 (this unit, MOD-ESS-005 and MOD-ESS-010):
  • call TerminologyRegistration from the registry when a naming system's content is hosted by terminology;
  • register the code systems and value sets other sessions named: the ADM identifier systems and code lists of contracts/adm/README.md, the value sets urn:his:ess:identifier-type, administrative-sex, kemendagri-area and relationship, task priority and purpose of use (RC-1-S01, RC-1-S03).
  • RC-1-S16 and RC-1-S17 (policy decision service): rules for the actions and resource types of services/ess-reference/README.md. They include the steward assignment (stewardId), clinical qualification for the second review (authorId), licence terms (ess.trm.licensed-content.read) and who acts for Clinical Governance in ess.trm.safety-class.confirm. Without that rule no first publication can be approved.
  • RC-1-S26 (integrate): load synthetic terminology through the registry and the authoring operations; add ess-reference to e2e/scenarios/RC-1/stack.json.
  • Service template (services/_template, a session whose card covers it):
  • bring in the three kit changes of this unit (problem ordering and framework errors, the audit intake payload with category fields, the snappy-java and lz4-java constraints);
  • make HttpPolicyDecisionClientTest independent of load;
  • consider adding ContractTool, the contract test runner, for every unit;
  • T2 of RC-1-S01 (patientRef and encounterRef, absent fields left out in PolicyRequest) is still open in this unit's kit.
  • ESS contract, a later minor version of terminology.v1:
  • change or withdraw a draft (a returned draft can only be replaced by a new version string today);
  • accept an impact (Q2);
  • designations per language (NFR-ESS-016);
  • concept maps and translation (FR-ESS-TRM-003).
  • MOD-ESS-011 (data governance): an adapter for StewardshipItems, triage of severity, and the notification to the reporter on resolution.
  • D02 storage channel (RC-2): load contentRef content; large releases (LOINC, SNOMED CT) need it rather than inline JSON.
  • FHIR facade (RC-3): $lookup, $validate-code and $expand over these services (technology stack rows 20 and 21).
  • Registered bindings: PR-TRM-001-2 also names registered bindings, which no session yet records. They join the impact report when they exist.
  • Design system: none from this session.