Skip to main content

Interop Service — Domain Model

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD


1. Aggregates

1.1 InteropConnector

Represents a configured integration channel to an external system (HL7 v2 feed, FHIR partner, EMR coexistence).

InvariantRule
One active connector per (tenant, facility, protocol, direction)Prevents duplicate listeners on same MLLP port
Auth config encryptedCredentials never stored in plaintext
Deactivation preserves message logDisabling connector does not delete historical messages

State machine:


1.2 Hl7Message

An immutable record of a received or sent HL7 v2 message. Append-only.

InvariantRule
Raw payload stored immutablyRaw HL7 bytes never modified after storage
Deduplication(connector_id, message_control_id, sending_app) must be unique
Processing status trackedpending → processing → processed → failed → dead_lettered

1.3 FhirRoutingRule

Defines how a FHIR resource type is routed to its owning service.

InvariantRule
One primary owner per resource type + categoryNo ambiguous routing without explicit fan-out rule
Fan-out rules for split ownershipObservation routes by category (vital-signs vs laboratory)

1.4 BulkExportJob

Tracks a FHIR bulk $export request lifecycle.

InvariantRule
One active export per (tenant, group) at a timePrevents runaway parallel exports
Output files immutable after completionSigned URLs expire; new export required for refresh

State machine:


2. Entities

EntityKey attributesAggregate
Hl7ProcessingAttemptid, messageId, attemptAt, status, errorDetailHl7Message
Hl7ResourceLinkid, messageId, resourceType, resourceId, actionHl7Message
BulkExportFileid, jobId, resourceType, fileUrl, countBulkExportJob

3. Value Objects

Value ObjectFieldsRules
FhirVersionenum R4 | R4BR4 is the baseline
Hl7MessageTypemessageCode, eventCode (e.g., ADT^A01)Determines mapper
ConnectorProtocolenum mllp | fhir-rest | sftp | api-pollingDrives adapter selection
ConnectorDirectionenum inbound | outbound | bidirectional
ResourceOwnershipresourceType, category?, serviceUrlRouting table entry

4. Domain Events

EventTriggerKey payload
Hl7MessageReceivedMLLP message ingestedmessageId, connectorId, messageType, tenantId
Hl7MessageProcessedMapping completed + FHIR resource createdmessageId, resourceType, resourceId, tenantId
Hl7MessageFailedProcessing errormessageId, errorCode, tenantId
Hl7MessageDeadLetteredMax retries exceededmessageId, tenantId
FhirRequestRoutedFHIR request forwarded to owning serviceresourceType, operation, tenantId
BulkExportStarted$export job startedjobId, groupId, tenantId
BulkExportCompleted$export job completedjobId, fileCount, tenantId
ConnectorActivatedConnector enabledconnectorId, protocol, tenantId
ConnectorDeactivatedConnector disabledconnectorId, tenantId

5. Ubiquitous Language

TermDefinition
ConnectorA configured integration channel to/from an external system
MLLPMinimum Lower Layer Protocol — TCP transport for HL7 v2
Message control IDUnique identifier assigned by the sending system to an HL7 v2 message
CapabilityStatementFHIR resource declaring what interactions/resources/profiles the server supports
OperationOutcomeFHIR resource used to return errors and warnings
Fan-outRouting a single FHIR request to multiple owning services and merging results
Bulk exportFHIR $export operation producing NDJSON files of all resources for a group/patient
AFG-CoreAfghanistan national FHIR Implementation Guide extensions and profiles
US Core 6.1US Core FHIR Implementation Guide version 6.1 (baseline profile set)
IPSInternational Patient Summary — FHIR profile for cross-border patient data exchange
VXUHL7 v2 Vaccination Record Update message type
ORMHL7 v2 Order Message
ORUHL7 v2 Observation Result Unsolicited
ADTHL7 v2 Admit/Discharge/Transfer