HL7 Messages

HL7 Message Components

This section describes various aspects of HL7 messages.

Each HL7 message type definition contains a set of lines known as segments. Each segment groups related information, and has a three-character name and a predefined format of specific fields. The fields are separated by the pipe (|) character, and might be further divided into sub-components with the caret (^) character.

Different HL7 events trigger different message types - each message type has a defined set of segments that are joined together to provide all the required information regarding that event. Some segments are mandatory, and must be included in the message, and other segments are optional.

Each segment is delimited by one of the following end line characters:
  • \n
  • 0x0D
Each segment contains a specific type of information. Examples:
  • MSH. Information about the sender and receiver of the message, type of message, and time stamp.
  • PID. Demographic information. This includes patient name, id codes, and address
  • PV1. Information on the patient's hospital stay. This includes location, and referring doctor.

Each segment in turn contains a sequence of fields that are composites. These fields might or might not repeat. Composites are delimited by the pipe (|) character.

HL7 Message Definition and Sample

In Instream and Foresight Translator, each message definition contains the following parts:
  • Segment Grammar. This gives the HL7 format of the message.
  • Table Grammar. This gives the internal view of the message as seen by an enterprise application.
  • Identity. This determines how Instream and Foresight Translator recognize the message.

The following message is a typical HL7 ADT^A04 message, which is sent after a patient enters the hospital. When the patient information is entered into the Patient Administration System (PAS), the information is sent to other enterprise systems, such as Pathology Laboratory Information Systems or Pharmacy Systems.

MSH|^~\&|EPIC|EPICADT|SMS|SMSADT|199912271408|CHARRIS|ADT^A04|1817457|D|2.3|
EVN|A04|199912271408|||CHARRIS
 
PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOE^JOHN^^^^|
19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||
M|NON|400003403~1129086|999-|
 
NK1||CONROY^MARI^^^^|SPO||(216)731-4359||EC||||||||||||||||||||||||||| 

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

Making HL7 Messages More Readable

HL7 messages are in ASCII, and are difficult to interpret. However, you can use Instream and Foresight Translator to convert an HL7 ASCII message into a tree format. You can also use Instream and Foresight Translator to convert an HL7 ASCII message to XML. TIBCO has defined an XML format that is easy to read. This also allows data to work well with other components in ActiveMatrix BusinessWorks.

You can also use Instream and Foresight Translator to convert the XML message back to ASCII.

A HIPAA-compliant ORU message contains the following information:
  • Message header and patient information
  • One or more observation request (OBR) segments defining observation type and request specifics.
  • One or more observation result (OBX) segments defining, quantifying, and qualifying the results.
  • One or more LOINC (Logical Observation Identifier Names and Codes) modifier codes used in the OBR and/or OBX segments as universal identifiers for laboratory and other clinical observations.