Skip to content
Healthcare SoftwareEngineering

Interoperability

HL7 v2 Integration Services

HL7 v2 still carries most real-time hospital traffic in the US. We build v2 interfaces that acknowledge correctly, survive restarts, and tell you when a feed goes quiet.

HL7 v2 integration: overview

HL7 version 2 is a pipe-delimited messaging standard first published in the late 1980s, and it remains the workhorse for admissions, orders, results, scheduling, and charges inside hospitals. A message is a sequence of segments: MSH for header and routing, PID for patient identity, PV1 for the visit, OBR for an order or report, OBX for each observation. Trigger events define meaning, so an ADT^A01 is an admission, an A04 a registration, an A08 a demographic or visit update, and an A40 a patient merge.

Transport is usually MLLP over TCP. Each message is wrapped in a start block (0x0B) and an end sequence (0x1C 0x0D), and the receiver replies with an ACK whose MSA-1 is AA (accepted), AE (error), or AR (rejected), echoing the sender's MSH-10 control ID. Getting that loop right is non-negotiable: a receiver that ACKs before durably persisting can lose messages, while one that never ACKs stalls the sender's queue and backs up the whole interface.

The standard's flexibility is both its strength and its cost. Fields are optional, repetitions are common, and sites add Z-segments for local data. Version labels in MSH-12 (2.3, 2.5.1, 2.8) set expectations but do not guarantee conformance. We approach every v2 interface with a written specification built from real sample traffic, a mapping that handles every field we consume, and tests for the ugly cases before they show up in production.

Engineering challenges in HL7 v2 integration

  • 01Out-of-order events

    An A08 update can arrive before the A01 it modifies, or a discharge can precede a transfer after a queue backlog clears. Consumers need sequencing rules or upsert semantics that tolerate this.

  • 02ACK timing and durability

    ACKing before a message is committed risks loss; ACKing too slowly triggers sender timeouts and resends. The ACK must follow durable storage, quickly.

  • 03Repeating and optional fields

    PID-3 can carry several identifiers with different assigning authorities, and OBX groups can repeat dozens of times. Parsers that read the first repetition silently pick the wrong value.

  • 04Undocumented local conventions

    Z-segments, overloaded fields, and site-specific code tables carry meaning that never made it into a spec. Discovery requires sample traffic and an analyst who knows the history.

  • 05Feeds that fail quietly

    A dropped TCP connection without reconnect, or a sender stuck on an unacknowledged message, looks like low volume. Silence detection is essential.

Technical capabilities

What our HL7 v2 integration work covers

  • ADT interfaces

    Inbound and outbound ADT handling for A01, A02, A03, A04, A08, A11, A13, A40 and others, with explicit rules for cancellations, merges, and late updates.

  • Orders and results

    ORM^O01 and OML^O21 orders, ORU^R01 results with OBR/OBX parsing, LOINC mapping of OBX-3, reference ranges, abnormal flags, and embedded PDF reports in base64 OBX-5.

  • Scheduling feeds

    SIU^S12 through S26 handling for bookings, reschedules, cancellations, and no-shows, with appointment identity tracked across modifications.

  • Charges and documents

    DFT^P03 charge posting with FT1 validation, and MDM^T02 or T04 document notifications carrying transcribed notes or report status changes.

  • MLLP connectivity and ACKs

    TLS-wrapped MLLP or VPN-protected connections, original-mode or enhanced-mode acknowledgments, configurable timeouts, and automatic reconnect.

  • Translation to FHIR

    Mapping v2 messages into FHIR R4 resources, using the HL7 v2-to-FHIR mapping guidance as a starting point and documenting local deviations.

  • Replay and reprocessing

    Durable raw-message archives with indexed search by control ID, patient, and date, plus safe replay into corrected mappings.

Software architecture

Reference architecture for HL7 v2 integration

Separating receipt, persistence, and processing lets an interface ACK fast and process carefully.

  1. Transport
    • MLLP listener
    • TLS termination
    • Connection supervisor
    • ACK generator
  2. Persistence
    • Raw message archive
    • Control ID index
    • Sequence tracker
  3. Processing
    • Parser and validator
    • Site mapping
    • Terminology lookup
    • Error queue
  4. Delivery
    • Canonical events
    • FHIR resources
    • Downstream APIs
  5. Operations
    • Volume baselines
    • Silence alerts
    • Replay console
Illustrative layering; actual architecture is decided per engagement and documented in decision records.

Technology stack for HL7 v2 integration

HL7 libraries
HAPI HL7v2 (Java)NHapi (.NET)python-hl7Custom parsers for edge cases
Engines
NextGen Connect (Mirth)RhapsodyCloverleafInterSystems IRIS for Health
Cloud
Google Cloud Healthcare API HL7v2 storeAzure Health Data ServicesAWS managed services under BAA
Messaging
KafkaRabbitMQAmazon SQS
Testing
Synthetic message generatorsHL7 Soup or similar editorsContract tests per site

Security & compliance

Security and compliance considerations for HL7 v2 integration

What regulations require

  • The HIPAA Security Rule's transmission security standard (45 CFR 164.312(e)(1)) requires technical measures to guard against unauthorized access to ePHI transmitted over networks; encryption is an addressable implementation specification under 164.312(e)(2)(ii).
  • The HIPAA Security Rule requires audit controls that record and examine activity in information systems containing ePHI (45 CFR 164.312(b)).
  • A proposed update to the HIPAA Security Rule, published as an NPRM in January 2025, would make many currently addressable specifications, including encryption, required; it is proposed, not final, as of this writing.

Recommended engineering practices

  • Never expose an MLLP port to the internet; use TLS-wrapped MLLP or a site-to-site VPN with IP allowlisting.
  • Archive raw messages encrypted at rest, with retention aligned to the organization's records policy.
  • Redact PID content from logs and alerts; reference messages by MSH-10 control ID.
  • Restrict replay tooling to a small role and log every replay action.
  • Load-test listeners with burst traffic that simulates a sender draining a backlog.

Regulatory summaries are educational, not legal advice. HIPAA compliance is an organizational program; software can support safeguards but cannot by itself make an organization compliant. Systems that handle PHI need their own risk analysis, vendor evaluation, and Business Associate Agreements before deployment.

Integration capabilities

Integrations we engineer for HL7 v2 integration

  • ADT^A01/A03/A04/A08/A40
  • ORM^O01 and OML^O21
  • ORU^R01
  • SIU^S12–S26
  • DFT^P03
  • MDM^T02/T04
  • VXU^V04 to immunization registries
  • ACK and enhanced acknowledgments

Engineering methodology

How we approach HL7 v2 integration

  1. 1

    Collect sample traffic

    We obtain de-identified or synthetic samples covering every trigger event in scope, including corrections and cancellations.

  2. 2

    Write the spec

    Field-by-field mapping, code set tables, ACK mode, timeouts, and error handling, reviewed with the sending site's analyst.

  3. 3

    Build and test edge cases

    Parsers and mappings are tested against generated messages with missing segments, repetitions, and out-of-order sequences.

  4. 4

    Connectivity and end-to-end test

    We bring up the connection in test, verify ACK behavior, and run scripted scenarios with the site.

  5. 5

    Production with baselines

    After go-live we establish hourly volume baselines and set silence and error-rate alerts.

Business use cases

Where HL7 v2 integration delivers value

  • Real-time census

    A capacity-management tool consumes ADT across several facilities to maintain bed occupancy within seconds of events.

  • Reference lab results

    A lab sends ORU^R01 results with LOINC-coded OBX segments and an embedded PDF, routed to the ordering provider's inbox.

  • Appointment reminders

    An engagement platform receives SIU feeds to send reminders and update status when appointments change.

  • Immunization reporting

    A clinic network submits VXU messages to a state immunization information system and processes the returned ACKs.

Technical comparison

Common HL7 v2 message types
MessageTrigger examplesKey segmentsTypical consumer
ADTA01 admit, A04 register, A08 update, A40 mergeMSH, EVN, PID, PV1, NK1, IN1Any system needing patient context
ORM / OMLO01 order, O21 lab orderMSH, PID, ORC, OBRLabs, radiology, ancillary systems
ORUR01 unsolicited resultMSH, PID, OBR, OBX, NTEEHR inbox, analytics
SIUS12 new, S14 modify, S15 cancelMSH, SCH, PID, AIS, AIPScheduling and engagement tools
DFTP03 post detail financial transactionMSH, PID, PV1, FT1Billing systems
MDMT02 original document, T04 status changeMSH, EVN, PID, TXA, OBXDocument management

Typical deliverables

What a HL7 v2 integration engagement produces

  • Interface specification per feed
  • Mapping code and terminology tables
  • Synthetic test message library
  • MLLP connectivity configuration
  • Raw message archive with search
  • Alerting rules and dashboards
  • Runbook with replay procedures

HL7 v2 interface go-live checklist

  • ACK sent only after durable persistence
  • MSH-10 duplicates detected and handled idempotently
  • All PID-3 repetitions parsed with assigning authority
  • Merge (A40) and cancel (A11, A13) events tested
  • Z-segments documented or explicitly ignored
  • Silence alert threshold set per hour of day
  • Replay tested against a corrected mapping

Cost and timeline factors

What shapes HL7 v2 integration cost and timeline

  • Number of message types and trigger events
  • Inbound, outbound, or bidirectional flows
  • Variability across sending sites
  • Translation to FHIR or a canonical model
  • Connectivity setup and security reviews
  • Existing engine in place versus new build

Typical timeline

One well-specified inbound ADT feed typically takes a few weeks including testing. Order-and-result pairs with terminology mapping take longer. A portfolio of feeds across many sites is usually staged over several months.

Read the cost guide

HL7 v2 integration FAQs

What is MLLP in HL7 integration?

The Minimal Lower Layer Protocol is the framing used to send HL7 v2 messages over TCP. Each message begins with a vertical-tab byte (0x0B) and ends with a file-separator byte and carriage return (0x1C 0x0D). MLLP itself provides no encryption, so it should run inside TLS or a VPN.

What is the difference between ADT A04 and A08?

A04 signals that a patient has been registered, typically for an outpatient or emergency visit without inpatient admission. A08 signals that patient or visit information has been updated. Receivers should treat A08 as an update to existing data and handle the case where it arrives before the related registration.

Should we convert HL7 v2 to FHIR?

Often yes, at least internally. A FHIR-shaped canonical model makes downstream code simpler and aligns with API-based integrations. HL7 publishes v2-to-FHIR mapping guidance, but local conventions mean every site needs its own reviewed mapping. Keep the raw v2 message so you can reprocess if the mapping changes.

How do HL7 acknowledgments work?

The receiver returns an ACK message containing an MSA segment. MSA-1 is AA for accepted, AE for application error, or AR for rejected, and MSA-2 echoes the original MSH-10 control ID. Enhanced mode adds commit-level acknowledgments (CA, CE, CR). Senders typically resend or hold the queue if no ACK arrives.

Is HL7 v2 being replaced by FHIR?

Not quickly. FHIR adoption is growing, especially for APIs and patient access, but hospitals have decades of v2 interfaces in production. Most organizations will run both for years. New integrations should plan for v2 where real-time events are needed and FHIR where on-demand access fits.

Discuss your healthcare engineering project

Tell us about the system, the integrations it depends on, and the constraints you are working within. A senior engineer will review it and reply with questions, not a sales script.