Skip to content

HL7 & FHIR mapping guide

HL7 v2 to FHIR Mapping: A Practical Conversion Guide

Converting an HL7 v2 message to FHIR means translating a versioned clinical event into a graph of resources. Changing pipes into JSON is only the first step. Identifiers, patient context, timing, code systems and the meaning of the trigger event determine whether the resulting resources say what the source actually says.

Start with the declared source version

Read MSH-9 for the message family, trigger and optional structure, and MSH-12 for the declared HL7 version. An ADT admission, an ORU result and an SIU scheduling update describe different operations. The same field position can have different constraints across versions, so a converter needs the appropriate source layout before it chooses a FHIR target.

V2Lift keeps the declared version. Native nHapi models cover 2.1 through 2.8.1; pinned definition adapters handle 2.8.2, 2.9 and 2.9.1. Each supported event has its own version range. HL7 2.0 is available for untyped inspection only because its original clinical layout has not been verified.

Map a resource graph, not an isolated object

A PID segment supplies Patient data. PV1 can add an Encounter. In an ORU result, order context contributes a ServiceRequest and DiagnosticReport while OBX segments contribute Observations. These resources need consistent subject and order references. Assigning every result to the first patient or the last order in a message can produce plausible JSON with incorrect relationships.

Source contextFHIR R4 targetMapping purpose
PIDPatientIdentity and demographic fields
PV1EncounterVisit class, state, identifier and period
OBRServiceRequest / DiagnosticReportOrder context and result organization
OBX in ORUObservationSupported values, units and result status
EVNProvenanceEvent timing and selected source context

Keep identifiers separate from generated resource IDs

An identifier names a patient or order within an issuing system. A FHIR resource ID addresses a resource representation. V2Lift generates stable IDs from the complete canonical parsed message and resource position. A changed input can therefore produce changed IDs. Those IDs are not a patient matching service and must not be used as cross-message reconciliation keys.

Preserve the assigning authority and identifier type when the supported source components provide them. A similar name or date of birth does not establish that two records belong to one person. Identity-change events need explicit policies; they cannot be inferred from a demographic resemblance.

Transform datatypes and vocabulary explicitly

Composite v2 datatypes need field-aware transforms. A patient CX identifier is not an XPN name, and a CE/CWE code is not an ordinary string. Numeric observations need a value, unit and known unit system. Code-system abbreviations must be resolved deliberately; an unknown namespace must not acquire a well-known coding-system URI just because the code looks familiar.

Precision also matters. A year-only birth date should stay a year, and a timestamp without a timezone should not silently become UTC. V2Lift requires an explicit offset for full mapped instants. Unsupported components, repetitions or codes remain visible rather than being described as lossless conversion.

Validate the source and target separately

Source checks ask whether the incoming message satisfies the selected source definition or guide. Target checks ask whether the generated resources satisfy the supported FHIR R4 base profiles and reference rules. One can pass while the other fails. Neither result alone establishes clinical correctness, complete terminology agreement or certification against every national implementation guide.

Run a repeatable synthetic example

Open the workspace, load a synthetic admission or laboratory sample, and convert it. Read the field mapping origins, inspect unmapped fields, then check source and FHIR findings separately. Download the Bundle only after reviewing the warnings and the patient/order references. For a custom rule, compare the resulting resources before and after approval rather than relying on a higher rule-hit count.

The hosted workspace is a synthetic demonstration. A production integration additionally needs its receiving server contract, identity policy, security controls and representative source-guide fixtures. A transaction-shaped Bundle is not evidence that an external system has accepted or applied it.

Common questions

Does HL7 v2 to FHIR conversion preserve every field?

Not automatically. V2Lift implements documented typed subsets. A field can be partly mapped while additional components remain unsupported; review field origins, warnings and unmapped data.

Can I use one mapping for all HL7 versions?

Only where its source layout and semantics have been verified for those versions. Use the per-event coverage table rather than assuming a common version label guarantees identical fields.

Source references and implementation scope

These guides explain the implemented V2Lift subset. Source specifications and guide requirements must be checked for the actual interface; the hosted workspace is a synthetic demonstration.

Follow the mapping in the workspace.

Inspect a synthetic message, review field origins and compare source findings with FHIR R4 checks.

Open the converter →

Continue reading

Related mapping guides.