Blog

    Building an EHR Integration Engine

    By GauravNovember 14, 202610 mins read
    On this page

    Most hospitals buy an interface engine, and for most of them that is the right choice. But digital health companies that connect to dozens of EHRs, platforms that need integration as a core product capability, and teams with unusual volume or data needs sometimes find that a commercial engine fits awkwardly, or that their integration layer has quietly become an engine anyway.

    This guide is for teams deciding whether to build an EHR integration engine, and for those already building one. It covers when building makes sense, the components every engine needs, how queues and acknowledgments keep messages from getting lost, how to secure and audit the engine, and how to operate it once dozens of interfaces depend on it.

    What does building an EHR integration engine involve?

    Deciding whether to build an integration engine?

    Agnotic designs and builds EHR integration layers, from HL7 v2 and FHIR channels to monitoring and operations.

    Building an EHR integration engine means creating the software layer that receives messages and API data from EHRs and other systems, parses and validates them, routes them to the right destinations, transforms formats and codes, guarantees delivery with queues and acknowledgments, and lets an operations team monitor every interface. Reliability matters as much as parsing.

    It is a long-term commitment. An engine built for three interfaces will be asked to run fifty, so design for operations from the start, not after the first outage. Decide early who will be on call for it, how incidents are reported to customers and how changes are released, because those choices shape the architecture.

    When should you build instead of buy?

    Build when integration is part of your product, when you connect to many EHRs with the same patterns, or when you need behavior or scale a commercial engine handles poorly. Buy when you are a provider organization connecting systems inside your own walls.

    • Build signals: Integration is a product feature; many similar customer connections; need for tight code-level control, testing and deployment; cloud-native scaling.
    • Buy signals: Hospital-internal interfaces; an integration team skilled in a commercial engine; many unrelated interface types; limited engineering capacity for operations.
    • Hybrid: Use a commercial or open-source engine for HL7 v2 transport and build your own services for transformation and business logic.

    Count operations in the decision. The cost of an engine is mostly the years of monitoring, support and change after launch, whether you buy or build. Estimate how many interfaces you will run in three years and who will support them out of hours before choosing.

    Which components does an integration engine need?

    Every engine, however small, needs the same set of components. Missing one usually shows up later as lost messages or long, hard-to-diagnose outages.

    Integration engine layers: inbound connectors for HL7 v2, FHIR and files; a durable queue; parsing, validation and routing; transformation and code mapping; outbound delivery with acknowledgments; and monitoring with audit logs across every layer
    • Inbound connectors: HL7 v2 over network connections, FHIR APIs, files and webhooks.
    • Durable queue: Every received message stored safely before anything else happens to it.
    • Parsing and validation: Messages parsed and checked against the expected structure for each interface.
    • Routing: Rules that decide where each message goes, by type, source and content.
    • Transformation: Format conversion, such as HL7 v2 to FHIR, and code mapping between systems.
    • Outbound delivery: Sending to destinations with retries and acknowledgment handling.
    • Monitoring and audit: Message tracking, alerts, search and an audit trail.

    How do queues and acknowledgments prevent lost messages?

    Store first, acknowledge second, process third. If the engine acknowledges a message before it is safely stored, a crash can lose it with the sender believing it arrived.

    • 1. Persist on receipt: Write the raw message to durable storage before acknowledging it.
    • 2. Acknowledge: Send the acknowledgment the sender expects once the message is stored.
    • 3. Process from the queue: Parse, route and transform from stored messages, so processing can be retried.
    • 4. Deliver with retries: Retry failed deliveries with back-off, and stop retrying after a limit.
    • 5. Dead-letter queue: Move messages that cannot be processed to a queue staff can review and replay.

    Use the acknowledgment codes senders expect. HL7's acknowledgment code table defines application accept (AA), application error (AE) and application reject (AR), and each sending system decides whether to resend based on which one it receives, so returning the wrong code can cause duplicates or silent losses.

    Order matters for some interfaces. Admissions, transfers and discharges for the same patient must usually be processed in sequence, so design queues that preserve order per patient while still processing different patients in parallel.

    How should transformation and code mapping be handled?

    Keep transformation logic in versioned, tested code or configuration, kept separate from the transport layer. Each interface's mappings should be readable, reviewable and testable on their own.

    • Versioned mappings: Every mapping change reviewed and deployed like code.
    • Code tables: Local codes mapped to standard codes, maintained per source system.
    • Test fixtures: Sample messages for every interface, run on every change.
    • Unmapped values: Clear handling, such as holding the message or flagging the value, never silently dropping it.

    How should the engine be secured and audited?

    An integration engine carries protected health information between systems, so it needs strong transport security and a complete audit trail. The HIPAA Security Rule's transmission security standard, 45 CFR 164.312(e)(1), requires technical measures to guard against unauthorized access to electronic protected health information transmitted over a network.

    Its audit controls standard, 45 CFR 164.312(b), requires mechanisms that record and examine activity in systems that contain or use that information. For an engine, that means logging who viewed, replayed or changed messages and mappings, not just system events.

    • Encrypted connections: TLS or VPN for every inbound and outbound connection.
    • Encrypted storage: Stored messages and queues encrypted at rest.
    • Access control: Role-based access to message content, with most staff seeing metadata only.
    • Audit trail: Views, searches, replays and configuration changes logged with user and time.

    How should an integration engine be tested?

    Test each interface with recorded sample messages on every change, and test the engine itself under failure. Most serious incidents come from conditions that never appear in a happy-path demo.

    • Interface regression: A library of real-shaped, de-identified messages per interface, run in the pipeline.
    • Failure drills: Kill a worker mid-message, drop a destination, fill a queue, and confirm nothing is lost.
    • Load tests: Peak volumes, such as morning admission bursts, processed within agreed times.
    • Replay tests: Confirm replays do not create duplicates at destinations.

    How do you operate an engine with many interfaces?

    Operations is where engines succeed or fail. A support team needs to see every interface's health at a glance, find any message quickly and fix problems without engineers.

    • Interface dashboard: Status, volume and errors per interface, with normal ranges.
    • Alerts: Stopped feeds, rising error rates and queues growing beyond normal.
    • Message search: Find messages by patient, identifier, type and time, with access controls.
    • Replay tools: Re-send or re-process messages safely after a fix.
    • Runbooks: Written steps for common failures, owned by the support team.

    Silence is the most dangerous failure. An interface that stops sending messages raises no errors, so alert on missing volume, not just on failures, using each interface's normal pattern by hour and day of the week as the baseline.

    What are the common mistakes when building an integration engine?

    The common mistakes come from treating the engine as plumbing rather than a product with users.

    • Acknowledging before storing: Messages lost on a crash.
    • No dead-letter handling: Failed messages dropped or retried forever.
    • Logic in transport code: Mappings buried where only one engineer can change them.
    • No volume alerts: Silent feeds unnoticed for days.
    • Content visible to all: Every support user able to read full patient messages.

    What are best practices for building an EHR integration engine?

    The practices that hold up make the engine reliable, observable and changeable by the team that runs it.

    • Store, then acknowledge: Durable queues before any processing.
    • Separate transport and logic: Mappings versioned and tested independently.
    • Order where needed: Per-patient ordering for event feeds.
    • Alert on silence: Missing volume is a failure.
    • Audit content access: Every view and replay logged.

    How Agnotic can help

    Agnotic Technologies designs and builds EHR integration layers: HL7 v2 and FHIR connectors, durable queues with ordered processing, transformation and code mapping services, secure storage and audit, and operations tooling with dashboards, alerts, search and replay. We also help teams decide between building, buying or a hybrid, based on their interfaces and operations capacity.

    If your integration layer has grown into an engine without being designed as one, we review it for message loss risks and operational gaps, and fix those first.

    Build integration that does not lose messages

    Plan your integration engine with our engineers, or read more HL7 articles in the hub.

    Related reading on Agnotic

    Compare commercial interface engines, and see how Mirth, HL7 acknowledgments, error handling and HL7 v2 to FHIR mapping work.

    Sources

    Frequently Asked Questions

    It can make sense when integration is part of the product and many customer connections follow the same patterns. Otherwise a commercial or open-source engine is usually cheaper to run.

    Talk to an engineer about your project

    We design and build EHR integration engines that are reliable, secure and easy for your team to operate.