HL7 v2 to FHIR examples
Admissions, results, orders, documents, appointments, immunizations, pharmacy and billing messages next to the FHIR they become.
Zato converts HL7 v2 messages to FHIR with a single call, msg.to_fhir(), and this page shows what that looks like in practice - using admissions, lab results, orders, documents, appointments, immunizations, pharmacy and billing.
Open any example below to see the HL7 v2 message as it would arrive over MLLP, the code that converts it, the full FHIR bundle it produces and a table of which segment fields ended up in which FHIR elements.
ADT^A01 - patient admitted to wardADT_A01
MSH|^~\&|ADT|GENHOSP|EHR|GENHOSP|20260315101112||ADT^A01^ADT_A01|MSG0001|P|2.5.1
EVN|A01|20260315101000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M|||123 Main St^^Boston^MA^02101||^PRN^PH^^1^617^5550123
NK1|1|Smith^Jane|SPO^Spouse^HL70063|||^PRN^PH^^1^617^5550124
PV1|1|I|WEST^201^B^GENHOSP||||1234^Jones^Maria^^^^MD|||MED||||7|||1234^Jones^Maria^^^^MD|INP|V2026001^^^GENHOSP|||||||||||||||||||||||||20260315101000
DG1|1||I10^Essential hypertension^I10|||A
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:76f80c80-ee89-53fc-a2fa-19a39d86af48",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "A01"
},
"source": {
"name": "ADT",
"endpoint": "urn:zato:hl7v2:authority:ADT"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
{
"reference": "urn:uuid:4882e93c-7133-560d-8134-9b4946d19675"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male",
"address": [
{
"line": [
"123 Main St"
],
"city": "Boston",
"state": "MA",
"postalCode": "02101"
}
],
"telecom": [
{
"value": "+1 617 5550123",
"use": "home",
"system": "phone"
}
]
}
},
{
"request": {
"method": "POST",
"url": "RelatedPerson"
},
"fullUrl": "urn:uuid:a401aaa6-ead7-59d3-b13a-cf9872926313",
"resource": {
"resourceType": "RelatedPerson",
"patient": {
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
"name": [
{
"family": "Smith",
"given": [
"Jane"
]
}
],
"relationship": [
{
"coding": [
{
"code": "SPO",
"display": "Spouse",
"system": "http://terminology.hl7.org/CodeSystem/v2-0063"
}
],
"text": "Spouse"
}
],
"telecom": [
{
"value": "+1 617 5550124",
"use": "home",
"system": "phone"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:4882e93c-7133-560d-8134-9b4946d19675",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
}
}
],
"type": [
{
"coding": [
{
"code": "INP"
}
],
"text": "INP"
}
],
"participant": [
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ATND"
}
]
}
],
"individual": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
},
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ADM"
}
]
}
],
"individual": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
}
],
"serviceType": {
"coding": [
{
"code": "MED"
}
],
"text": "MED"
},
"hospitalization": {
"admitSource": {
"coding": [
{
"code": "7"
}
],
"text": "7"
}
},
"identifier": [
{
"value": "V2026001",
"system": "urn:zato:hl7v2:authority:GENHOSP"
}
],
"period": {
"start": "2026-03-15T10:10:00+00:00"
},
"diagnosis": [
{
"condition": {
"reference": "urn:uuid:220d6312-5798-5ea1-a44d-8ab768a88cea"
},
"use": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
"code": "AD"
}
]
}
}
]
}
},
{
"request": {
"method": "POST",
"url": "Condition"
},
"fullUrl": "urn:uuid:220d6312-5798-5ea1-a44d-8ab768a88cea",
"resource": {
"resourceType": "Condition",
"subject": {
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
"encounter": {
"reference": "urn:uuid:4882e93c-7133-560d-8134-9b4946d19675"
},
"code": {
"coding": [
{
"code": "I10",
"display": "Essential hypertension",
"system": "http://hl7.org/fhir/sid/icd-10"
}
],
"text": "Essential hypertension"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0001"
},
"timestamp": "2026-03-15T10:11:12+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| MSH-9 | MessageHeader.eventCoding |
| MSH-4, MSH-6 | Sending and receiving Organization, referenced as MessageHeader.sender and destination.receiver |
| PID-3 | Patient.identifier with its MR type |
| PID-5 | Patient.name |
| PID-7, PID-8 | Patient.birthDate and gender |
| PID-11 | Patient.address |
| PID-13 | Patient.telecom, a home phone |
| NK1 | RelatedPerson with the spouse relationship and phone |
| PV1-2 | Encounter.class |
| PV1-3 | Ward, room and bed Location resources, the bed as Encounter.location |
| PV1-7, PV1-17 | Practitioner resources as Encounter.participant, attending and admitting |
| PV1-10 | Encounter.serviceType |
| PV1-14 | Encounter.hospitalization.admitSource |
| PV1-18 | Encounter.type |
| PV1-19 | Encounter.identifier |
| PV1-44 | Encounter.period.start |
| DG1-3, DG1-6 | Condition.code and category, referenced as Encounter.diagnosis |
ADT^A03 - patient discharged to homeADT_A03
MSH|^~\&|ADT|GENHOSP|EHR|GENHOSP|20260318150000||ADT^A03^ADT_A03|MSG0002|P|2.5.1
EVN|A03|20260318150000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|I|WEST^201^B^GENHOSP||||1234^Jones^Maria^^^^MD|||MED|||||||||V2026001^^^GENHOSP|||||||||||||||||01|HOME|||||||20260315101000|20260318143000
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:a8a45a29-be8d-57cf-b88a-60fcd2d88157",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "A03"
},
"source": {
"name": "ADT",
"endpoint": "urn:zato:hl7v2:authority:ADT"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:29520485-4039-5af9-bf91-324005e5fd7f"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:7c1b9d4c-2e35-53fa-8db0-c7e45f1a050f",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "HOME"
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:29520485-4039-5af9-bf91-324005e5fd7f",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "finished",
"location": [
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
}
}
],
"participant": [
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ATND"
}
]
}
],
"individual": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
}
],
"serviceType": {
"coding": [
{
"code": "MED"
}
],
"text": "MED"
},
"hospitalization": {
"dischargeDisposition": {
"coding": [
{
"code": "01"
}
],
"text": "01"
},
"destination": {
"reference": "urn:uuid:7c1b9d4c-2e35-53fa-8db0-c7e45f1a050f"
}
},
"identifier": [
{
"value": "V2026001",
"system": "urn:zato:hl7v2:authority:GENHOSP"
}
],
"period": {
"start": "2026-03-15T10:10:00+00:00",
"end": "2026-03-18T14:30:00+00:00"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0002"
},
"timestamp": "2026-03-18T15:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| MSH-9 | Encounter.status finished, the A03 event ends the encounter |
| PV1-3 | Ward, room and bed Location resources, the bed as Encounter.location |
| PV1-36 | Encounter.hospitalization.dischargeDisposition |
| PV1-37 | A Location referenced as Encounter.hospitalization.destination |
| PV1-44, PV1-45 | Encounter.period.start and end |
ADT^A02 - patient transferred between wardsADT_A02
MSH|^~\&|ADT|GENHOSP|EHR|GENHOSP|20260316090000||ADT^A02^ADT_A02|MSG0003|P|2.5.1
EVN|A02|20260316090000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|I|ICU^3^A^GENHOSP|||WEST^201^B^GENHOSP|1234^Jones^Maria^^^^MD|||MED|||||||||V2026001^^^GENHOSP
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:29527903-8a16-5b05-90de-a0b8805eb8f9",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "A02"
},
"source": {
"name": "ADT",
"endpoint": "urn:zato:hl7v2:authority:ADT"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:11e0421f-3ccb-51b0-870d-c5729851c08a"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:0f05adee-1867-5c8e-b2cb-dfa8ad1a36c7",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "ICU",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:1a2bfd0b-1950-5223-8d3a-e724d1c3487d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "3",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:0f05adee-1867-5c8e-b2cb-dfa8ad1a36c7"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:ead754c0-f812-5eaf-ad37-7bd2bb0c7ee1",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "A",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:1a2bfd0b-1950-5223-8d3a-e724d1c3487d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:11e0421f-3ccb-51b0-870d-c5729851c08a",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:ead754c0-f812-5eaf-ad37-7bd2bb0c7ee1"
}
},
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
},
"status": "completed"
}
],
"participant": [
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ATND"
}
]
}
],
"individual": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
}
],
"serviceType": {
"coding": [
{
"code": "MED"
}
],
"text": "MED"
},
"identifier": [
{
"value": "V2026001",
"system": "urn:zato:hl7v2:authority:GENHOSP"
}
],
"period": {
"start": "2026-03-16T09:00:00+00:00"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0003"
},
"timestamp": "2026-03-16T09:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| PV1-3 | The current ward, room and bed, the bed as the first Encounter.location |
| PV1-6 | The prior ward, room and bed, the bed as the second Encounter.location with status completed |
| PV1-3.4, PV1-6.4 | The facility Location that all wards are part of |
ADT^A08 - patient update with insuranceADT_A01
MSH|^~\&|ADT|GENHOSP|EHR|GENHOSP|20260316120000||ADT^A08^ADT_A01|MSG0004|P|2.5.1
EVN|A08|20260316120000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M|||123 Main St^^Boston^MA^02101||^PRN^PH^^1^617^5550123
PV1|1|I|WEST^201^B^GENHOSP||||1234^Jones^Maria^^^^MD|||MED|||||||||V2026001^^^GENHOSP|COM
IN1|1|PPO01^Preferred Plan|BCBS001^^^NAIC|Blue Cross Blue Shield|100 Insurance Way^^Boston^MA^02110|||GRP2026|Acme Corp|||20260101|20261231|||Smith^Jane|SPO|19820420|123 Main St^^Boston^MA^02101|||||||||||||||||POL998877|||||||F
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:e16d0442-bf00-5d8c-9d40-ee4f40da4708",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "A08"
},
"source": {
"name": "ADT",
"endpoint": "urn:zato:hl7v2:authority:ADT"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
{
"reference": "urn:uuid:d42db04c-c844-5410-8350-26578621d219"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male",
"address": [
{
"line": [
"123 Main St"
],
"city": "Boston",
"state": "MA",
"postalCode": "02101"
}
],
"telecom": [
{
"value": "+1 617 5550123",
"use": "home",
"system": "phone"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:d42db04c-c844-5410-8350-26578621d219",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
}
}
],
"participant": [
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ATND"
}
]
}
],
"individual": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
}
],
"serviceType": {
"coding": [
{
"code": "MED"
}
],
"text": "MED"
},
"identifier": [
{
"value": "V2026001",
"system": "urn:zato:hl7v2:authority:GENHOSP"
}
],
"period": {
"start": "2026-03-16T12:00:00+00:00"
}
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:7944d677-78e0-5bad-b57d-c155682b7f74",
"resource": {
"resourceType": "Organization",
"name": "Blue Cross Blue Shield",
"identifier": [
{
"value": "BCBS001",
"system": "urn:zato:hl7v2:authority:NAIC"
}
],
"address": [
{
"line": [
"100 Insurance Way"
],
"city": "Boston",
"state": "MA",
"postalCode": "02110"
}
]
}
},
{
"request": {
"method": "POST",
"url": "RelatedPerson"
},
"fullUrl": "urn:uuid:9715e49b-21c8-5226-b851-0ed9cc542391",
"resource": {
"resourceType": "RelatedPerson",
"patient": {
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
"name": [
{
"family": "Smith",
"given": [
"Jane"
]
}
],
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0063",
"code": "SPO"
}
]
}
],
"birthDate": "1982-04-20",
"address": [
{
"line": [
"123 Main St"
],
"city": "Boston",
"state": "MA",
"postalCode": "02101"
}
],
"gender": "female"
}
},
{
"request": {
"method": "POST",
"url": "Coverage"
},
"fullUrl": "urn:uuid:94e1e0c8-098e-5460-9348-6fe043081a18",
"resource": {
"resourceType": "Coverage",
"status": "active",
"beneficiary": {
"reference": "urn:uuid:66c03b9a-a354-5d35-be60-e38353ca874b"
},
"payor": [
{
"reference": "urn:uuid:7944d677-78e0-5bad-b57d-c155682b7f74"
}
],
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0064",
"code": "COM"
}
]
},
"class": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/coverage-class",
"code": "plan"
}
]
},
"value": "PPO01"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/coverage-class",
"code": "group"
}
]
},
"value": "GRP2026",
"name": "Acme Corp"
}
],
"period": {
"start": "2026-01-01",
"end": "2026-12-31"
},
"relationship": {
"coding": [
{
"code": "spouse",
"system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship"
}
],
"text": "SPO"
},
"subscriber": {
"reference": "urn:uuid:9715e49b-21c8-5226-b851-0ed9cc542391"
},
"identifier": [
{
"value": "POL998877"
}
],
"subscriberId": "POL998877"
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0004"
},
"timestamp": "2026-03-16T12:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| PV1-20 | Coverage.type, the financial class |
| IN1-2 | Coverage.class of type plan |
| IN1-3, IN1-4, IN1-5 | The payor Organization with its identifier, name and address, referenced as Coverage.payor |
| IN1-8, IN1-9 | Coverage.class of type group, with the employer as its name |
| IN1-12, IN1-13 | Coverage.period |
| IN1-16, IN1-18, IN1-19, IN1-43 | The subscriber RelatedPerson with name, birth date, address and gender |
| IN1-17 | Coverage.relationship |
| IN1-36 | Coverage.subscriberId |
ADT^A40 - two patient records mergedADT_A39
MSH|^~\&|ADT|GENHOSP|EHR|GENHOSP|20260317080000||ADT^A40^ADT_A39|MSG0005|P|2.5.1
EVN|A40|20260317080000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
MRG|67890^^^GENHOSP^MR
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:748c70a1-81c5-5a1c-affb-469881d7f411",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "A40"
},
"source": {
"name": "ADT",
"endpoint": "urn:zato:hl7v2:authority:ADT"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male",
"link": [
{
"other": {
"reference": "urn:uuid:e41ec2c7-18bd-5435-9325-c0be00373427"
},
"type": "replaces"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:e41ec2c7-18bd-5435-9325-c0be00373427",
"resource": {
"resourceType": "Patient",
"active": false,
"identifier": [
{
"value": "67890",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
]
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0005"
},
"timestamp": "2026-03-17T08:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| PID | The surviving Patient |
| MRG-1 | A second, inactive Patient carrying only the prior identifier |
| PID and MRG together | Patient.link on the survivor, type replaces, pointing at the inactive one |
ORU^R01 - lipid panel with specimenORU_R01
MSH|^~\&|LAB|GENHOSP|EHR|GENHOSP|20260315143000||ORU^R01^ORU_R01|MSG0006|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|O|CLINIC^^^GENHOSP
ORC|RE|ORD2001^EHR|LAB3001^LAB|||||||||1234^Jones^Maria^^^^MD
OBR|1|ORD2001^EHR|LAB3001^LAB|24331-1^Lipid panel^LN|||20260315080000|||||||||1234^Jones^Maria^^^^MD||||||20260315140000|||F
OBX|1|NM|2093-3^Cholesterol total^LN||210|mg/dL^^UCUM|<200|H|||F|||20260315080000
OBX|2|NM|2085-9^HDL cholesterol^LN||45|mg/dL^^UCUM|>40|N|||F|||20260315080000
OBX|3|NM|2089-1^LDL cholesterol^LN||140|mg/dL^^UCUM|<100|H|||F|||20260315080000
SPM|1|SPM7001^LAB||119297000^Blood specimen^SCT|||||||||||||20260315080000|20260315081500
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:8f676e57-43c7-5273-8d5d-a3aadf67451a",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "R01"
},
"source": {
"name": "LAB",
"endpoint": "urn:zato:hl7v2:authority:LAB"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:abacf71d-261b-5b98-860b-81a6414b4436",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "CLINIC",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "AMB"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:abacf71d-261b-5b98-860b-81a6414b4436"
}
}
]
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "ServiceRequest"
},
"fullUrl": "urn:uuid:081c488f-c3c6-5941-adbd-3081086e212c",
"resource": {
"resourceType": "ServiceRequest",
"intent": "order",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93"
},
"status": "completed",
"identifier": [
{
"value": "ORD2001",
"system": "urn:zato:hl7v2:authority:EHR"
},
{
"value": "LAB3001",
"system": "urn:zato:hl7v2:authority:LAB"
}
],
"code": {
"coding": [
{
"code": "24331-1",
"display": "Lipid panel",
"system": "http://loinc.org"
}
],
"text": "Lipid panel"
},
"requester": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
},
"occurrenceDateTime": "2026-03-15T08:00:00+00:00"
}
},
{
"request": {
"method": "POST",
"url": "DiagnosticReport"
},
"fullUrl": "urn:uuid:0e687217-522d-5626-a1bf-c9e074aeeafc",
"resource": {
"resourceType": "DiagnosticReport",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93"
},
"basedOn": [
{
"reference": "urn:uuid:081c488f-c3c6-5941-adbd-3081086e212c"
}
],
"status": "final",
"code": {
"coding": [
{
"code": "24331-1",
"display": "Lipid panel",
"system": "http://loinc.org"
}
],
"text": "Lipid panel"
},
"identifier": [
{
"value": "ORD2001",
"system": "urn:zato:hl7v2:authority:EHR"
},
{
"value": "LAB3001",
"system": "urn:zato:hl7v2:authority:LAB"
}
],
"effectiveDateTime": "2026-03-15T08:00:00+00:00",
"issued": "2026-03-15T14:00:00+00:00",
"result": [
{
"reference": "urn:uuid:2ff8f466-e75c-5d3a-bd26-24dca15f9688"
},
{
"reference": "urn:uuid:5b4f62ed-0518-5c66-83cc-9a6091f13529"
},
{
"reference": "urn:uuid:e132270b-feb9-56ef-b82e-eeb6db52247c"
}
],
"specimen": [
{
"reference": "urn:uuid:255bfb8b-a623-5410-9e5b-807b4790e0cd"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Observation"
},
"fullUrl": "urn:uuid:2ff8f466-e75c-5d3a-bd26-24dca15f9688",
"resource": {
"resourceType": "Observation",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93"
},
"code": {
"coding": [
{
"code": "2093-3",
"display": "Cholesterol total",
"system": "http://loinc.org"
}
],
"text": "Cholesterol total"
},
"status": "final",
"valueQuantity": {
"value": 210.0,
"system": "http://unitsofmeasure.org",
"code": "mg/dL",
"unit": "mg/dL"
},
"referenceRange": [
{
"text": "<200"
}
],
"interpretation": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code": "H"
}
]
}
],
"effectiveDateTime": "2026-03-15T08:00:00+00:00"
}
},
{
"request": {
"method": "POST",
"url": "Observation"
},
"fullUrl": "urn:uuid:5b4f62ed-0518-5c66-83cc-9a6091f13529",
"resource": {
"resourceType": "Observation",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93"
},
"code": {
"coding": [
{
"code": "2085-9",
"display": "HDL cholesterol",
"system": "http://loinc.org"
}
],
"text": "HDL cholesterol"
},
"status": "final",
"valueQuantity": {
"value": 45.0,
"system": "http://unitsofmeasure.org",
"code": "mg/dL",
"unit": "mg/dL"
},
"referenceRange": [
{
"text": ">40"
}
],
"interpretation": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code": "N"
}
]
}
],
"effectiveDateTime": "2026-03-15T08:00:00+00:00"
}
},
{
"request": {
"method": "POST",
"url": "Observation"
},
"fullUrl": "urn:uuid:e132270b-feb9-56ef-b82e-eeb6db52247c",
"resource": {
"resourceType": "Observation",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:599f36f3-57b6-5632-a1cd-de4092d18f93"
},
"code": {
"coding": [
{
"code": "2089-1",
"display": "LDL cholesterol",
"system": "http://loinc.org"
}
],
"text": "LDL cholesterol"
},
"status": "final",
"valueQuantity": {
"value": 140.0,
"system": "http://unitsofmeasure.org",
"code": "mg/dL",
"unit": "mg/dL"
},
"referenceRange": [
{
"text": "<100"
}
],
"interpretation": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code": "H"
}
]
}
],
"effectiveDateTime": "2026-03-15T08:00:00+00:00"
}
},
{
"request": {
"method": "POST",
"url": "Specimen"
},
"fullUrl": "urn:uuid:255bfb8b-a623-5410-9e5b-807b4790e0cd",
"resource": {
"resourceType": "Specimen",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"identifier": [
{
"value": "SPM7001"
}
],
"type": {
"coding": [
{
"code": "119297000",
"display": "Blood specimen",
"system": "http://snomed.info/sct"
}
],
"text": "Blood specimen"
},
"collection": {
"collectedDateTime": "2026-03-15T08:00:00+00:00"
},
"receivedTime": "2026-03-15T08:15:00+00:00"
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0006"
},
"timestamp": "2026-03-15T14:30:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| ORC-2, ORC-3 | ServiceRequest.identifier and DiagnosticReport.identifier |
| ORC-12, OBR-16 | Practitioner as ServiceRequest.requester |
| OBR-4 | ServiceRequest.code and DiagnosticReport.code |
| OBR-7 | DiagnosticReport.effectiveDateTime |
| OBR-22 | DiagnosticReport.issued |
| OBR-25 | DiagnosticReport.status |
| OBX-3 | Observation.code |
| OBX-2, OBX-5, OBX-6 | Observation.valueQuantity with its UCUM unit |
| OBX-7 | Observation.referenceRange |
| OBX-8 | Observation.interpretation |
| OBX-11 | Observation.status |
| OBX-14 | Observation.effectiveDateTime |
| SPM-2, SPM-4, SPM-17, SPM-18 | Specimen with identifier, type, collection time and received time, referenced as DiagnosticReport.specimen |
| All OBX | DiagnosticReport.result, one reference per Observation |
ORU^R01 - radiology report as PDFORU_R01
MSH|^~\&|RAD|GENHOSP|EHR|GENHOSP|20260315160000||ORU^R01^ORU_R01|MSG0007|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
ORC|RE|ORD2002^EHR|RAD4001^RAD
OBR|1|ORD2002^EHR|RAD4001^RAD|36643-5^Chest X-ray 2 views^LN|||20260315150000|||||||||||||||20260315155000|||F
OBX|1|ED|PDF^Radiology report^L||^application^pdf^Base64^JVBERi0xLjQKJcOkw7zDtsOfCg==||||||F|||20260315155500|RAD01^Radiology Department|5678^Adams^Robert^^^^MD
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:9f84621d-6da6-51b7-aae5-e44b531759be",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "R01"
},
"source": {
"name": "RAD",
"endpoint": "urn:zato:hl7v2:authority:RAD"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "ServiceRequest"
},
"fullUrl": "urn:uuid:56754649-ff8a-58fb-a4d9-5e0570dc9ddd",
"resource": {
"resourceType": "ServiceRequest",
"intent": "order",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"status": "completed",
"identifier": [
{
"value": "ORD2002",
"system": "urn:zato:hl7v2:authority:EHR"
},
{
"value": "RAD4001",
"system": "urn:zato:hl7v2:authority:RAD"
}
],
"code": {
"coding": [
{
"code": "36643-5",
"display": "Chest X-ray 2 views",
"system": "http://loinc.org"
}
],
"text": "Chest X-ray 2 views"
},
"occurrenceDateTime": "2026-03-15T15:00:00+00:00"
}
},
{
"request": {
"method": "POST",
"url": "DiagnosticReport"
},
"fullUrl": "urn:uuid:24e0d053-3f2b-5c70-935d-91822bb00ced",
"resource": {
"resourceType": "DiagnosticReport",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"basedOn": [
{
"reference": "urn:uuid:56754649-ff8a-58fb-a4d9-5e0570dc9ddd"
}
],
"status": "final",
"code": {
"coding": [
{
"code": "36643-5",
"display": "Chest X-ray 2 views",
"system": "http://loinc.org"
}
],
"text": "Chest X-ray 2 views"
},
"identifier": [
{
"value": "ORD2002",
"system": "urn:zato:hl7v2:authority:EHR"
},
{
"value": "RAD4001",
"system": "urn:zato:hl7v2:authority:RAD"
}
],
"effectiveDateTime": "2026-03-15T15:00:00+00:00",
"issued": "2026-03-15T15:50:00+00:00",
"performer": [
{
"reference": "urn:uuid:be5cd22f-8f79-569e-9168-3482237472e4"
},
{
"reference": "urn:uuid:64830915-86ad-552e-ac89-426872c08805"
}
],
"presentedForm": [
{
"contentType": "application/pdf",
"data": "JVBERi0xLjQKJcOkw7zDtsOfCg==",
"title": "Radiology report",
"creation": "2026-03-15T15:55:00+00:00"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:be5cd22f-8f79-569e-9168-3482237472e4",
"resource": {
"resourceType": "Organization",
"name": "Radiology Department"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:64830915-86ad-552e-ac89-426872c08805",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "5678"
}
],
"name": [
{
"family": "Adams",
"given": [
"Robert"
],
"suffix": [
"MD"
]
}
]
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0007"
},
"timestamp": "2026-03-15T16:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| OBX-2 | ED, the observation is an encapsulated document, so it becomes DiagnosticReport.presentedForm instead of an Observation |
| OBX-3 | presentedForm.title |
| OBX-5.2, OBX-5.3 | presentedForm.contentType |
| OBX-5.5 | presentedForm.data, the Base64 content as sent |
| OBX-14 | presentedForm.creation |
| OBX-15 | An Organization as DiagnosticReport.performer |
| OBX-16 | A Practitioner as DiagnosticReport.performer |
ORM^O01 - order with daily timingORM_O01
MSH|^~\&|EHR|GENHOSP|LAB|GENHOSP|20260315090000||ORM^O01^ORM_O01|MSG0008|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|I|WEST^201^B^GENHOSP
ORC|NW|ORD2003^EHR|||||||20260315090000|2001^Davis^Karen|3001^Miller^Thomas|1234^Jones^Maria^^^^MD|WEST^201|^WPN^PH^^1^617^5550200
OBR|1|ORD2003^EHR||1558-6^Fasting glucose^LN||||||||||||1234^Jones^Maria^^^^MD
TQ1|1||QD^Once a day^HL70335|0700|||20260316|20260318|R^Routine^HL70485||Fasting for 8 hours before each draw
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:bac2b74a-9ced-5d90-b087-5bdff9fb42e1",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "O01"
},
"source": {
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "LAB",
"endpoint": "urn:zato:hl7v2:authority:LAB",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:9c8468cf-2e09-5314-8372-8996b45992d2"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:9c8468cf-2e09-5314-8372-8996b45992d2",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
}
}
]
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:39a9ead1-d6de-5807-ba0a-6d7b3d598c30",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
],
"telecom": [
{
"value": "+1 617 5550200",
"use": "work",
"system": "phone"
}
]
}
},
{
"request": {
"method": "POST",
"url": "ServiceRequest"
},
"fullUrl": "urn:uuid:451c364b-273b-5d13-98d5-1d1e8ee72b16",
"resource": {
"resourceType": "ServiceRequest",
"intent": "order",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:9c8468cf-2e09-5314-8372-8996b45992d2"
},
"status": "active",
"identifier": [
{
"value": "ORD2003",
"system": "urn:zato:hl7v2:authority:EHR"
}
],
"code": {
"coding": [
{
"code": "1558-6",
"display": "Fasting glucose",
"system": "http://loinc.org"
}
],
"text": "Fasting glucose"
},
"authoredOn": "2026-03-15T09:00:00+00:00",
"requester": {
"reference": "urn:uuid:39a9ead1-d6de-5807-ba0a-6d7b3d598c30"
},
"occurrenceTiming": {
"repeat": {
"boundsPeriod": {
"start": "2026-03-16",
"end": "2026-03-18"
},
"frequency": 1,
"period": 1,
"periodUnit": "d",
"timeOfDay": [
"07:00:00"
]
},
"code": {
"text": "Fasting for 8 hours before each draw"
}
},
"priority": "routine"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:8e77e133-69bb-5538-ad98-18766aee3976",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "2001"
}
],
"name": [
{
"family": "Davis",
"given": [
"Karen"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:a02db109-666f-5319-b7cc-4e68b9076687",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "3001"
}
],
"name": [
{
"family": "Miller",
"given": [
"Thomas"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:3de5a3f6-9640-55fd-977a-ca567c423e57",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:f6de23a9-f70c-5eec-9554-3365c9642d15",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:3de5a3f6-9640-55fd-977a-ca567c423e57"
}
}
},
{
"request": {
"method": "POST",
"url": "Provenance"
},
"fullUrl": "urn:uuid:f9ea6ffd-eb3b-5a19-8b41-7bb559559b50",
"resource": {
"resourceType": "Provenance",
"target": [
{
"reference": "urn:uuid:451c364b-273b-5d13-98d5-1d1e8ee72b16"
}
],
"recorded": "2026-03-15T09:00:00+00:00",
"agent": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
"code": "enterer"
}
]
},
"who": {
"reference": "urn:uuid:8e77e133-69bb-5538-ad98-18766aee3976"
}
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
"code": "verifier"
}
]
},
"who": {
"reference": "urn:uuid:a02db109-666f-5319-b7cc-4e68b9076687"
}
}
],
"location": {
"reference": "urn:uuid:f6de23a9-f70c-5eec-9554-3365c9642d15"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0008"
},
"timestamp": "2026-03-15T09:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| ORC-1 | ServiceRequest.status and intent, NW is an active order |
| ORC-9 | ServiceRequest.authoredOn |
| ORC-12 | Practitioner as ServiceRequest.requester |
| ORC-10, ORC-11 | Provenance.agent, who entered and who verified the order |
| ORC-13 | Provenance.location |
| ORC-14 | Provenance callback phone, kept on the agent |
| OBR-4 | ServiceRequest.code |
| TQ1-3 | occurrenceTiming.repeat.frequency, period and periodUnit |
| TQ1-4 | occurrenceTiming.repeat.timeOfDay |
| TQ1-7, TQ1-8 | occurrenceTiming.repeat.boundsPeriod |
| TQ1-9 | ServiceRequest.priority |
| TQ1-11 | occurrenceTiming.code.text |
OML^O21 - lab order with specimenOML_O21
MSH|^~\&|EHR|GENHOSP|LAB|GENHOSP|20260315093000||OML^O21^OML_O21|MSG0009|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
ORC|NW|ORD2004^EHR|||||||20260315093000|||1234^Jones^Maria^^^^MD
OBR|1|ORD2004^EHR||58410-2^CBC panel^LN||||||||||||1234^Jones^Maria^^^^MD
SPM|1|SPM7002^EHR||BLD^Blood^HL70487||||ARM^Arm^HL70163|||||||||20260315093000
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:b3df052d-1dd2-5aaf-94ab-b9c2b86ad6c5",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "O21"
},
"source": {
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "LAB",
"endpoint": "urn:zato:hl7v2:authority:LAB",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "ServiceRequest"
},
"fullUrl": "urn:uuid:4119102c-6a53-52fb-823f-489787ddaa08",
"resource": {
"resourceType": "ServiceRequest",
"intent": "order",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"status": "active",
"identifier": [
{
"value": "ORD2004",
"system": "urn:zato:hl7v2:authority:EHR"
}
],
"code": {
"coding": [
{
"code": "58410-2",
"display": "CBC panel",
"system": "http://loinc.org"
}
],
"text": "CBC panel"
},
"authoredOn": "2026-03-15T09:30:00+00:00",
"requester": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
}
},
{
"request": {
"method": "POST",
"url": "Specimen"
},
"fullUrl": "urn:uuid:610184fc-72c5-5f92-8418-980b84233590",
"resource": {
"resourceType": "Specimen",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"identifier": [
{
"value": "SPM7002"
}
],
"type": {
"coding": [
{
"code": "BLD",
"display": "Blood",
"system": "http://terminology.hl7.org/CodeSystem/v2-0487"
}
],
"text": "Blood"
},
"collection": {
"bodySite": {
"coding": [
{
"code": "ARM",
"display": "Arm",
"system": "http://terminology.hl7.org/CodeSystem/v2-0163"
}
],
"text": "Arm"
},
"collectedDateTime": "2026-03-15T09:30:00+00:00"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0009"
},
"timestamp": "2026-03-15T09:30:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| ORC-9 | ServiceRequest.authoredOn |
| ORC-12 | Practitioner as ServiceRequest.requester |
| OBR-4 | ServiceRequest.code |
| SPM-2 | Specimen.identifier |
| SPM-4 | Specimen.type |
| SPM-8 | Specimen.collection.bodySite |
| SPM-17 | Specimen.collection.collectedDateTime |
| SPM | ServiceRequest.specimen, the reference back to the Specimen |
MDM^T02 - discharge summary as textMDM_T02
MSH|^~\&|EHR|GENHOSP|HIM|GENHOSP|20260318160000||MDM^T02^MDM_T02|MSG0010|P|2.5.1
EVN|T02|20260318160000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|I|WEST^201^B^GENHOSP||||||||||||||||V2026001^^^GENHOSP
TXA|1|DS^Discharge summary^HL70270|TX|20260318153000|1234^Jones^Maria^^^^MD|||||||DOC5001^EHR||||discharge-summary.txt|AU||AV
OBX|1|TX|18842-5^Discharge summary^LN||Admitted with chest pain, ruled out for myocardial infarction.||||||F
OBX|2|TX|18842-5^Discharge summary^LN||Discharged home in stable condition with follow-up in two weeks.||||||F
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:1326ba16-40ae-5af4-9be7-2f1acb80063c",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "T02"
},
"source": {
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "HIM",
"endpoint": "urn:zato:hl7v2:authority:HIM",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:32362413-ab32-55f4-8f88-5fa9bd405c9f"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:32362413-ab32-55f4-8f88-5fa9bd405c9f",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
}
}
],
"identifier": [
{
"value": "V2026001",
"system": "urn:zato:hl7v2:authority:GENHOSP"
}
],
"period": {
"start": "2026-03-18T16:00:00+00:00"
}
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "DocumentReference"
},
"fullUrl": "urn:uuid:2ef82ded-93d1-572b-b2cc-eccd2c36c2aa",
"resource": {
"resourceType": "DocumentReference",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"status": "current",
"docStatus": "final",
"type": {
"coding": [
{
"code": "DS",
"display": "Discharge summary",
"system": "http://terminology.hl7.org/CodeSystem/v2-0270"
}
],
"text": "Discharge summary"
},
"date": "2026-03-18T15:30:00+00:00",
"author": [
{
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
],
"masterIdentifier": {
"value": "DOC5001",
"system": "urn:zato:hl7v2:authority:EHR"
},
"content": [
{
"attachment": {
"contentType": "text/plain",
"title": "discharge-summary.txt",
"data": "QWRtaXR0ZWQgd2l0aCBjaGVzdCBwYWluLCBydWxlZCBvdXQgZm9yIG15b2NhcmRpYWwgaW5mYXJjdGlvbi4KRGlzY2hhcmdlZCBob21lIGluIHN0YWJsZSBjb25kaXRpb24gd2l0aCBmb2xsb3ctdXAgaW4gdHdvIHdlZWtzLg=="
}
}
]
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0010"
},
"timestamp": "2026-03-18T16:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| TXA-2 | DocumentReference.type |
| TXA-3 | content.attachment.contentType, TX is text/plain |
| TXA-4 | DocumentReference.date |
| TXA-5 | Practitioner as DocumentReference.author |
| TXA-12 | DocumentReference.masterIdentifier |
| TXA-16 | content.attachment.title |
| TXA-17 | DocumentReference.docStatus |
| TXA-19 | DocumentReference.status |
| OBX-5 of each TX line | content.attachment.data, the lines joined with newlines and Base64-encoded |
| PV1 | Encounter referenced as DocumentReference.context.encounter |
SIU^S12 - new appointment bookedSIU_S12
MSH|^~\&|SCHED|GENHOSP|EHR|GENHOSP|20260320100000||SIU^S12^SIU_S12|MSG0011|P|2.5.1
SCH|APT6001^SCHED|||||FOLLOWUP^Follow-up visit^L|FOLLOWUP^Follow-up visit^L|ROUTINE^Routine^HL70276|30|min^minute^UCUM|^^^20260401140000^20260401143000|||||2001^Davis^Karen||||3001^Miller^Thomas|||||Booked
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
RGS|1
AIS|1||99213^Office visit established patient^CPT
AIP|1||1234^Jones^Maria^^^^MD|ATTENDING^Attending physician^L
AIL|1||CLINIC^ROOM5^^GENHOSP|CLINIC^Outpatient clinic^L
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:7a101d4d-d42e-5881-bcc8-7e22888e0cf0",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "S12"
},
"source": {
"name": "SCHED",
"endpoint": "urn:zato:hl7v2:authority:SCHED"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:8e77e133-69bb-5538-ad98-18766aee3976",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "2001"
}
],
"name": [
{
"family": "Davis",
"given": [
"Karen"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Appointment"
},
"fullUrl": "urn:uuid:0e7c99e6-0739-5cb3-8aa8-610064a845c4",
"resource": {
"resourceType": "Appointment",
"status": "booked",
"identifier": [
{
"value": "APT6001",
"system": "urn:zato:hl7v2:authority:SCHED"
}
],
"reasonCode": [
{
"coding": [
{
"code": "FOLLOWUP",
"display": "Follow-up visit"
}
],
"text": "Follow-up visit"
}
],
"appointmentType": {
"coding": [
{
"code": "ROUTINE",
"display": "Routine",
"system": "http://terminology.hl7.org/CodeSystem/v2-0276"
}
],
"text": "Routine"
},
"minutesDuration": 30,
"start": "2026-04-01T14:00:00+00:00",
"end": "2026-04-01T14:30:00+00:00",
"extension": [
{
"url": "urn:zato:hl7v2:extension/unmapped/SCH-6",
"valueString": "FOLLOWUP^Follow-up visit^L"
},
{
"url": "urn:zato:hl7v2:extension/unmapped/SCH-20",
"valueString": "3001^Miller^Thomas"
}
],
"serviceType": [
{
"coding": [
{
"code": "99213",
"display": "Office visit established patient",
"system": "http://www.ama-assn.org/go/cpt"
}
],
"text": "Office visit established patient"
}
],
"participant": [
{
"actor": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"status": "accepted"
},
{
"actor": {
"reference": "urn:uuid:8e77e133-69bb-5538-ad98-18766aee3976"
},
"status": "accepted"
},
{
"actor": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
},
"status": "accepted"
},
{
"actor": {
"reference": "urn:uuid:b11ed152-c6c5-544e-811c-5b0d63bb0c74"
},
"status": "accepted"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:abacf71d-261b-5b98-860b-81a6414b4436",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "CLINIC",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:b11ed152-c6c5-544e-811c-5b0d63bb0c74",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "ROOM5",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:abacf71d-261b-5b98-860b-81a6414b4436"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0011"
},
"timestamp": "2026-03-20T10:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| SCH-1 | Appointment.identifier |
| SCH-7 | Appointment.reasonCode |
| SCH-8 | Appointment.appointmentType |
| SCH-9, SCH-10 | Appointment.minutesDuration |
| SCH-11.4, SCH-11.5 | Appointment.start and end |
| SCH-16 | The filler contact Practitioner as a participant |
| SCH-25 | Appointment.status |
| SCH-6, SCH-20 | Extensions on the Appointment - the event reason and who entered it have no FHIR element |
| PID | Patient as a participant |
| AIS-3 | Appointment.serviceType |
| AIP-3, AIP-4 | A Practitioner as a participant with the role as participant.type |
| AIL-3 | A Location as a participant |
VXU^V04 - flu vaccine administeredVXU_V04
MSH|^~\&|EHR|GENHOSP|IIS|STATE|20260315110000||VXU^V04^VXU_V04|MSG0012|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
ORC|RE||IMM8001^EHR
RXA|0|1|20260315104500|20260315104500|140^Influenza seasonal injectable preservative free^CVX|0.5|mL^^UCUM||00^New immunization record^NIP001|2001^Davis^Karen^^^^RN|||||FLU2026A|20261031|SKB^GlaxoSmithKline^MVX|||CP
RXR|IM^Intramuscular^HL70162|LD^Left deltoid^HL70163
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:6eb8c34e-dbbe-5ca5-831a-52562b546a3f",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "V04"
},
"source": {
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "IIS",
"endpoint": "urn:zato:hl7v2:authority:IIS",
"receiver": {
"reference": "urn:uuid:bc4315e3-7b7a-5802-a099-32c9187d1954"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:bc4315e3-7b7a-5802-a099-32c9187d1954",
"resource": {
"resourceType": "Organization",
"name": "STATE"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:efa19c42-f658-56b6-8451-65a33e862019",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "2001"
}
],
"name": [
{
"family": "Davis",
"given": [
"Karen"
],
"suffix": [
"RN"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:c583125c-2587-5feb-b4be-549700375cb3",
"resource": {
"resourceType": "Organization",
"name": "GlaxoSmithKline"
}
},
{
"request": {
"method": "POST",
"url": "Immunization"
},
"fullUrl": "urn:uuid:44a95e10-bab3-51c3-9007-ca18ce4ed48d",
"resource": {
"resourceType": "Immunization",
"patient": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"status": "completed",
"vaccineCode": {
"coding": [
{
"code": "140",
"display": "Influenza seasonal injectable preservative free",
"system": "http://hl7.org/fhir/sid/cvx"
}
],
"text": "Influenza seasonal injectable preservative free"
},
"occurrenceDateTime": "2026-03-15T10:45:00+00:00",
"doseQuantity": {
"value": 0.5,
"system": "http://unitsofmeasure.org",
"code": "mL",
"unit": "mL"
},
"primarySource": true,
"performer": [
{
"actor": {
"reference": "urn:uuid:efa19c42-f658-56b6-8451-65a33e862019"
}
}
],
"lotNumber": "FLU2026A",
"expirationDate": "2026-10-31",
"manufacturer": {
"reference": "urn:uuid:c583125c-2587-5feb-b4be-549700375cb3"
},
"identifier": [
{
"value": "IMM8001",
"system": "urn:zato:hl7v2:authority:EHR"
}
],
"route": {
"coding": [
{
"code": "IM",
"display": "Intramuscular",
"system": "http://terminology.hl7.org/CodeSystem/v2-0162"
}
],
"text": "Intramuscular"
},
"site": {
"coding": [
{
"code": "LD",
"display": "Left deltoid",
"system": "http://terminology.hl7.org/CodeSystem/v2-0163"
}
],
"text": "Left deltoid"
}
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0012"
},
"timestamp": "2026-03-15T11:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| ORC-3 | Immunization.identifier |
| RXA-3 | Immunization.occurrenceDateTime |
| RXA-4 | Nothing, the end time repeats the start time and a repeat carries no information |
| RXA-5 | Immunization.vaccineCode, CVX |
| RXA-6, RXA-7 | Immunization.doseQuantity |
| RXA-9 | Immunization.primarySource, 00 means the sender gave the vaccine |
| RXA-10 | Practitioner as Immunization.performer |
| RXA-15 | Immunization.lotNumber |
| RXA-16 | Immunization.expirationDate |
| RXA-17 | Organization as Immunization.manufacturer |
| RXA-20 | Immunization.status |
| RXR-1 | Immunization.route |
| RXR-2 | Immunization.site |
RDE^O11 - TPN order with componentsRDE_O11
MSH|^~\&|EHR|GENHOSP|PHARM|GENHOSP|20260315120000||RDE^O11^RDE_O11|MSG0013|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|I|WEST^201^B^GENHOSP
ORC|NW|RX9001^EHR|||||||20260315120000|||1234^Jones^Maria^^^^MD
RXE||TPN001^TPN Solution^L|1000||mL^^UCUM
TQ1|1||Q24H^Every 24 hours^HL70335|1800|||20260315|20260320|R^Routine^HL70485||Infuse over 12 hours
RXR|IV^Intravenous^HL70162
RXC|B|DEX10^Dextrose 10%^L|500|mL^^UCUM
RXC|A|AMINO^Amino acids^L|50|g^^UCUM||||1000|mL^^UCUM
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:3e3a0655-99b2-5683-b232-8774104765f5",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "O11"
},
"source": {
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "PHARM",
"endpoint": "urn:zato:hl7v2:authority:PHARM",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:9c8468cf-2e09-5314-8372-8996b45992d2"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "WEST",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "201",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
},
"partOf": {
"reference": "urn:uuid:dc226dc8-3c02-52ac-92db-a87a6dd6211d"
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "B",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"partOf": {
"reference": "urn:uuid:6242a486-820c-5672-8ee6-5cf2dd0496e6"
}
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:9c8468cf-2e09-5314-8372-8996b45992d2",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:021b78dc-fb83-58fa-8914-b6b5e7b5d851"
}
}
]
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "MedicationRequest"
},
"fullUrl": "urn:uuid:012fb4c2-3847-5e12-89ab-374fe10ed548",
"resource": {
"resourceType": "MedicationRequest",
"status": "active",
"intent": "order",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"encounter": {
"reference": "urn:uuid:9c8468cf-2e09-5314-8372-8996b45992d2"
},
"dosageInstruction": [
{
"doseAndRate": [
{
"doseQuantity": {
"value": 1000.0,
"system": "http://unitsofmeasure.org",
"code": "mL",
"unit": "mL"
}
}
],
"timing": {
"repeat": {
"boundsPeriod": {
"start": "2026-03-15",
"end": "2026-03-20"
},
"frequency": 1,
"period": 24,
"periodUnit": "h",
"timeOfDay": [
"18:00:00"
]
}
},
"text": "Infuse over 12 hours",
"route": {
"coding": [
{
"code": "IV",
"display": "Intravenous",
"system": "http://terminology.hl7.org/CodeSystem/v2-0162"
}
],
"text": "Intravenous"
}
}
],
"identifier": [
{
"value": "RX9001",
"system": "urn:zato:hl7v2:authority:EHR"
}
],
"authoredOn": "2026-03-15T12:00:00+00:00",
"requester": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
},
"priority": "routine",
"medicationReference": {
"reference": "urn:uuid:15d4f63e-82e7-5258-901e-0069364a3854"
}
}
},
{
"request": {
"method": "POST",
"url": "Medication"
},
"fullUrl": "urn:uuid:15d4f63e-82e7-5258-901e-0069364a3854",
"resource": {
"resourceType": "Medication",
"code": {
"coding": [
{
"code": "TPN001",
"display": "TPN Solution"
}
],
"text": "TPN Solution"
},
"ingredient": [
{
"itemCodeableConcept": {
"coding": [
{
"code": "DEX10",
"display": "Dextrose 10%"
}
],
"text": "Dextrose 10%"
},
"isActive": false,
"strength": {
"numerator": {
"value": 500.0,
"system": "http://unitsofmeasure.org",
"code": "mL",
"unit": "mL"
},
"denominator": {
"value": 1
}
}
},
{
"itemCodeableConcept": {
"coding": [
{
"code": "AMINO",
"display": "Amino acids"
}
],
"text": "Amino acids"
},
"isActive": true,
"strength": {
"numerator": {
"value": 50.0,
"system": "http://unitsofmeasure.org",
"code": "g",
"unit": "g"
},
"denominator": {
"value": 1000.0,
"system": "http://unitsofmeasure.org",
"code": "mL",
"unit": "mL"
}
}
}
]
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0013"
},
"timestamp": "2026-03-15T12:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| ORC-9 | MedicationRequest.authoredOn |
| ORC-12 | Practitioner as MedicationRequest.requester |
| RXE-2 | Medication.code, referenced as MedicationRequest.medicationReference |
| RXE-3, RXE-5 | dosageInstruction.doseAndRate.doseQuantity |
| TQ1-3, TQ1-4 | dosageInstruction.timing.repeat, every 24 hours at 18:00 |
| TQ1-7, TQ1-8 | dosageInstruction.timing.repeat.boundsPeriod |
| TQ1-9 | MedicationRequest.priority |
| TQ1-11 | dosageInstruction.text |
| RXR-1 | dosageInstruction.route |
| RXC-1 | Medication.ingredient.isActive, B is the base and A an additive |
| RXC-2 | Medication.ingredient.itemCodeableConcept |
| RXC-3, RXC-4 | Medication.ingredient.strength.numerator |
| RXC-8, RXC-9 | Medication.ingredient.strength.denominator |
RDS^O13 - antibiotic dispensed to patientRDS_O13
MSH|^~\&|PHARM|GENHOSP|EHR|GENHOSP|20260315130000||RDS^O13^RDS_O13|MSG0014|P|2.5.1
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
ORC|RE|RX9002^EHR|FIL9002^PHARM
RXD|1|AMOX500^Amoxicillin 500 mg capsule^L|20260315125500|30|CAP^Capsule^HL70162||RX9002
TQ1|1|1^CAP|TID^Three times a day^HL70335
RXR|PO^Oral^HL70162
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:a5eac19f-f4e4-5c16-aa1a-fdaaa1e9b5b3",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "O13"
},
"source": {
"name": "PHARM",
"endpoint": "urn:zato:hl7v2:authority:PHARM"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "MedicationDispense"
},
"fullUrl": "urn:uuid:3e2b9a59-cdcc-5e35-8a99-f3c7bb4212b6",
"resource": {
"resourceType": "MedicationDispense",
"status": "completed",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"medicationCodeableConcept": {
"coding": [
{
"code": "AMOX500",
"display": "Amoxicillin 500 mg capsule"
}
],
"text": "Amoxicillin 500 mg capsule"
},
"whenHandedOver": "2026-03-15T12:55:00+00:00",
"quantity": {
"value": 30.0,
"system": "http://terminology.hl7.org/CodeSystem/v2-0162",
"code": "CAP",
"unit": "Capsule"
},
"identifier": [
{
"value": "RX9002"
},
{
"value": "RX9002",
"system": "urn:zato:hl7v2:authority:EHR"
},
{
"value": "FIL9002",
"system": "urn:zato:hl7v2:authority:PHARM"
}
],
"dosageInstruction": [
{
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"doseAndRate": [
{
"doseQuantity": {
"value": 1.0,
"unit": "CAP"
}
}
],
"route": {
"coding": [
{
"code": "PO",
"display": "Oral",
"system": "http://terminology.hl7.org/CodeSystem/v2-0162"
}
],
"text": "Oral"
}
}
]
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0014"
},
"timestamp": "2026-03-15T13:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| ORC-2, ORC-3, RXD-7 | MedicationDispense.identifier, the placer, filler and prescription numbers |
| RXD-2 | MedicationDispense.medicationCodeableConcept |
| RXD-3 | MedicationDispense.whenHandedOver |
| RXD-4, RXD-5 | MedicationDispense.quantity |
| TQ1-2 | dosageInstruction.doseAndRate.doseQuantity |
| TQ1-3 | dosageInstruction.timing.repeat, three times a day |
| RXR-1 | dosageInstruction.route |
DFT^P03 - office visit charge postedDFT_P03
MSH|^~\&|BILLING|GENHOSP|EHR|GENHOSP|20260318170000||DFT^P03^DFT_P03|MSG0015|P|2.5.1
EVN|P03|20260318170000
PID|1||12345^^^GENHOSP^MR||Smith^John^A||19800115|M
PV1|1|O|CLINIC^^^GENHOSP||||||||||||||||V2026002^^^GENHOSP
FT1|1|TXN5001^BILLING||20260318||CG|99213^Office visit established patient^CPT|||1||||||||||1234^Jones^Maria^^^^MD
from zato.hl7v2 import parse_hl7
msg = parse_hl7(raw)
bundle = msg.to_fhir()
print(bundle.to_json(indent=2))
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "MessageHeader"
},
"fullUrl": "urn:uuid:aaa67e37-2cb2-53de-8d65-16d36cbc3e05",
"resource": {
"resourceType": "MessageHeader",
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "P03"
},
"source": {
"name": "BILLING",
"endpoint": "urn:zato:hl7v2:authority:BILLING"
},
"sender": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
},
"destination": [
{
"name": "EHR",
"endpoint": "urn:zato:hl7v2:authority:EHR",
"receiver": {
"reference": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0"
}
}
],
"focus": [
{
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
{
"reference": "urn:uuid:e7c67597-fca0-57ad-958e-da82bcafc915"
}
]
}
},
{
"request": {
"method": "POST",
"url": "Organization"
},
"fullUrl": "urn:uuid:71f611cc-1ffb-55ae-9032-386d702c79f0",
"resource": {
"resourceType": "Organization",
"name": "GENHOSP"
}
},
{
"request": {
"method": "POST",
"url": "Patient"
},
"fullUrl": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"value": "12345",
"system": "urn:zato:hl7v2:authority:GENHOSP",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
],
"name": [
{
"family": "Smith",
"given": [
"John",
"A"
]
}
],
"birthDate": "1980-01-15",
"gender": "male"
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "GENHOSP",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "si"
}
]
}
}
},
{
"request": {
"method": "POST",
"url": "Location"
},
"fullUrl": "urn:uuid:abacf71d-261b-5b98-860b-81a6414b4436",
"resource": {
"resourceType": "Location",
"mode": "instance",
"name": "CLINIC",
"partOf": {
"reference": "urn:uuid:64708233-cc37-5575-8443-67cfca1ae0ce"
}
}
},
{
"request": {
"method": "POST",
"url": "Encounter"
},
"fullUrl": "urn:uuid:e7c67597-fca0-57ad-958e-da82bcafc915",
"resource": {
"resourceType": "Encounter",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "AMB"
},
"status": "in-progress",
"location": [
{
"location": {
"reference": "urn:uuid:abacf71d-261b-5b98-860b-81a6414b4436"
}
}
],
"identifier": [
{
"value": "V2026002",
"system": "urn:zato:hl7v2:authority:GENHOSP"
}
],
"period": {
"start": "2026-03-18T17:00:00+00:00"
}
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"fullUrl": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206",
"resource": {
"resourceType": "Practitioner",
"identifier": [
{
"value": "1234"
}
],
"name": [
{
"family": "Jones",
"given": [
"Maria"
],
"suffix": [
"MD"
]
}
]
}
},
{
"request": {
"method": "POST",
"url": "ChargeItem"
},
"fullUrl": "urn:uuid:9fe206d8-b152-5ff9-afce-9a894d2b9209",
"resource": {
"resourceType": "ChargeItem",
"subject": {
"reference": "urn:uuid:5e28fb67-2ab2-54f4-b20e-82f15f3fd327"
},
"context": {
"reference": "urn:uuid:e7c67597-fca0-57ad-958e-da82bcafc915"
},
"status": "billable",
"code": {
"coding": [
{
"code": "99213",
"display": "Office visit established patient",
"system": "http://www.ama-assn.org/go/cpt"
}
],
"text": "Office visit established patient"
},
"identifier": [
{
"value": "TXN5001",
"system": "urn:zato:hl7v2:authority:BILLING"
}
],
"occurrenceDateTime": "2026-03-18",
"quantity": {
"value": 1.0
},
"performer": [
{
"actor": {
"reference": "urn:uuid:f1161e87-ec45-5c74-bc60-68bdda47f206"
}
}
]
}
}
],
"identifier": {
"system": "urn:zato:hl7v2:message-control-id",
"value": "MSG0015"
},
"timestamp": "2026-03-18T17:00:00+00:00",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
}
}
| HL7 v2 | FHIR |
|---|---|
| FT1-2 | ChargeItem.identifier |
| FT1-4 | ChargeItem.occurrenceDateTime |
| FT1-6 | ChargeItem.status, CG is a billable charge |
| FT1-7 | ChargeItem.code, CPT |
| FT1-10 | ChargeItem.quantity |
| FT1-20 | Practitioner as ChargeItem.performer |
| PV1 | Encounter referenced as ChargeItem.context |
See also
| Page | What it covers |
|---|---|
| Automatic conversion | One call, a complete MLLP-to-FHIR service and validation |
| What you get per message | The resources produced for each message family, segment by segment |
| Configuration | Identifier systems, timezone, code overrides and the extension base URL |
| Sending bundles to FHIR servers | Posting a bundle, reading the reply and handling rejections |
Learn more
Schedule a meaningful demo
Book a demo with an expert who will help you build meaningful systems that match your ambitions
"We evaluated 12 integration platforms and Zato was the only one to score 100%."
Philip Zuñiga, Assistant Professor, University of the Philippines