MSH - Message Header Segment

The MSH segment defines the intent, source, destination, and some specifics of the syntax of a message.

MSH Segment Structure

Sno Element Name Len Data type Usage Table
1 Field Separator 1 ST R
2 Encoding Characters 4 ST R  
3 Sending Application 180 HD X
4 Sending Facility 180 HD R
5 Receiving Application 180 HD X
6 Receiving Facility 180 HD X
7 Date/Time of Message 26 TS R
8 Security 40 ST X  
9 Message Type 13 CM R
10 Message Control ID 20 ST R  
11 Processing ID 3 PT R  
12 Version ID 60 VID R 0104
13 Sequence Number 60 NM X
14 Continuation Pointer 180 ST X
15 Accept Acknowledgement Type 2 ID R 0155
16 Application Acknowledgement Type 2 ID O 0155
17 Country Code 3 ID X
18 Character Set 16 ID X
19 Principal Language of Message 250 CE X
20 Alternate Character Set Handling Scheme 20 ID X 0211
21 Conformance Statement ID 30 ID R  

Usage Description:

R Required
RE Required but may be Empty
O Optional
C Conditional
CE Conditional but it may be empty
x Not Supported


MSH.1 – Field Separator

This field contains the separator between the segment. The recommended character is |, (ASCII 124).
Data type is ST – String

Examples:

MSH|^~\&|LAB|QTE||30218|20090714023209||ORU^R01|20090714235298399160|P|2.3|||||||


MSH.2 – Encoding Characters

This field contains the four characters in the following order: the component separator, repetition separator, escape character, and subcomponent separator. Recommended values are ^~\& (ASCII 94, 126, 92, and 38, respectively).

Segment Terminator <cr> Terminates a segment record. This value cannot be changed by implementers.
Field Separator | Separates two adjacent data fields within a segment. It also separates the segment ID from the first data field in each segment.
Component Separator ^ Separates adjacent components of data fields where allowed.
Subcomponent Separator & Separates adjacent subcomponents of data fields where allowed. If there are no subcomponents, this character may be omitted.
Repetition Separator ~ Separates multiple occurrences of a field where allowed.
Escape Character \ Escape character for use with any field represented by an ST, TX or FT data type, or for use with the data (fourth) component of the ED data type If no escape characters are used in a message, this character may be omitted. However, it must be present if subcomponents are used in the message.



MSH.3 – Sending Application
This field uniquely identifies the sending application among all other applications within the network enterprise. The network enterprise consists of all those applications that participate in the exchange of HL7 messages within the enterprise. Entirely site-defined.
Data type is HD

Components: <namespace ID (IS)> ^ <universal ID (ST)> ^ <universal ID type (ID)>

CL^57768-2
CP^387564

The value of <namespace ID> represents the high-level naming authority that controls the assignment of laboratory identifiers that appear in the <universal ID> component. The preferred naming authority is CLIA, and laboratories with a CLIA identifier must send that identifier in the <universal ID> component, along with the value “CL” in the <namespace ID> component

Examples:
MSH|^~\&|EPIC|EPICADT|SMS|SMSADT|199912271408|CHARRIS|ADT^A04|1817457|D|2.5|
MSH|^~\&|SHIEL|SHIEL|H_Dx|999994|200904100656||ORU^R01|SH13857997|D|2.3|
MSH|^~\&|ELYSIUMCONNECT|THA-I||TUH|20080722001201||ORU^R01|22001202527|P|2.2



MSH.4 – Sending Facility

This field uniquely identifies the receiving application among all other applications within the network enterprise. The network enterprise consists of all those applications that participate in the exchange of HL7 messages within the enterprise. Entirely site-defined.
Data type is HD.

Components: <namespace ID (IS)> ^ <universal ID (ST)> ^ <universal ID type (ID)>


MSH.5 – Receiving Application

This field identifies the receiving application among multiple identical instances of the application running on behalf of different organizations.
Entirely site-defined.
Data type is HD.


MSH Segment Examples:

MSH|^~\&|Test|My CLINICAL LAB|Test|100|201309050000||ORU^R01||P|2.3|

image