- Beginner Knowledge of HL7
If you’ve been in Healthcare Information Technology for any period of time, you have definitely heard of HL7 (Health Level 7). Health Level 7 is one of the leading standards organizations for Healthcare data and its exchange.
HL7 has given the industry the HL7v2, FHIR (Fast Healthcare Interoperability Resources), and CDA (Clinical Document Architecture) standards. However, this article will focus on how anyone can easily make sense of HL7v2, the most widespread of the HL7 standards.
Understanding the Syntax
HL7v2, like any other data standard, has a handful of building blocks that can be used repeatedly. These building blocks are:
Consider the following HL7 message.
MSH|^~\&|||||20210731102064||ADT^A04|6045117205200356375|P|2.2|18 EVN|A04|20210731102064|||dtrn1 PID|||000133346|^^^^^123e4567-e89b-12d3-a456-426614174000&456e4567-e89b-12d3-a456-426614174000&^UUID|TEST^GUY^R||59444417|M||| 000 9th AVE^^LOSANGELES^CA^90043||(000)000-000|||M|AT|255574|000-00-000 PV1||O|OQA|3|20||890|||MED||||1|||890|O||||||||||||||||||||||||||20121025|0500 PV2|||PAIN|||||20121025 GT1|UPDATEDISCHNO1^OPTWO1^||||000 2ND AVE^^LOS ANGELES^CA^90043|(210)566-6641|||||S |545-87-9294||||||| IN1|1|MO|||MEDICARE A B|MEDICARE A B|MUTUAL OF OMAHA^BOX 1602-MEDICARE DEPT^OMAHA^NEBRASKA^12667 |729765384|(704)9985989||||||||^^||MO||||||0.00|0||||101028|dtr|||||||1|1||""||""||||Y|
For the purposes of this section, we will focus on the PID segment.
Think of an HL7 segment as a bucket that contains data of a specific category. For example, the PID segment is the bucket that contains all the patient data in a message. Below, you can see the entire PID segment from the original HL7 message.
Each segment is separated by a newline character in a message. If you look at the original message, you will see other segments like MSH, EVN, PV1, PV2, etc. Additionally, segments will always be alphanumerical abbreviations and appear on the left-hand side of a message.
Keep in mind that each segment is an abbreviation of the larger category. For example, the PV1 segment contains data around the patient’s visit to the facility.
A field is comprised of all data between two |’s (pipes). This is the delimiting character for a field in HL7. Consider the third field in the PID segment.
The third field contains the patient identifier ‘000133346’. However, notice that the first two fields are blank. It’s perfectly acceptable for a field to be blank in HL7 if it’s not required according to the version of HL7 that you are using.
Lastly, keep in mind that fields can repeat. A ‘~’ is used to denote a repeating field. A repeating field can be used (when appropriate) in the following way.
Note: Both field1 and field1_repeated can have multiple components within the field itself.
A component is comprised of all data between two ^’s (caret). You will see ^’s within a field (between two pipes). Consider the fifth field of the PID segment.
In this example, the last name, ‘TEST’, is in the first component of the field. The first name, ‘GUY’, is in the second component of the field, and the middle initial, ‘R’, is the third component of the field.
All three are part of the name of the patient but are placed in different components. Components are typically used for things of this nature.
Sub-components are rarer within HL7 messages; however, you will see them occasionally. A sub-component is comprised of all data between two &’s. As you might have guessed, &’s appear within a component. That is, between two ^’s.
Consider the fourth field of PID.
Within this field, consider the sixth component.
Above, you will see three sub-components all separated by &. In this component, 123e4567-e89b-12d3-a456-426614174000 is the first sub-component, 456e4567-e89b-12d3-a456-426614174000 is the second sub-component, and UUID is the third sub-component.
Referencing Data and Counting Pipes
In the above sections, we walked through every type of data bucket in the PID segment. However, you will see data referenced in a specific way in the context of an HL7 message. You will often hear this called “counting pipes” because the referencing system starts with segments and fields.
Consider the fourth field of PID once again.
Integration professionals would refer to this field as PID.4. Alternatively, you may also see some people use PID-4. The notation uses a ‘.’ or ‘-‘ between the segment and field number.
Now, say you want to reference the sixth component of this field.
In the same fashion, you would refer to the above using PID.4.6.
Next, say you want to grab 123e4567-e89b-12d3-a456-426614174000 out of PID.4.6. In this scenario, PID.4.6.1 would do the trick.
Once again, remember that you may see some Integration professionals substitute ‘-‘ for ‘.’ when referencing HL7 data.
So far, we have just honed in on the PID segment in order to understand the structure of an HL7 message. However, there actually is a vast number of HL7 segments available in the standard. Despite this, some segments show up a lot more than others. In this section, we highlight segments that you will see more frequently when working with HL7.
MSH is the message header segment. This segment defines the source, destination, version, and information regarding the syntax of a message amongst other pieces of header data.
PID is the patient identifier segment. This segment contains data like patient name, address, gender, patient identifier, social security number, etc.
PV1 is the primary patient visit segment. This segment is mainly used by registration systems to send and obtain data surrounding a patient’s appointment, encounter, case, visit, etc.
OBX is the observation segment. This segment’s scope is quite broad as it can contain lab data, vitals readings, and the results of various medical evaluations.
Clinical Data Reference
At some point, you will need a clinical data reference in order to determine what data is found in certain segments and fields. There are many resources out there that describe in detail every part of a particular segment or field.
Click here to go to Caristix.com, an easy reference tool for your clinical HL7 needs.