Software DevelopmentBackend Development
HL7 v2 to FHIR Migration: A Step-by-Step Guide for Health IT Teams
How to migrate from HL7 v2 to FHIR R4: inventory, segment-to-resource mapping, terminology, validation, facade or migration, and a staged cutover plan.
Migrating from HL7 v2 to FHIR rarely means switching HL7 v2 off. In most hospitals and health platforms, v2 keeps running inside the walls while FHIR R4 becomes the interface for apps, partners, analytics and national exchanges. A good migration plan decides which data and which consumers move to FHIR, in what order, and how you prove nothing was lost.
This guide is for CTOs, integration leads and architects planning that move. If you need the background first, read our HL7 v2 vs FHIR guide.
Step 1: Decide what “migration” means for you
There are three different projects hiding behind the phrase “move to FHIR”:
- Interface migration. New consumers receive FHIR instead of HL7 v2 messages. The source systems still emit v2, and a conversion layer produces FHIR.
- API enablement. An existing system gets a FHIR API without moving its data. This is a FHIR facade.
- Data migration. Historic records move from a legacy store into a FHIR server, usually because the legacy system is being retired.
Many programs do all three, in that order. Being explicit about which one you are doing sets the budget, the risk and the test strategy.
Step 2: Inventory every feed and consumer
List every HL7 v2 interface: sending system, receiving system, message types and trigger events, version, transport (MLLP, file, SFTP), volume and owner. Then list every consumer that will want FHIR. Capture real traffic for each feed, not just the specification. Two systems that both say v2.5.1 can disagree on where the attending doctor or the result status lives.
Profile the captured data: distinct values per field, code frequencies, empty fields, Z-segments and repeated segments. This profile is the single most useful document in the project.
Step 3: Choose target profiles
FHIR R4 (4.0.1) is the practical target, because most EHR APIs and national guides are built on it. Base resources are not enough on their own: pick the profiles your consumers require. Examples include US Core in the United States, AU Core in Australia, the International Patient Summary and Canada’s PS-CA, India’s NRCeS profiles for ABDM, and the NPHIES profiles for insurance transactions in Saudi Arabia. In the EU, the European Health Data Space regulation phases in exchange of patient summaries and ePrescriptions from 2029, so align with the European specifications as they are published.
Step 4: Map segments to resources
HL7 publishes v2-to-FHIR mapping guidance, and it is the right starting point. Typical mappings:
| HL7 v2 | FHIR R4 |
|---|---|
| MSH | MessageHeader (or Provenance metadata) |
| PID | Patient |
| PV1 / PV2 | Encounter, Location |
| NK1 | RelatedPerson or Patient.contact |
| IN1 | Coverage |
| ORC / OBR | ServiceRequest, DiagnosticReport |
| OBX | Observation (or DocumentReference for embedded reports) |
| AL1 | AllergyIntolerance |
| DG1 | Condition |
| RXE / RXA | MedicationRequest, Immunization |
The table is the easy part. The real specification covers event semantics: an ADT^A08 updates a Patient and Encounter, an A40 merges two patients, a corrected ORU replaces earlier Observations. Write rules for each event and for each local quirk, then turn them into tests that replay captured messages.
Step 5: Map terminology deliberately
Structure is the easy half. Meaning is the hard half. Local lab codes need LOINC equivalents, diagnoses need SNOMED CT or ICD-10 (or the national modification you use, such as ICD-10-AM or ICD-10-CA), units need UCUM.
- Keep mappings as versioned FHIR ConceptMap resources, not hidden in transformation code.
- Have clinicians review uncertain mappings, and record unmapped codes instead of dropping them.
- Keep the original local code alongside the standard one in CodeableConcept.coding, so nothing is lost.
- Check SNOMED CT licensing. It is free in SNOMED International member countries through the national release center, and licensed elsewhere.
Step 6: Handle identity
HL7 v2 feeds often carry several identifiers for the same person: medical record numbers per site, national IDs, insurance numbers. Decide your Patient identifier strategy, matching rules and merge handling before loading data. Duplicate patients created during migration are expensive to undo.
Step 7: Validate everything
Validate every resource against its profile with the HL7 FHIR Validator or HAPI FHIR validation, in the pipeline, not as a one-off check. Add reconciliation: counts of patients, encounters and results per period in source and target, plus clinician spot checks of sampled records. Failures go to an exception queue with the source message attached.
Step 8: Cut over in stages
- Run the conversion in parallel with existing feeds and compare outputs.
- Move one consumer at a time to FHIR.
- Keep the v2 path available for rollback until the consumer is stable.
- Retire a v2 interface only when monitoring shows no remaining traffic to it.
For data migrations, run full dress rehearsals on a copy of production until timing and error rates are stable, then migrate, reconcile and sign off.
Facade or migration?
Use a facade when the legacy system stays in service and you need a FHIR API on it now. Use data migration when the system is being retired. A facade first, migration later is a common, low-risk sequence, and the terminology mappings you build for the facade are reused in the migration.
Common mistakes
- Treating a converter as the whole solution. Converters handle standard segments. Your local codes, Z-segments and field misuse still need explicit rules.
- Skipping terminology governance. Mappings scattered through code drift and cannot be reviewed.
- Testing with clean samples. Use months of captured traffic, including corrections, merges and cancellations.
- Forgetting security. MLLP has no encryption of its own. Run v2 inside TLS or a VPN, and protect FHIR endpoints with SMART on FHIR authorization and audit logging.
How we help
We plan and run these programs end to end: FHIR migration, FHIR facade development, HL7 interface engine development and the wider HL7 and FHIR integration practice. To talk through your interfaces, book a 30-min call.
FAQ
How long does an HL7 v2 to FHIR migration take?
It depends on the number of feeds and the quality of their codes. A single feed converted for one consumer can take weeks. Multi-system programs run in phases over months. An inventory and data profile gives a per-feed estimate.
Can we keep HL7 v2 after moving to FHIR?
Yes. Most hospitals keep v2 for internal departmental and device feeds and convert to FHIR at the edge.
Which FHIR version should we target?
FHIR R4 (4.0.1), because most EHR APIs and national implementation guides use it. Design mappings so a later move to R5 or R6 is a smaller step.
Do we need an interface engine?
Not always. A few stable feeds can run as small, tested services. Many feeds and partners usually justify an engine for routing, monitoring and replay.
Newsletter
Get the MultiGenesys newsletter
Practical notes on AI, software engineering and automation from our engineers. One email a month, no spam, unsubscribe anytime.

