Interface engines
The middleware that connects a hospital's systems and routes HL7v2 messages between them.
An interface engine is a system that receives HL7v2 messages from the other systems in a healthcare organization and delivers each message to the systems that need it. Each system connects once, to the engine, instead of to every system it exchanges messages with. The engine decides where each message goes, changes it into the form that each destination expects, and keeps a copy until every destination has received it.
Interface engines are not part of the HL7v2 standard, but most hospitals use one. In an exchange through an engine, the engine is the destination of every message that a source sends and the source of every message that a destination receives, as described in Message flow.
Purpose
A hospital runs many clinical and administrative systems, and an event such as an admission must be reported to most of them. When systems are connected directly, each pair that exchanges messages needs its own interface, with its own profile, its own connection, and its own monitoring. The number of interfaces grows quickly: ten systems can need up to 45 point-to-point interfaces, and thirty systems up to 435. An upgrade to one system affects every interface that it takes part in.
An interface engine replaces these connections with a hub. Each system has one interface, to the engine, and the engine forwards each message to the systems that need it. Adding a system requires one new interface and a set of rules in the engine. Upgrading a system requires changes only to the engine's configuration for that system; the other systems are unaffected.
Service buses
Other industries use the same hub design under the name enterprise service bus. An interface engine is a service bus specialized for healthcare: it reads HL7v2 segments and fields, supports MLLP, and usually supports other healthcare standards such as FHIR, X12, and DICOM.
Functions
An interface engine applies a set of functions to each message that passes through it. Each interface in the engine combines the functions that it needs.
Routing
Routing selects the destinations of a message. The engine evaluates rules against the content of the message, such as the message type, the trigger event, the sending facility in MSH-4, or the patient class in PV1-2. A single admission message can go to a billing system, a bed-management system, and a clinical data warehouse, and the source does not need to know about any of them.
Filtering
Filtering removes messages that a destination does not need. A rule can exclude outpatient registrations from a feed for inpatient systems, or deliver a message to a research system only when the patient has given consent. Filtering keeps each destination's feed limited to the messages it processes, which reduces both its load and the amount of patient data that it receives.
Transformation
Transformation changes the content of a message for its destination. Two systems that both implement HL7v2 rarely produce identical messages: they use different versions, populate different optional fields, and follow different profiles. The engine reconciles these differences by moving values between fields, removing or adding segments, and changing the declared version. Each system then sends and receives messages in the form it implements.
Transformations account for most of an engine's configuration and most of its maintenance. Each transformation depends on the current behavior of two systems, so a change to either system can require a change to the transformation.
Code mapping
Code mapping is a form of transformation that translates coded values. Two systems can represent the same concept with different codes, such as a discharge to home, a laboratory test, or a hospital unit. The engine replaces each code from the source with the corresponding code of the destination, usually from a lookup table that the organization maintains. Tables describes the code sets involved and the reasons they differ between systems.
Validation
Validation checks that a message meets the requirements of its interface before the engine forwards it: that required segments and fields are present, that values match their data types and lengths, and that codes belong to the expected tables. A message that fails can be rejected with an error acknowledgment to the source, or accepted and held for review, depending on how the interface is configured.
Persistence
Persistence stores each message that the engine receives. The engine keeps the message until every destination has acknowledged it. If a destination is unavailable, its messages wait in a queue and are delivered, in order, when it becomes available again. This method is called store and forward, and it protects messages from the failures of any single system.
The stored messages also form a record of the exchange: which messages arrived, how each was transformed, and when each was delivered to each destination. Analysts use this record to investigate problems and to resend messages after a fix. Because the record contains protected health information (opens in a new tab), each organization sets how long it is kept and who can read it.
Workflows
Some engines also coordinate work that spans several messages or systems. A critical laboratory result, for example, can be delivered to the ordering system, trigger an alert to a clinician, and create a billing event. Engines provide triggers, timers, and retry handling for these workflows.
Example
A registration system reports an outpatient registration (ADT^A04) in version 2.5.1. The engine routes the message to a laboratory system that implements version 2.3 and accepts a single patient identifier, the medical record number. The message that arrives from the source:
MSH|^~\&|REG|HOSP|ENGINE|HOSP|20230630120000||ADT^A04^ADT_A01|MSG000001|P|2.5.1
PID|1||987654321^^^NATION^NI~12345^^^HOSP^MR||Doe^John||19700101|MThe message that the engine delivers to the laboratory system:
MSH|^~\&|REG|HOSP|LAB|HOSP|20230630120000||ADT^A04|MSG000001|P|2.3
PID|1||12345^^^HOSP^MR||Doe^John||19700101|MThe engine has made four changes:
- Receiving application.
MSH-5names the laboratory system instead of the engine. - Message type.
MSH-9drops the message structure, a component that version2.3does not define. - Version.
MSH-12declares the version that the destination implements. - Patient identifier.
PID-3keeps only the repetition with identifier typeMR.
The same message can be delivered to other destinations in the same way, each with its own transformation.
Acknowledgments
An exchange through an engine consists of two exchanges, each with its own acknowledgment. The engine acknowledges the message to the source, and each destination acknowledges its copy to the engine.
In most configurations, the engine acknowledges a message as soon as it has stored it, before any destination has received it. The source's acknowledgment therefore confirms that the engine accepted the message, not that a destination processed it. An error at a destination is reported to the engine, which retries the delivery or holds the message for review; the source is not informed.
Some interfaces instead wait for the destination's acknowledgment and return its outcome to the source. The source then learns the result of processing, but each message takes longer, and the source depends on the availability of the destination, which the engine was meant to remove.
Products
Interface engines are sold as commercial products and offered as cloud services. Widely used products include Rhapsody, Cloverleaf, InterSystems IRIS for Health, and Epic Bridges, which is used at sites that run Epic's electronic health record. Mirth Connect, long distributed as open source, is now commercially licensed by NextGen Healthcare, and its open-source code continues as the community project Open Integration Engine.
The products differ in licensing, in how interfaces are configured (graphical tools, scripting, or code), and in the other standards they support. Their handling of HL7v2 is similar, because the standard defines the messages that they process.
Trade-offs
An interface engine centralizes integration, with benefits and costs that follow from that position:
- Visibility. Every message passes through the engine, so every message can be logged, inspected, resent, and rerouted from one place.
- Availability. The engine is a single point of failure for every interface it carries. Sites usually run it as a redundant pair.
- Accumulation. Routes and transformations accumulate over the life of an engine. Those written for systems that have since changed or been retired are difficult to identify and remove.
- Migration. Moving to another engine requires every interface to be rebuilt and retested, so migrations are large and infrequent projects.
- Opacity. Because the engine changes messages in transit, a destination receives a message that its source never sent. Establishing what the source actually sent requires the engine's record.
- Configuration. Most engines are configured with graphical tools designed for interface analysts. Graphical configuration is difficult to place under version control, automated testing, and deployment pipelines. Some engines now support these practices, and some organizations write the interface logic as code instead.
Build this with Glion
Glion takes the code-based approach: a framework for writing HL7v2 interfaces as typed, testable programs. Receive messages over MLLP →
Further reading
- Message flow — the exchange in which an engine acts as an intermediary.
- Acknowledgments — the acknowledgment that each exchange returns.
- MLLP — the transport that an engine usually uses on each side.
- Conformance — the profiles that an engine's validation and transformations follow.