Friday, 13 May 2016

HL7 Message Types

HL7 Message Types are a key part of the HL7 specification as they inform us what a messages purpose is.  I thought it would be helpful to create a beginners guide to introduce the basics that you need to know as you get started out in HL7.

Firstly it’s important to know where to find the message type.  The first line of an HL7 message is always the MSH.  Count the number of |’s and the message type is always after the 8th |.

E.g.          image

The message type is broken into two parts by the ^ character.  The first one is the Message Code which categorizes what the message is for (Administration, Scheduling, Orders, etc.) and the second part is the Event Type that signifies what action is being taken (Add, update, delete etc.)

While researching this post I came across this video on HL7 Message Types which uses this very helpful HL7 tool called HL7 Soup.  You can just paste in your messages and it tells you the details of the message type – very helpful.  I’m using it for the screen shots in this post, so I thought I might share this little bag of goodies with you.

There are dozens of different message types available to be used, but you’ll find that there is just a handful that you will use often, so for the sake of simplicity I'm going to focus just on these.


HL7 Soup lists them all – look at the scroll bar to get an idea of how many Message types there are!


The most common message type I work with is ADT which stands for Admission, Discharge, and Transfer.  The Event Types available for this are also very numerous, but they are well defined and therefore pretty easy to select


Depending on your use case, the most common message will likely be the A04 for registering an outpatient.  This contains the basic administrative details of a patient, their primary health care provider, and details about the visit.

An A08 is sent to update these values, so is also another popular event type.

There is also an inpatient alternative to the A04, the A28.


These are scheduling messages for people, equipment and rooms.  There aren’t too many Event types for this messages type, and I only ever seem to use a few of them (S12, S13, S14, S15, S17)


I have a little mnemonic for remembering SIU message; I call them See-You messages as they are often used for scheduling appointments with doctors.


Order messages are used for all sorts of purposes, and you’ll probably have a need for them for something.  It really depends on what area/department you are in as to what the use case would be.  Radiology would use them for ordering X-rays, Pathology would use them for specimens etc.  The basic thing to keep in mind is that they are requesting something

There is only one Event Type I have ever used for an ORM, and that is the O01.




These are providing results from one system to another.  All the Event Types are unsolicited, meaning that they are sent once a system produces the results e.g. When the x-rays been examined and a diagnosis has been made.

Within this message are the segments ORC, OBR, and OBX that are used to transfer information of the order about.

The ORC and OBR contain information about the order, while the OBX is the actual values being passed.  I’ve seen all sorts of OBX values, from a list of blood test results, to whole medical documents.


Once you have selected the Message Type you can then add each of the Segments you need.  Each Event Type has it’s own list of valid Segments that can be added.  It’s not uncommon for HL7 to be abused, and for Segments that are not valid for the selected Event Type to be included anyway, after all the HL7 format is very flexible.  But I suggest if the design of the message is under your control that you hunt for a different Event Type that better conveys the data you need to transfer.  HL7 has been about for such a long time that it’s pretty thorough and it is very unlikely that you are working on something in medical that hasn’t been done before.

When looking for the appropriate available segments the documentation on HL7 is very comprehensive, but it does take a bit of hunting to find exactly what you need.  Again I found an HL7 Soup feature that solved my problem.

With a message containing the Message Type you’d like to use, click on the header of the message, and you get a nice drop down that list all the Segments available for the current Event Type.  You can then just double click on an item to add one to your message with the correct number of ’|’s.


I like to create a follow up post on this one at some point looking either at more message types, or going into the details of particular ones.  I’ll look forward to your feedback.

No comments:

Post a Comment