Segment MSH in FHIR

How segment MSH (Message Header) becomes FHIR R4 resources, from the HL7 Version 2 to FHIR guide.

HL7 v2 definition
Definition of MSH in HL7 v2 2.8
Maps
Provenance (Operator)Provenance (Source)BundleEncounterMessageHeaderProvenance (Transformation)
Used in messages
ADT_A01ADT_A02ADT_A05ADT_A06ADT_A09ADT_A11ADT_A17MDM_T02OML_O21ORM_O01ORU_R01SIU_S12VXU_V04

To ProvenanceOperator2 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
MSH-4Sending Facility
HDagent.who(Organization)Reference(Organization)
If IF MSH-22 NOT VALUED
MSH-22Sending Responsible Organization
XONagent.who(Organization)Reference(Organization)

To ProvenanceSource15 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
MSHwhole segment
entity[1].what(DocumentReference.content.attachment.url)
when you hold on to/persist the v2 message in a data store
MSHwhole segment
entity[1].what(DocumentReference.content.attachment.data)
when you do not hold on to/persist the v2 message in a data storeValue /v2.txt or v2.xml into base 64/
MSHwhole segment
entity[1].what(DocumentReference.status)
when you do not hold on to/persist the v2 message in a data storeValue "current"
MSHwhole segment
entity[1].role
Value "source"
MSH-3Sending Application
HDentity[2].what(Device.identifier)Reference(Device)
If IF MSH-3 AND MSH-24 VALUED
MSH-3Sending Application
HDentity[2].rolecode
If IF MSH-3 AND MSH-24 VALUEDValue "source"
MSH-4Sending Facility
HDagent[1].who(Organization)Reference(Organization)
If IF MSH-22 NOT VALUED
MSH-4Sending Facility
HDagent[1].type.coding.codecode
If IF MSH-22 NOT VALUEDValue "author"
MSH-4Sending Facility
HDagent[1].type.coding.systemuri
If IF MSH-22 NOT VALUEDValue "http://terminology.hl7.org/CodeSystem/provenance-participant-type"
MSH-7Date/Time Of Message
DTMrecorded
MSH-7Date/Time Of Message
DTMoccurred
MSH-9Message Type
MSGactivity.coding.displaystring
Value "message - "+MSG.1+"^"+MSG.2+"^"+MSG.3
MSH-22Sending Responsible Organization
XONagent[2].who(Organization)Reference(Organization)
MSH-22Sending Responsible Organization
XONagent[2].type.coding.codecode
Value "author"
MSH-22Sending Responsible Organization
XONagent[2].type.coding.systemuri
Value "http://terminology.hl7.org/CodeSystem/provenance-participant-type"

To Bundle4 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
MSHwhole segment
typecode
Value "message"
MSH-7Date/Time Of Message
DTMtimestampinstant
MSH-10Message Control Id
STidentifier.valuestring
MSH-10Message Control Id
STidentifier.systemuri
Value /to be determined by the implementer/

To Encounter1 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
MSH-9Message Type
MSGstatuscode

To MessageHeader22 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
MSH-3Sending Application
HDsource[1]
MSH-3Sending Application
HDsource[1].endpointuri
If IF MSH-24 NOT VALUED
MSH-4Sending Facility
HDsender(Organization)Reference(Organization)
MSH-5Receiving Application
HDdestination[1].target(Device)Reference(Device)
MSH-5Receiving Application
HDdestination[1].namename
If IF MSH-25 VALUED
MSH-5Receiving Application
HDdestination[1].endpointurl
If IF MSH-25 NOT VALUED
MSH-6Receiving Facility
HDdestination[1].receiver(Organization)Reference(Organization)
If IF MSH-23 NOT VALUED
MSH-8Security
STmeta.securitystring
MSH-9Message Type
MSGeventCodingCoding
MSH-11Processing Id
PTmetameta
MSH-17Country Code
IDsender(Organization.address.country)string
Code map iso-3166-1
MSH-19Principal Language Of Message
CWElanguagecode
MSH-22Sending Responsible Organization
XONresponsible(Organization)Reference(Organization)
MSH-23Receiving Responsible Organization
XONdestination[1].receiver(Organization)Reference(Organization)
MSH-24Sending Network Address
HDsourcestring
MSH-24Sending Network Address
HDsource.endpoint.extension.urluri
If IF MSH-24 NOT VALUED AND MSH-3 NOT VALUEDValue "http://hl7.org/fhir/R4/extension-data-absent-reason.html"
MSH-24Sending Network Address
HDsource.endpoint.extension.valueCodecode
If IF MSH-24 NOT VALUED AND MSH-3 NOT VALUEDValue "unknown"
MSH-25Receiving Network Address
HDdestination[1]uri
MSH-25Receiving Network Address
HDdestination[1].endpoint.extension.urluri
If IF MSH-25 NOT VALUED AND MSH-5 NOT VALUEDValue "http://hl7.org/fhir/R4/extension-data-absent-reason.html"
MSH-25Receiving Network Address
HDdestination[1].endpoint.extension.valueCodecode
If IF MSH-25 NOT VALUED AND MSH-5 NOT VALUEDValue "unknown"
MSH-26
CWEmeta.security[2]Coding
MSH-27
CWEmeta.security[2]Coding

To ProvenanceTransformation11 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
MSHwhole segment
activity.coding.code
Value "v2-fhir-transformation"
MSHwhole segment
activity.coding.system
Value "http://hl7.org/fhir/uv/v2mappings/CodeSystem/provenance-activity-type-v2-to-fhir"
MSHwhole segment
recorded
Value /timestamp of tranformation/
MSHwhole segment
policy
Value /uri of the policy governing transformation of the v2 to FHIR/
MSHwhole segment
agent[1].type.coding.codestring
Value "assembler"
MSHwhole segment
agent[1].type.coding.systemurl
Value "http://terminology.hl7.org/CodeSystem/provenance-participant-type"
MSHwhole segment
agent[1].who(Organization|Device)Reference(Organization|Device)
Value /the organization owning or device performing the transformation by the mapping tool/
MSHwhole segment
entity[1].what(DocumentReference.content.attachment.url)
when you hold on to/persist the v2 message in a data store
MSHwhole segment
entity[1].what(DocumentReference.content.attachment.data)
when you do not hold on to/persist the v2 message in a data storeValue /v2.txt or v2.xml into base 64/
MSHwhole segment
entity[1].what(DocumentReference.status)
Value "current"
MSHwhole segment
entity[1].role
Value "source"