MSH|^~&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A01|MSG00001-|P|2. 6 EVN|A01|198808181123PID|||PATID1234^5^M11^^AN||JONES^WILLIAM^A^III||19610615|M||2106-3|677 DELAWARE AVENUE^^EVERETT^MA^02149|GL|(919)379-1212|(919)271-3434~(919)277-3114||S||PATID12345001^2^M10^^ACSN|123456789|9-87654^NCNK1|1|JONES^BARBARA^K|SPO|||||20011105NK1|1|JONES^MICHAEL^A|FTHPV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J. |||SUR||-||ADM|A0AL1|1||^PENICILLIN||CODE16~CODE17~CODE18AL1|2||^CAT DANDER||CODE257DG1|001|I9|1550|MAL NEO LIVER, PRIMARY|19880501103005|FPR1|2234|M11|111^CODE151|COMMON PROCEDURES|198809081123ROL|45^RECORDER^ROLE MASTER LIST|AD|RO|KATE^SMITH^ELLEN|199505011201GT1|1122|1519|BILL^GATES^AIN1|001|A357|1234|BCMD|||||132987IN2|ID1551001|123456789ROL|45^RECORDER^ROLE MASTER LIST|AD|RO|KATE^ELLEN|199505011201 Messages are composed of segments, fields, components, and subcomponents. Segments can be thought of as containers that group like kinds of data. These data are contained in a segment’s fields. The three-character codes in blue are the segment labels for this message. Each segment contains fields that are separated with the light-blue ‘|’ character. Fields and segments can be repeating. Repeating fields are separated with the red ‘~’ character. Components are the data points within fields, and they are separated with the green ‘^’ character. Sub-components are demarcated with the light-purple ‘&’ separator. These special characters are called control characters. The table contains the standard control characters used in HL7. {“smallUrl”:“https://www. wikihow. com/images/2/25/HowToReadHL7-T1. png”,“bigUrl”:"/images/thumb/2/25/HowToReadHL7-T1. png/267px-HowToReadHL7-T1. png",“smallWidth”:460,“smallHeight”:274,“bigWidth”:267,“bigHeight”:159,“licensing”:"<div class="mw-parser-output">
Image by: Uploader
\nLicense: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by/3.
0/">Creative Commons</a>\n</p></div>"}
The message type determines which segments a message contains as well as which ones are optional and which are repeatable. This syntax is dictated by the HL7 version used in creating the message. Segments are re-usable in different message types. The segments in the example message are listed in the table: {“smallUrl”:“https://www. wikihow. com/images/f/f1/HowToReadHL7-T3. png”,“bigUrl”:"/images/thumb/f/f1/HowToReadHL7-T3. png/224px-HowToReadHL7-T3. png",“smallWidth”:460,“smallHeight”:635,“bigWidth”:224,“bigHeight”:309,“licensing”:"<div class="mw-parser-output">
Image by: Uploader
\nLicense: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by/3.
0/">Creative Commons</a>\n</p></div>"}
MSH, the message header, is the first segment in every HL7 message and contains message metadata. The second segment in every message is the EVN segment. This contains the event the message triggers. In this example, that event is the scheduling of an inpatient surgery.
SPO|||||20011105
CODE16~CODE17~CODE18
Components can be further broken down into subcomponents using the & character as a separator.
Appendix A of the standard contains a data dictionary for all of the elements in a message. It is available in both PDF and XLS file formats. The data dictionary for HL7 v2. 6 is a typical example.