Understanding HL7 Messages

A project building a string of medical sites brought me to where I needed to understand the medical encoding language of HL7. This is a brief tutorial on understanding an example HL7 message:

An HL7 message consists of one or more segments. A carriage return character (r, or 0D in hexadecimal) separates one segment from another. Each segment is presented on a separate line(see below example).

An HL7 segment has one or more composites (fields). A pipe (|) character separates one composite from another.

When a composite contains other composites, known as sub-composites (sub-fields), they are usually separated by (^) characters.

Example HL7 message:

MSH|^~&|EPIC|EPICADT|SMS|SMSADT|199912271408|CHARRIS|ADT^A04|1817457|D|2.5|

PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOE^JOHN^^^^|19480203|M||B|254 MYSTREET AVE^^MYTOWN^OH^44123^USA||(216)123-4567|||M|NON|400003403~1129086|

NK1||ROE^MARIE^^^^|SPO||(216)123-4567||EC|||||||||||||||||||||||||||

PV1||O|168 ~219~C~PMA^^^^^^^^^||||277^ALLEN MYLASTNAME^BONNIE^^^^|||||||||| ||2688684|||||||||||||||||||||||||199912271408||||||002376853

Message details:

In the above HL7 message, I separated each line with an empty line between them in case your browser displays them in a broken fashion. It is important to realize that each of the four blocks of text in the message is intended to be on one line and are normally separated by a r or 0D character code as explained above.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *