HL7 v2 to FHIR Mapper

HL7 v2 to FHIR Mapper

Convert HL7 v2.x ADT, ORU, and ORM messages to FHIR R4 Bundle JSON with a detailed field-mapping table. Free, browser-only, HIPAA-compatible.

HL7 Tools

Drop .hl7 or .txt file here, or paste below

Examples:

All conversion happens locally in your browser. Your HL7 messages and PHI never leave your device. HIPAA-compatible.

Keywords

hl7 v2 to fhir converterhl7 to fhir r4 mapperhl7 adt to fhirhl7 oru to fhir observationhl7 orm to fhir servicerequesthl7 fhir migration toolhl7 v2 fhir bundle generatorhl7 v2 message to fhir onlinehl7 to fhir r4 free

Need something else?

How to use

1

Paste your HL7 v2 message into the text area or drag and drop a .hl7 file. The tool supports ADT^A01/A03/A04/A08, ORU^R01, and ORM^O01 message types.

2

Select the FHIR Bundle type — Collection (default) or Transaction — and the FHIR version (R4 or R5). Click Convert to FHIR.

3

Review the FHIR Bundle JSON rendered in the output panel. The bundle contains all generated resources (Patient, Encounter, Observation, DiagnosticReport, ServiceRequest) as entries.

4

Inspect the Mapping Table to see every HL7 field that was mapped, which FHIR resource and path it maps to, the original HL7 value, and the resulting FHIR value.

5

Click Copy JSON to copy the bundle to your clipboard, or Download .json to save the file. Use the Warnings panel to identify unmapped or missing fields.

Features

Multi-Message-Type Support

Converts ADT^A01/A03/A04/A06/A08 admit/discharge/update events to Patient + Encounter; ORU^R01 lab results to DiagnosticReport + Observation resources; and ORM^O01 orders to ServiceRequest + Patient — all from the same interface.

FHIR Field-Provenance Mapping Table

Every converted HL7 field is displayed in a provenance table showing the source segment (PID-3), field name (Patient ID List), target FHIR resource (Patient), target path (Patient.identifier[0].value), the original HL7 value, and the mapped FHIR value. Ideal for integration documentation.

Transaction and Collection Bundles

Choose Collection to produce a simple read-only bundle, or Transaction to add RESTful PUT request entries (method + url) to each resource — ready for POST to a FHIR server endpoint.

Warnings for Unmapped Segments

The tool emits warnings for common data quality issues — missing PID-3 identifiers, empty patient names, Z-segments, NK1, IN1, DG1 — that cannot be automatically mapped to R4 resources, helping you identify gaps in your HL7 messages before migration.

Curated Example Messages

Five realistic sample messages covering patient admission, discharge, lab results, lab order, and patient update are available via the Examples bar. Each loads into the tool and converts immediately so you can explore the output without needing real HL7 data.

Why Choose This Tool?

Private by Default — PHI Never Leaves Your Browser

HL7 v2 messages routinely contain patient names, MRNs, diagnoses, and lab results — all Protected Health Information. This tool converts entirely in your browser using JavaScript. No message content is sent to any server, stored in any database, or logged. Healthcare organizations can use it safely on production data from hospital workstations under BYOD policies.

Full Field-Level Traceability

Unlike simple format-converters that produce anonymous FHIR JSON, this tool generates a comprehensive field-mapping table for every conversion. You can see exactly which HL7 segment and field number produced each FHIR value, with the raw HL7 value and the resulting FHIR representation side-by-side. This level of traceability is essential during migration projects and HL7 interface audits.

Standards-Compliant FHIR R4 Output

The generated bundles follow FHIR R4 resource specifications. Patient identifiers use the HL7 v2 type-code system (MR, AN), gender is mapped using the FHIR administrative-gender code set, encounter class codes use the HL7 v3 ActCode vocabulary, and observation values distinguish quantity (NM), text (ST/TX/FT), and coded (CWE/CE) types.

Supports the Full HL7 v2.x ADT, ORU, and ORM Spectrum

ADT events A01 (admit), A03 (discharge), A04 (register outpatient), A06 (transfer to inpatient), A08 (update demographics), and A02/A11/A13 are all handled. ORU^R01 supports multi-OBX result sets. ORM^O01 reads both ORC and OBR segments to populate the ServiceRequest resource. All standard HL7 delimiter variants are supported.

HL7 v2 to FHIR Migration: A Practical Guide to Mapping Messages and Resources

Why HL7 v2 to FHIR Migration Matters

HL7 v2.x has been the backbone of healthcare interoperability since the late 1980s. Hundreds of thousands of hospital interfaces worldwide still exchange ADT, ORU, ORM, and MDM messages over MLLP connections. Yet the industry is steadily shifting to FHIR R4 — driven by US federal regulations (CMS and ONC interoperability rules), SMART on FHIR app ecosystems, and cloud EHR platforms that natively speak REST + JSON. Migration projects must bridge these two worlds: preserving the clinical semantics of existing v2 messages while expressing them in FHIR resource graphs.

The Core Mapping Challenge

HL7 v2 and FHIR represent clinical information very differently. A v2 ADT^A01 message encodes a patient admission in a flat, pipe-delimited structure with segment-level relationships (PID → patient data, PV1 → visit data, EVN → event metadata). FHIR R4 represents the same event as a graph of linked resources: a Patient resource referenced by an Encounter resource, with contained or standalone Location and Practitioner resources. The mapping is conceptually straightforward but operationally complex — every component field in a v2 XPN, XCN, CX, or PL data type must be decomposed and reassembled into the right FHIR datatype.

ADT to Patient and Encounter

The most common migration task is converting ADT^A01 (admit) and ADT^A03 (discharge) messages. The PID segment maps to a FHIR Patient: PID-3 (CX list) becomes Patient.identifier, PID-5 (XPN) becomes Patient.name with family and given components, PID-8 becomes Patient.gender using the administrative-gender vocabulary, and PID-11 (XAD) becomes Patient.address. The PV1 segment maps to a FHIR Encounter: PV1-2 (Patient Class) maps to Encounter.class using the v3 ActCode system, PV1-7 (XCN) maps to Encounter.participant (attender), PV1-19 becomes Encounter.identifier, and PV1-44/PV1-45 become Encounter.period.start and .end.

ORU to DiagnosticReport and Observations

ORU^R01 messages carry laboratory, radiology, and clinical observation results. The OBR segment maps to a FHIR DiagnosticReport: OBR-4 (Universal Service ID, CWE) becomes DiagnosticReport.code, OBR-7 becomes effectiveDateTime, and OBR-14 becomes issued. Each OBX segment maps to a separate FHIR Observation resource, with the result set grouped under DiagnosticReport.result references. The OBX value type field (OBX-2) determines the FHIR observation value type: NM (Numeric) maps to valueQuantity with OBX-6 as the unit, CE/CWE maps to valueCodeableConcept, and ST/TX/FT map to valueString.

ORM to ServiceRequest

ORM^O01 messages represent orders. The ORC segment provides order control (ORC-1), placer order number (ORC-2 → ServiceRequest.identifier), filler order number (ORC-3), order status (ORC-5 → ServiceRequest.status), and ordering provider (ORC-12 → ServiceRequest.requester). The OBR segment contributes the procedure code (OBR-4 → ServiceRequest.code), requested date/time (OBR-6 → ServiceRequest.occurrenceDateTime), and priority (OBR-5 → ServiceRequest.priority).

Key Migration Considerations

  • Identifier systems: HL7 v2 CX identifiers (PID-3, PV1-19) carry an assigning authority. In FHIR, these should become Identifier.system URIs — ideally OIDs (urn:oid:...) or NamingSystem canonical URLs registered in your FHIR server.
  • Terminology: V2 table values (0001 for sex, 0004 for patient class) must be mapped to FHIR-defined code systems. Many organizations need a terminology service or lookup table to handle local codes in OBR-4 or OBX-3.
  • Z-segments: Custom Z-segments (ZDG, ZPI, ZRX) have no FHIR equivalent and require extensions or contained resources, adding project complexity.
  • Versioning: HL7 v2.3.1, v2.4, v2.5, and v2.5.1 differ in field positions and available data types. A robust mapper must handle multiple versions gracefully.
  • Bi-directional flow: Many integration architectures require both v2-to-FHIR and FHIR-to-v2 translation. Design the mapping schema to be reversible where possible.

Three Migration Workflows

The most common workflow starts with a synthetic ADT^A08 demographic update: paste it in, review the generated Patient resource in the mapping table to confirm PID-5's family and given components landed correctly in Patient.name, then copy the JSON straight into the FHIR Resource Validator to catch anything structurally off before it reaches a sandbox server.

A second workflow converts a synthetic ORU^R01 lab result. The mapping table is the fastest way to confirm OBX-2's value type drove the right FHIR shape — an NM (numeric) OBX becomes Observation.valueQuantity with the OBX-6 unit attached, while a CWE result becomes valueCodeableConcept — a distinction worth checking on every new interface rather than assuming it held.

A third converts a synthetic ORM^O01 order and deliberately includes an NK1 (next of kin) segment to see the warnings panel flag it as unmapped — a quick way to build the list of segments your migration project needs a custom extension or contained resource for, before a real interface goes live.

When Not to Use This Tool

The mapper covers ADT admit/discharge/update events, ORU lab results, and ORM orders only — message types like SIU (scheduling), MDM (documents), BAR (billing), and DFT (financial transactions) are not mapped and fall back to a partial Patient-only bundle from the PID segment. NK1, IN1, GT1, AL1, DG1, and any Z-segment are flagged as unmapped rather than translated. One more limit worth stating plainly: selecting FHIR R5 in the version control changes the label but not the mapping logic — the resource shapes produced are R4-structured regardless of which version you pick, so treat the output as R4 and validate it as R4 until R5-specific mapping is added. For anything beyond these message types, or for full profile conformance, plan on a dedicated interface engine or implementation-guide-aware mapping tool.

HL7 v2 Segment → FHIR R4 Path, in Brief

A short excerpt of the field-level mappings this tool applies, useful as a quick-reference alongside the full provenance table the tool generates for every conversion:

HL7 v2 fieldFHIR R4 pathMessage type
PID-3 (CX)Patient.identifierADT
PID-5 (XPN)Patient.nameADT
PV1-2Encounter.classADT
OBR-4 (CWE)DiagnosticReport.codeORU
OBX-5Observation.value[x]ORU
ORC-5ServiceRequest.statusORM

The complete, cumulative field-level mapping guidance for the industry is maintained by HL7 as the official v2-to-FHIR Implementation Guide, which this tool's mappings are informed by for the message types it supports.

Local Processing and HIPAA-Regulated Workflows

An ADT or ORU message being migrated is exactly the kind of record HIPAA classifies as protected health information — patient name, MRN, diagnoses, lab values. Running that message through a cloud-based conversion API would mean transmitting live PHI to a third party mid-migration. Because this mapper parses and converts entirely in the browser's JavaScript engine, an integration engineer can convert a real production message on a hospital workstation and know the content never left that machine — a meaningful difference during an active interface cutover, when real messages, not just synthetic samples, need checking.

Working Alongside Other FHIR and HL7 Tools

A migration check typically chains three tools: inspect the source message in the HL7 Viewer to confirm which segments and fields are actually populated, convert it here to FHIR R4, then paste the resulting Bundle into the FHIR Resource Validator to confirm the mapped output is structurally sound before it reaches a server. Running all three in sequence turns "will this message survive the migration?" into a concrete, private answer.

Frequently Asked Questions

Which HL7 v2 message types are supported?

The tool supports ADT^A01 (admit), ADT^A03 (discharge), ADT^A04 (register outpatient), ADT^A06 (change patient status), ADT^A08 (update demographics), ADT^A02/A11/A13 (transfer/cancel events), ORU^R01 (observation results), and ORM^O01 (general order). Other message types produce a partial Patient bundle from the PID segment with a warning.

What FHIR resources does the converter generate?

ADT messages produce a Patient resource and an Encounter resource. ORU^R01 messages produce a Patient, DiagnosticReport, and one Observation per OBX segment. ORM^O01 messages produce a Patient and a ServiceRequest. All resources are wrapped in a FHIR Bundle.

Is the output valid FHIR R4?

The output follows FHIR R4 resource structures for the supported fields. For production use, validate the bundle against a FHIR validator (e.g., the HL7 FHIR Validator or an implementation guide profile). Patient extensions, local code systems, and unsupported segment data (Z-segments, IN1, DG1) are not represented in the output.

What is the difference between Collection and Transaction bundles?

A Collection bundle is a simple container of resources with no request information — suitable for archiving or display. A Transaction bundle adds a request entry (method: PUT, url: ResourceType/id) to each resource, making it ready to POST to a FHIR server's batch/transaction endpoint for persistence.

Can I use this tool with v2 messages that contain local codes?

Yes. Local and non-standard codes in OBX-3, OBR-4, and other coded fields are preserved as-is in the FHIR coding.code field. The system URI is generated from the HL7 table ID (urn:oid:...). You may need to remap these codes to standard terminologies (LOINC, SNOMED CT) in your production pipeline.

What happens with PHI and HIPAA compliance?

All processing is performed locally in your browser using JavaScript. No HL7 message content is transmitted to any server or stored anywhere outside your browser session. The tool is designed to be HIPAA-compatible for use in healthcare environments. Always verify compliance with your organization's security policies before using any tool with production PHI.

How are Z-segments handled?

Z-segments (custom segments that start with Z) are not mapped to any standard FHIR resource. The tool emits a warning listing the Z-segment names found in the message so you can address them in your custom extension mapping layer.

Can I convert multiple messages at once?

Currently the tool converts one HL7 message per operation. For batch conversion (multiple messages in one file), separate your messages and convert them individually. The tool accepts files via drag-and-drop.

Does this support FHIR R5?

The version selector lets you choose R5, but the mapping logic currently produces the same R4-structured resources regardless of the selection — there is no R5-specific field or extension handling yet. Treat any output as FHIR R4 and validate it accordingly until R5-specific mapping ships.

How do I interpret the mapping table status colors?

Green 'mapped' means the field was fully converted to a FHIR equivalent. Amber 'partial' means the field was partially mapped — for example, only some components of a complex data type (XAD, XCN) were translated. Red 'unmapped' means the field was detected but no standard FHIR mapping exists for it.

Related Articles

Learn more