Implementation plan / Session plan / Handover RC-3-S15
Handover RC-3-S15 Build: Platform: integration engine (part 1 of 2)¶
Card: RC-3-S15. Issue: cema-care/his#71. Branch: session/RC-3-S15. Slice: RC-3. Decision record: ADR-HIS-111.
What was built and where¶
Everything is in platform/integration-engine/, except:
- the decision record (its row in the decision record index is written on main after the merge);
- one proposed entry of the dependency register (platform/supply-chain/register/dependencies.toml, see "Differences");
- this handover.
The unit's README.md describes every part, setting and metric.
Scope as read. The card covers three requirements of MOD-ISE-003 and their test scenarios TEST-ISE-010 to 013: - FR-ISE-INT-001, the engine; - FR-ISE-INT-002, the interface registry and onboarding; - FR-ISE-INT-003, HL7 v2 and FHIR with jurisdiction packs.
It meets the contract point of RC-3-S15 in contracts/ise/README.md, except where "Differences" says otherwise. Replay, reconciliation and the retry policy's finer points are part 2 (RC-3-S16). No session ran on this unit before; the folder held only its README.
What was built:
- The unit ise-integration-engine, made once from the service template: services/_template/new-unit.sh --into platform/integration-engine ise-integration-engine MOD-ISE-003.
- Module mod-ise-003, package care.cema.his.ise.mod003, schema mod_ise_003, migration V1__integration_engine.sql, database ise_integration_engine, image his/integration-engine.
- It serves 21 operations of contracts/ise integration.v1:
- the registry: listInterfaces, registerInterface, readInterface, updateInterface, transitionInterface;
- health: listInterfaceHealth;
- transactions: listTransactions, readTransaction, requestPayloadView;
- the quarantine worklist: listMessageExceptions, readMessageException, assignMessageException, closeMessageException;
- file transfers: listFileTransfers, readFileTransfer, createDownloadLink;
- conformance: listConformancePacks, readConformancePack, recordConformanceRun, listConformanceRuns, readConformanceRun.
- It publishes InterfaceStatusChanged (EVT-ISE-004) on his.ise.interface.v1, and InterfaceMessageQuarantined (EVT-ISE-001) and InterfaceMessageDeadLettered (EVT-ISE-002) on his.ise.deliveryexception.v1.
- The engine:
- Outbound: Domain 1's events, read through the subscriptions adm-encounter and adm-person, become HL7 v2.5.1 ADT messages. The mapping is adm-events-to-hl7v2-adt 1.0 (A01, A02, A03, A08, A11, A12, A13, A21, A22, A38, A40), as the table of contracts/adm README maps the events.
- The worker sends them over MLLP and mutual TLS 1.3 after checkNodeCertificate. It retries per the registration's policy, keeps order per patient, queues while the interface's circuit is open, and dead-letters when attempts are exhausted.
- Inbound: a listener stores each message, encrypted, before acknowledging it. It authenticates the node, validates MSH-9, MSH-10, MSH-12, the structure and the assigning authorities, NACKs and quarantines what fails, acknowledges a duplicate MSH-10 without reprocessing, and routes valid messages unchanged to their target interfaces.
- The registry: the lifecycle of D02-ISE 4.3, with every precondition of FR-ISE-INT-002. The Release Manager's production approval is a signed step-up. A suspension names its impact. Every change is audited with before and after values.
- The FHIR R4 facade at /fhir/r4: metadata, Patient read, PDQm search (queryDemographics), PIXm $ihe-pix (crossReferenceIdentifier), Encounter read, $validate and StructureDefinition read. The core profiles are his-patient and his-encounter, and bindings are checked with the D10 terminology service.
- Managed file transfer over SFTP with the interface's key and the known host key. Each file goes with a .sha256 file; the engine records the .ack file, alerts on Missed, Unacknowledged and Failed, keeps encrypted copies 30 days, and serves 24-hour download links.
- The Indonesia pack id-satusehat (DEC-ISE-010) as data: SATUSEHAT Patient and Encounter profiles and 5 tests. It is installed, enabled by his.integration.packs.enabled.
- The automated conformance suite: the HL7 v2 test pack (26 cases), the core FHIR profiles (8), and each pack's tests. It runs on every build, and writes its runs to mod-ise-003/build/conformance-runs/ for the pipeline to record.
Checks and their result¶
The checks ran on the host (JDK 21.0.13, Docker 29.9) with the light integration environment of this session (HIS_SESSION=RC-3-S15). Node.js for the contract tool ran in the pinned node:22.18-bookworm image, since the host's Node.js cannot strip TypeScript.
| Check | Command | Result |
|---|---|---|
| Unit build and every test | ./gradlew build in platform/integration-engine |
passed. Module: 57 tests, 4 of them the contract tests. App: 3. Kit: every test |
| Provider contract test | contract/IntegrationContractTest.providerContract |
his-contract verify contracts/ise of the 21 operations, from the example states: passed. validate-event of InterfaceStatusChanged, InterfaceMessageQuarantined and InterfaceMessageDeadLettered as published: passed |
| Consumer contract tests | IntegrationContractTest.iseConsumer, admConsumer, essConsumer |
checkNodeCertificate and readContractVersion against his-contract serve contracts/ise; readPerson, crossReferenceIdentifier, queryDemographics, readEncounter against serve contracts/adm; validateCode against serve contracts/ess: no violation |
| Dependency scan and register coverage | platform/delivery-pipeline/bin/dependency-scan platform/integration-engine |
0 blocking (4 medium); gate --coverage passed over 535 components |
| Image build and scan | platform/delivery-pipeline/bin/image-scan platform/integration-engine |
0 blocking (15 low, 117 medium, the JRE base) |
| Static analysis | platform/delivery-pipeline/bin/static-analysis platform/integration-engine |
no blocking finding; no clinical artifact |
| Secret scan | secret-scan code origin/main HEAD, secret-scan docs origin/main HEAD |
no secret. A first run flagged a synthetic paging token in a test as a generic API key. The token became page-2 and the commits were folded before any push |
| Dependency register | platform/supply-chain/bin/supply-chain register check; register guard --base origin/main on session/RC-3-S15 |
passed; passed (one entry proposed, none approved) |
| Documentation | check_links.py; mkdocs build |
0 broken, 0 duplicate anchors; builds |
Requirements and test scenarios¶
Every test names its requirement and, where one exists, its scenario: a JUnit @Tag and a display name. The tests are in platform/integration-engine/mod-ise-003/src/test/java/care/cema/his/ise/mod003/.
| Requirement, criterion or scenario | Covered by |
|---|---|
| FR-ISE-INT-001 AC-01: no external engine | The engine is this unit. EngineTest.normalAsynchronousDelivery and every other test exchange through the unit alone (no Camel, no Mirth) |
| AC-02: a synchronous and an asynchronous interface under normal, retry and outage conditions | Asynchronous: EngineTest.normalAsynchronousDelivery, retryThenAcknowledged (AE, then a timeout, then AA), outageQueuesThenDelivers (circuit opens, no attempt spent while open, delivered after), exhaustedDeadLetters, sourceOutageHolds, suspendedOutboundHolds, missingMappingHolds. Synchronous: SynchronousPeerTest.timeoutAndCircuitBreaker and refusalIsNotAnOutage, FhirFacadeTest.readPatient and synchronousOutageAndRefusal |
| AC-03, PR-INT-001-2: an invalid message quarantined with its reason and a replay path, not processed | EngineTest.invalidInboundQuarantined, MessageExceptionsTest.assignAndClose |
| PR-INT-001-1, PR-INT-001-3, PR-INT-001-4 | EngineTest.unregisteredSourceRefused, unroutableQuarantined, unmappableQuarantined |
| AC-04: correlation, business identifiers, mapping version and acknowledgement on every delivered message | EngineTest.normalAsynchronousDelivery |
| AC-05, part 11: managed file transfer | Outbound: FileTransferTest.transferredAndAcknowledged, missedAndUnacknowledgedAlert, failedAfterRetries, unknownHostKeyRefused, downloadLink. Inbound: inboundReceivedAndAcknowledged, inboundChecksumMismatchAndMissed |
| Part 6: orchestration of multi-step exchanges with explicit state, timeouts and compensation | OrchestrationTest.stepsInOrderThenCompleted, failedStepCompensated, timedOutStepWithdrawnAndCompensated, compensationFailureAlerts, definitionsChecked |
| Part 4, architecture 7.5: routing by facility | EngineTest.outboundRouteKeepsToItsFacility, inboundRouteKeepsToItsFacility |
| Parts 2, 7, 9, 10, 13: store before acknowledgement, state history, original payload, health telemetry, payload view under its own permission | EngineTest.validInboundRoutedOnceAndDuplicateAcknowledged, normalAsynchronousDelivery, healthPerInterface, payloadViewNeedsItsOwnPermission |
| Section 12: exchanges of patient data audited | ise.exchange.sent/received in EngineTest and FhirFacadeTest.readPatient |
| TEST-ISE-010 (synchronous and asynchronous interfaces under normal, retry and outage; invalid and unroutable messages quarantined) | The EngineTest and SynchronousPeerTest cases above, FhirFacadeTest.synchronousOutageAndRefusal |
| FR-ISE-INT-002 AC-01, parts 3 and 6: a new partner of a certified type by configuration alone | RegistryTest.newPartnerByConfigurationOnly: onboarded through the API, the certified mapping reused, traffic delivered |
| AC-02, BR-ISE-002, section 10: activation refused with a missing attribute | RegistryTest.missingAttributeRefusesActivation, unapprovedAuthenticationRefused, activationNeedsReachableEndpointAndPublishedContract |
| AC-03: the interface inventory | RegistryTest.inventory |
| AC-04, PR-INT-002-2: traffic on a suspended registration refused and logged | RegistryTest.suspendedRegistrationRefusesTraffic |
| PR-INT-002-1, PR-INT-002-3, parts 2, 4, 7, section 11 | RegistryTest.lifecycleToActive, newContractVersionNeedsCertification, deprecateAndRetire, blankSignatureRefusedOnce |
| Sections 3, 12, 13: actors, audit, Confidential attributes | RegistryTest.lifecycleToActive, policyOnEveryAction, confidentialAttributesHidden |
| TEST-ISE-011 (onboarding by configuration; activation with missing attributes refused; traffic on a suspended registration refused) | RegistryTest.newPartnerByConfigurationOnly, missingAttributeRefusesActivation, suspendedRegistrationRefusesTraffic |
| FR-ISE-INT-003 AC-01: the automated conformance suite passes | ConformanceSuiteTest.hl7v2Pack, fhirCorePack, failedOrNotRunIsFailed |
| AC-02: invalid MSH-9, MSH-10, MSH-12 NACKed and quarantined | ConformanceSuiteTest.invalidMessagesNackedAndQuarantined; the suite's cases msh-9-*, msh-10-*, msh-12-* |
| PR-INT-003-1, PR-INT-003-2, PR-INT-003-4 | EngineTest.validInboundRoutedOnceAndDuplicateAcknowledged, ConformanceSuiteTest.invalidMessagesNackedAndQuarantined |
| PR-INT-003-3, parts 5 and 7, section 10 | FhirFacadeTest.validateAgainstProfile, terminologyBinding, incompleteResourceNotReleased |
| Section 13, FR-ISE-GWY-003, PR-GWY-003-2: redaction decisions enforced before release | FhirFacadeTest.withheldPatientNotReleased |
| Part 3 and FR-ISE-KEY-003: authenticated, encrypted channels; node authentication on every connection | EngineTest.outboundNodeAuthenticationRefused, inboundNodeAuthenticationRefused (and secrets-keys down: refused) |
| AC-03: the capability statement declares profiles, bindings, scopes, paging and versioning | FhirFacadeTest.capabilityStatement |
| Parts 4 and 6: the facade over Domain 1, PIXm and PDQm | FhirFacadeTest.readPatient, pdqmSearch, pixm, readEncounter |
| AC-04, part 9: the core without the Indonesia pack; the pack enabled | PacksTest.WithoutPack.coreRunsWithoutPack, PacksTest.WithPack.packEnabledPasses |
| AC-05, DEP-007: an independent consumer parses the payload | ConformanceSuiteTest.independentConsumerReadsTheMessage (a reader written apart from the engine's codec); FHIR answers are standard JSON read by Jackson in every facade test |
| TEST-ISE-012 (the conformance suite; invalid MSH-9/10/12 and identifiers without assigning authority) | ConformanceSuiteTest (5 tests) |
| TEST-ISE-013 (core without a pack, then the pack enabled) | PacksTest |
| Contract tests | contract/IntegrationContractTest (4 tests) |
Non-functional targets:
- NFR-ISE-005 security:
- mutual TLS 1.3 with node authentication that fails closed;
- payloads and files encrypted at rest (AES-256-GCM);
- the decision point on every request, its outage 503;
- Confidential registry attributes shown only when permitted;
- payload view under a permission of its own;
- no key in the repository (the tests make theirs).
- NFR-ISE-009 interoperability: HL7 v2.5.1 and FHIR R4 with published profiles, the conformance suite, and the contract tests.
- NFR-ISE-012 observability:
- the template's correlation identifiers, traces and ECS logs;
- per-interface metrics and health;
- alerts as counters (his_integration_*).
- NFR-ISE-016 time integrity: UTC throughout. HL7 timestamps are written in UTC; FHIR and API instants end in Z.
- NFR-ISE-018 localization: no screen. Problem and OperationOutcome text is English, with a stable code.
The card has no "Safety" row.
Differences from the card, the specification or the contracts¶
No contract file changed.
- No HAPI, no Camel (ADR-HIS-111 points 1 to 3; ADR-HIS-019 named them).
- HAPI HL7 v2 is licensed MPL-1.1 or GPL-2.0, neither on the dependency register's compatible list, so it cannot be proposed until legal decides (question below). The engine reads and writes ER7 with its own codec for the agreed profile, covered by the conformance suite.
- HAPI FHIR brought about 30 components outside the register (Saxon, PlantUML, Thymeleaf, JGit and others) and high findings in Jackson 2 and Guava. The facade is Spring MVC with Jackson, and its profiles are StructureDefinitions read by a subset validator.
- Camel would add a runtime model and components for nothing the kit lacks.
- A register entry outside the unit's folder. Apache MINA SSHD (SFTP) is the one new third-party library. The pipeline stops a build with a package no entry covers, and the register's own process lets a session propose an entry, never approve one (supply-chain README, "Who changes it";
protected-files). The entryapache-mina-sshdis added with status Proposed inplatform/supply-chain/register/dependencies.toml. Its four approvals are asked below. - File transfer schedules and handover are settings and a folder. integration.v1 has no operation to submit or schedule a file.
- The owning domain places the file in
<staging-dir>/<interfaceId>/outbound/, andhis.integration.files.schedulesgives the due times (ADR-HIS-111 point 8). - Inbound, the engine fetches each file the partner places with its
.sha256. It hands the file to the owning domain in<staging-dir>/<interfaceId>/inbound/and writes<file>.ackback. A schedule on an interface that only receives gives the inbound files' due times. - A bidirectional interface uses the
outboundandinboundsubfolders of its endpoint's folder, so the two directions never mix. - Closure with
referToOwningDomain: trueis refused (400) for now. The referral raises a reconciliation exception, which comes with FR-ISE-INT-006 in RC-3-S16. - Dead-lettering when attempts are exhausted is built here, with InterfaceMessageDeadLettered, although the contract point gives it to RC-3-S16. AC-02 needs a final state for exhausted retries, and a message must never wait silently (D02-ISE 4.3). RC-3-S16 adds replay, the national retry window's dead letter and reconciliation.
- Orchestrations of multi-step exchanges are settings (FR-ISE-INT-001 part 6; ADR-HIS-111 point 6), like the file schedules: integration.v1 has no operation to define one.
his.integration.orchestrations[n]names the inbound interface and message types it takes, its facilities, a deadline for the whole exchange, and its steps. Each step has a target interface, a timeout, and the compensating message type that undoes it (for exampleADT^A11^ADT_A09for an admission). It takes the place of the interface's routes for those message types. A definition the engine cannot run stops the unit at start.- Each step's message is queued only after the previous one is acknowledged. Its explicit state (Running, Compensating, Completed, Compensated, Failed, CompensationFailed), current step, deadlines and history are in the table
orchestration(migrationV2__orchestration.sql). The inbound transaction's state history records each step. - A step that dead-letters or is quarantined fails the exchange. So does one not acknowledged within its timeout or the deadline: it is withdrawn (Closed, not sent again), or, if in flight, its answer is awaited first. The steps done are then compensated, last first, each with the original message under the compensating MSH-9 and a new MSH-10 (
C<step>-<MSH-10>). - The exchange then ends Compensated (or Failed, when the first step failed), and the inbound transaction is quarantined with the reason (rule
FR-ISE-INT-001 part 6). A compensation that fails ends it CompensationFailed, incrementshis_integration_alerts_total{kind="compensation-failed"}, and is quarantined with the steps not undone. - The state is read through the inbound transaction (
readTransaction). integration.v1 has no operation for the orchestration itself; one would be a later contract addition. - Routing by facility fails closed (part 4, architecture 7.5). A route that names facilities takes only a message of one of them.
- Inbound, the facility is the receiving facility, MSH-6.1; outbound messages carry it in MSH-4.
- A Domain 1 event's facility is its envelope's, else its payload's.
- A message or event whose facility is unknown is taken only by routes that name no facility. Inbound, if no route takes it, it is quarantined as unroutable.
- Enterprise-level events such as IdentityUpdated have no facility. A partner that needs them has a route without facilities for those message types.
- The suspension's clinical functions are the registration's purpose. The registry has no attribute for them; the dialog's other fields come from the tier, the partner and the route targets.
- "No remaining consumers" at retirement means that no other registration routes to the interface and no message is in flight.
- The production activation's
signatureIdis the access token of the Release Manager's own step-up, verified and used once, as platform/gateways verifies an approval (ADR-HIS-108). Production is the settinghis.integration.production, true unless set otherwise. - PIXm's
sourceIdentifiercarries no identifier type, which contracts/admcrossReferenceIdentifierrequires (BR-ADM-004). The facade takes the type from the identifier system: MR, CIN, NIK, IHS and EPI for the HIS's own systems, and further ones by setting (his.integration.fhir-identifier-types). A system it does not know is refused. - The facade releases a resource only when it passes its core profile (part 7). A record that has lost a mandatory element is a 500 OperationOutcome.
- A Patient whose every identifier Domain 1 withholds from the caller is not released. This is settled from the specification. FR-ISE-INT-003 section 13 and FR-ISE-GWY-003 enforce Domain 1's consent and label decisions before release, and PR-GWY-003-2 withholds a response rather than disclosing it. A Patient cannot be released without an identifier (BR-ADM-004). So a read is 403 with the FHIR issue type
suppressed, and a search leaves the record out, uncounted. - A location under a restricted unit's privacy label is left out of PV1-3, since it is not disclosed outside the care team (FR-ADM-ADT-001 part 13).
- A file's alert is a counter. Missed, Unacknowledged and Failed increment
his_integration_file_transfer_alerts_total. The alert rules belong to platform/observability (follow-up).
Review round 1¶
The pipeline's checks failed in two jobs.
- platform/integration-engine:
FileTransferTest.missedAndUnacknowledgedAlertcounted two Missed alerts where it expected one. The CI run fell just after a real occurrence of the test's schedule (01:00 on the 1st), which the test's moved slot made the scheduler create too. - Fixing the test showed a defect: each pass of the file worker added one more future slot, one a minute in a deployment.
- The scheduler now makes the slot after the latest one only once the latest is due: one slot ahead, never more. A period passed while the engine was down is still made, and Missed.
- The test inserts a past slot of its own and checks that exactly that one is Missed and one future slot remains.
- platform/supply-chain failed on the new register entry:
- No supported-version record. A material runtime dependency needs one (FR-ISE-SUP-003). The record
apache-mina-sshd-2is added toplatform/supply-chain/register/components.toml, proposed like the register entry. - "Maintenance evidence is dated 2026-11-30, after today (2026-11-25)". The unit's tests check the committed register with the clock fixed at 2026-11-25, the day RC-1-S18 wrote it. No entry reviewed after that day can pass, so the register's own process ("a session proposes an entry") cannot be followed by any later session. Dating the review 2026-11-25 would be false. Changing the supply-chain unit's tests is outside this card. #294 made those tests use the real date; with main merged into this branch, the job passes with no change here.
- The same job's contract test also failed to start the ess stub on the runner, with an empty log. It is unrelated to this change, and passes when run again.
- The decision record index. Main now rebuilds
docs/architecture/decisions/README.mdafter every merge (#300), and sessions do not edit it, so this branch no longer adds ADR-HIS-111's row. The number 111 is still free on main.
Review round 2¶
No code change. The round judged the run before main was merged into the branch. Every check passed on c7492290.
Review round 3¶
- Routing by facility failed open. Inbound messages were routed without a facility, and an outbound event without one matched every restricted route. Both now fail closed (
Engine.takesFacility), as "Differences" describes. Tests:EngineTest.outboundRouteKeepsToItsFacility,inboundRouteKeepsToItsFacility. StepUpthrew nothing on a blanksignatureId. It went on to fail at decoding and wrote two denied audit records. It now refuses at once with one record (RegistryTest.blankSignatureRefusedOnce). A step-up token withoutjtiis now used once by the SHA-256 of the whole token, not byhashCode().- Inbound managed file transfer (part 11) is built:
FileTransferTest.inboundReceivedAndAcknowledged,inboundChecksumMismatchAndMissed. - Part 6 orchestration and the masked Patient are questions on the issue, listed under "Needs a person".
Review round 4¶
- FR-ISE-INT-001 part 6 is built: orchestration of multi-step exchanges with explicit state, timeouts and compensation, defined by settings (see "Differences"; ADR-HIS-111 point 6). Tests:
OrchestrationTest(5). - The masked Patient is settled from the specification: withheld, as a 403 with issue type
suppressed, and left out of a search (FhirFacadeTest.withheldPatientNotReleased). The 500 remains only for a record that lost a mandatory element (incompleteResourceNotReleased). Both round 3 questions on the issue are answered there, and no question is left open. - The routed fan-out now checks every target before it queues any message. Before, a bad second target quarantined the message after the first target's message was already queued.
Needs a person¶
None of these blocks the merge.
- Enterprise Architecture Board: approval of ADR-HIS-111. It refines ADR-HIS-019: no Camel, and the HAPI libraries deferred.
- Architecture, security, legal and operations approvers of the dependency register: the entry
apache-mina-sshd(Apache MINA SSHD 2, Apache-2.0), proposed by this session, in a pull request of their own (FR-ISE-SUP-001 behaviour 3). - Legal (question): may MPL-1.1 join the compatible licences of
platform/supply-chain/register/policy.toml? HAPI HL7 v2 and HAPI FHIR, the libraries of ADR-HIS-019, are licensed MPL-1.1 (or GPL-2.0). Until it does, the engine keeps its own HL7 v2 codec. - Owner of the SATUSEHAT pack (DEC-ISE-010): confirm its Patient and Encounter rules against the official sources at the first quarterly review (
reviewDue2027-02-17).
Follow-ups outside the card¶
- RC-3-S16 (part 2 of this unit):
- replay of quarantined and dead-lettered messages, and
referToOwningDomain; - reconciliation, and the national retry window (
retryFor) after dead-lettering; - delivery statuses to contracts/adm adt.v1
submitEventDeliveryStatuses; - the transaction fields
processedAtanddowntimeIdare in the table, unused yet. - Domain 10 policy content: the actions and resource types of ADR-HIS-111 point 10, including
adm.Personandadm.Encounterfor the facade and the scopes attribute. - Deployment:
- the unit's Kubernetes objects;
- its service catalogue registration (
registerService, contract points "Every unit"); - the gateway routes to
/ise/v1/...and/fhir/r4inplatform/gateways/model; - cert-manager key and trust stores, the OpenBao payload key and SSH keys;
- the observability alert rules on
his_integration_alerts_totalandhis_integration_file_transfer_alerts_total. - Harness (FN-S07), before RC-3-S24: reaching platform units (handover RC-3-S03). RC-3-E2E-003 expects
adm-adt-lis-01registered and Active with a bound node certificate. - Inbound HL7 v2 into Domain 1 (contracts/adm README, RC-3-S02 point 3: a validated inbound admission is
confirmAdmission). There is no internal delivery adapter yet; an inbound route may target interfaces only. - The enhanced acknowledgement mode and the FHIR
Locationresource. - Gateways (RC-3-S13's catalogue):
readCapabilityStatementnow has the facade's/fhir/r4/metadatato read. - Legal's answer on MPL-1.1: with it, a later session may move the codec and the facade to HAPI (ADR-HIS-111, Consequences).
- Design system: none from this session.