Free 30-minute AI & automation audit with a senior engineer. You keep the notes. Book yours

Software DevelopmentBackend Development 20 Nov 2026

HL7 v2 vs FHIR: A Practical Guide for Healthcare Software Teams

HL7 v2 vs FHIR explained for engineering teams: message vs resource models, when you need both, interface engines, SMART on FHIR and HIPAA-aligned design.

HL7 v2 and FHIR solve the same problem in different eras. HL7 v2 is an event-driven messaging standard that still carries most traffic inside hospitals, such as admissions and lab results. FHIR exposes clinical data as RESTful resources that web and mobile apps can query. Most real healthcare products need both: v2 to talk to existing systems, FHIR for new apps and partners.

This guide is written for CTOs, architects and engineers who have to make that decision on a real project. It covers how each standard works, where each one fits, how interface engines and SMART on FHIR change the picture, and what “HIPAA-aligned” should mean in your codebase.

What is HL7 v2 and how does it work?

HL7 v2 is a messaging standard first published in the late 1980s and still the default for system-to-system feeds inside hospitals and labs. A v2 message is plain text made of segments, one per line, with fields separated by pipes (|) and components by carets (^).

Messages are triggered by events. A patient is admitted, so the registration system sends an ADT^A01. A lab result is finalized, so the LIS sends an ORU^R01. The receiver replies with an acknowledgment (ACK) that says whether it accepted the message.

MSH|^~\&|LIS|MAINLAB|EHR|HOSP|20261120093000||ORU^R01|MSG00042|P|2.5.1
PID|1||123456^^^HOSP^MR||DOE^JANE||19800214|F
OBR|1|ORD789|RES456|2345-7^Glucose^LN
OBX|1|NM|2345-7^Glucose^LN||98|mg/dL|70-99|N|||F

Most v2 traffic travels over MLLP (Minimal Lower Layer Protocol), a thin framing layer on top of TCP, or as files dropped into a shared folder. There is no built-in query model: if you want data, someone has to send you a message.

The catch is that v2 is flexible to a fault. Almost every implementation uses optional fields differently and adds custom Z segments. Two systems that both “support HL7 2.5.1” can still disagree on where the attending physician or the insurance plan lives. That is why v2 projects always start with a mapping document per interface.

What is FHIR and how is it different?

FHIR (Fast Healthcare Interoperability Resources) is HL7’s newer standard. Instead of event messages, it defines resources such as Patient, Encounter, Observation, MedicationRequest and Appointment, each with a URL, a defined structure and a REST API to create, read, update and search them. Resources are exchanged as JSON or XML over HTTPS.

The same glucose result from the v2 example looks like this as a FHIR R4 Observation:

{
  "resourceType": "Observation",
  "status": "final",
  "code": {
    "coding": [{ "system": "http://loinc.org", "code": "2345-7", "display": "Glucose" }]
  },
  "subject": { "reference": "Patient/123456" },
  "valueQuantity": { "value": 98, "unit": "mg/dL", "system": "http://unitsofmeasure.org", "code": "mg/dL" },
  "referenceRange": [{ "low": { "value": 70 }, "high": { "value": 99 } }]
}

A client can ask GET /Observation?patient=123456&code=http://loinc.org|2345-7 and get every glucose result for that patient. That query model is the biggest practical difference from v2.

FHIR is also extensible in a controlled way. Profiles and implementation guides narrow the base resources for a country or use case, for example US Core in the United States or the NRCeS guide used for ABDM in India. Validators can check a resource against a profile automatically, which removes a lot of the guesswork that v2 interfaces depend on.

For production work, FHIR R4 (4.0.1) is still the version most EHR APIs and national guides target. R5 was published in March 2023 but has seen limited adoption. Build on the version your partners actually support.

HL7 v2 vs FHIR: which should you choose?

HL7 v2 FHIR R4
Model Event messages (push) Resources with REST API (query and push)
Format Pipe-delimited text JSON or XML
Transport MLLP over TCP, files HTTPS
Typical use Inside hospitals: ADT, orders, results, scheduling, billing Patient and clinician apps, partner APIs, payer data exchange, analytics
Consistency Varies widely between sites Profiles and validators enforce structure
Security model Usually network-level (VPN, private links) OAuth 2.0 and SMART scopes per app and user
Developer experience Specialist skill, custom parsers Familiar REST and JSON tooling
Where you meet it Lab systems, older EHR modules, device gateways, billing Modern EHR APIs, regulated API programs, new products

A simple rule of thumb:

  • Choose v2 when you are integrating with systems that only emit v2 feeds, which still includes many lab, radiology and registration systems, or when you need real-time event notification from inside a hospital network.
  • Choose FHIR when you are building something new that reads or writes clinical data through an API, when partners or regulators expect FHIR, or when you want web and mobile developers to work without learning v2.
  • Choose both when you sit between the two worlds, which is most of the time.

When do you need both HL7 v2 and FHIR?

The common pattern is a v2-in, FHIR-out architecture. Existing hospital systems keep sending v2 messages. Your integration layer parses them, maps them to FHIR resources and stores or forwards those resources. New apps, analytics and partners use the FHIR API and never see a pipe character.

LIS / ADT / RIS  --(HL7 v2 over MLLP)-->  Listener + ACK
                                              |
                                        Parse, validate, map
                                              |
                                  FHIR server / FHIR facade  <-- apps, partners, analytics
                                              |
                                     Events (Kafka / RabbitMQ)

The reverse also happens. A patient app books an appointment through a FHIR API, and the integration layer turns that into an SIU scheduling message for a practice management system that only understands v2.

Things that make this work in practice:

  1. A canonical model. Decide which FHIR profiles are your internal truth and map every source to them, instead of mapping each source to each target.
  2. Terminology mapping. Local lab codes need mapping to LOINC, and diagnoses to SNOMED CT or ICD-10 where your market uses them. Budget real time for this.
  3. Idempotency. v2 senders retry. Use the message control ID (MSH-10) and business identifiers to avoid duplicate resources.
  4. Error queues and replay. A rejected message must land somewhere visible, with a way to fix and replay it, not disappear into a log file.

Do you need an interface engine?

An interface engine is middleware built for healthcare messaging. It manages connections, parses and transforms messages, routes them and gives operations staff a console to see what failed. Common options include Rhapsody, InterSystems HealthShare and IRIS, NextGen Connect (formerly Mirth Connect), and cloud services such as Azure Health Data Services, Google Cloud Healthcare API and AWS HealthLake for the FHIR side.

You probably want an engine when:

  • You connect to many systems at a hospital or network level and an operations team will run interfaces day to day.
  • The organization already owns one and has staff who know it.
  • You need many v2 feeds with routing and filtering rules that change often.

A lightweight custom service is often the better choice when:

  • You are a software product connecting to a handful of systems through a known set of message types.
  • You want the integration code in the same repository, CI pipeline and test suite as the rest of your product.
  • You need FHIR APIs more than v2 routing, in which case a FHIR server such as HAPI FHIR plus a small v2 listener can be enough.

Either way, the engineering requirements are the same: validation, mapping documents under version control, monitoring of volumes and failures, alerting, and replay.

What is SMART on FHIR?

SMART on FHIR is the standard way for third-party apps to plug into an EHR. The SMART App Launch framework uses OAuth 2.0 and OpenID Connect so an app can be launched from inside the EHR (with the current patient and user in context) or stand alone, and receive an access token limited to specific scopes, such as patient/Observation.rs.

For your team this means:

  • No shared passwords or direct database access. The app gets a token scoped to what the user and the EHR allow.
  • Context for free. An EHR launch tells your app which patient and encounter the clinician has open.
  • Backend services authorization for system-to-system access, using signed JWT client assertions instead of a user login.
  • Vendor approval. Production access to an EHR’s FHIR API is granted by the vendor or the provider organization. Plan that registration and review into your timeline, because it is often the longest step.

In the United States, certified EHRs are required to offer standardized FHIR APIs, which is why SMART on FHIR has become the default route for apps that work with patient records.

What does HIPAA-aligned engineering look like?

There is no official HIPAA certification for software or vendors. If you handle protected health information (PHI) for a US covered entity, you are expected to implement the Security Rule’s administrative, physical and technical safeguards, and vendors that handle PHI sign a Business Associate Agreement (BAA). An update to the Security Rule was proposed in January 2025 but had not been finalized as of November 2026.

In engineering terms, that translates into a checklist you can review in code and infrastructure:

  • Encryption in transit (TLS for FHIR, and a VPN or TLS wrapper around MLLP, which has no encryption of its own) and at rest for databases, queues, backups and logs.
  • Access control with unique user identities, role-based permissions and SMART scopes, and no shared service accounts for people.
  • Audit logging of who read or changed which record and when, stored so it cannot be quietly edited. FHIR’s AuditEvent and Provenance resources can help.
  • Minimum necessary data in each message, API response and log line. Never log full v2 messages or FHIR bundles in plain application logs.
  • De-identification before data goes to analytics or AI, using the Safe Harbor or Expert Determination methods.
  • Backups, recovery tests and an incident runbook, including how you would meet breach notification timelines.

This is engineering guidance, not legal advice. Your compliance and legal teams decide what your obligations are.

From our projects

At MultiGenesys we treat integrations as products, with mapping documents, validation, error queues and monitoring. A few examples from our work:

  • For a US patient engagement company, our engineers worked on a shared Java library of EHR connectors using FHIR R4 (HAPI FHIR), HL7 v2 and vendor REST APIs, with a FHIR-based master-data service that publishes changes to Kafka. You can read the anonymized patient scheduling and EHR integration use case.
  • For a health insurer onboarding hospital networks, we built a deterministic engine that maps hospital service catalogues to clinical codes, with reviewers handling the uncertain items and every state change in an append-only audit log. See the clinical code mapping use case.
  • Zylon, the cloud LIMS we built for Chemtech Labs, runs per-tenant databases with audit trails on nearly every entity, which is the same discipline lab and EHR integrations depend on.

More background is on our healthcare software development page.

How much does an HL7 or FHIR integration cost?

We do not quote prices without seeing the systems involved, because the cost drivers vary so much:

  • Number of systems and message types. Five feeds from one lab system is a very different job from twenty feeds across three vendors.
  • Quality of partner documentation and test environments. Missing specs and no sandbox add weeks.
  • Terminology work. Mapping local codes to LOINC or SNOMED CT is often underestimated.
  • Vendor approval and certification steps for EHR app marketplaces.
  • Operational requirements, such as 24x7 monitoring, replay tooling and audit reporting.

A short discovery that lists every system, message type and data owner is the most reliable way to get a real estimate.

If you want a second pair of eyes on your integration plan, we offer a free 30-minute review with an engineer who has built these interfaces. Get in touch and tell us which systems you need to connect, or see our HL7 and FHIR integration services.

FAQ

Is FHIR replacing HL7 v2?

Not soon. FHIR is the default for new APIs and apps, but HL7 v2 still carries most in-hospital messaging and will for years. Plan to support both and convert between them at your integration layer.

Can I convert HL7 v2 messages to FHIR automatically?

Partly. Open-source and cloud tools provide v2-to-FHIR mappings for common messages, and HL7 publishes a v2-to-FHIR mapping guide. Site-specific fields, Z segments and local codes still need a reviewed mapping for each interface.

Which FHIR version should we use?

FHIR R4 (4.0.1) for most production work in 2026. It is what most EHR APIs and national implementation guides support. Use R5 only if every partner you exchange data with supports it.

Is HL7 v2 secure?

The standard itself has no encryption or authentication. Secure it at the transport and network level with VPNs, private links or TLS-wrapped MLLP, restrict which hosts can connect, and audit every message that touches PHI.

Do we need an interface engine to build a FHIR API?

No. A FHIR server or a FHIR facade over your existing database can be built without an engine. Engines earn their place when you route many v2 feeds between many systems and an operations team needs a console to manage them.

Free AI audit Let’s talk