by Rahul Bhagat
HL7 for Busy
Professionals
Your No Sweat Guide to Understanding HL7
Rahul Bhagat
Illustration By Calvin Hui
Anchiove
2015
Copyright © 2015 by Rahul Bhagat
All rights reserved. This book or any portion thereof may not be reproduced or used in any manner whatsoever without the express written permission of the publisher except for the use of brief quotations in a book review or scholarly journal.
First Printing: 2015
ISBN 978-0-9939945-1-7
Anchiove Inc.
135 Wynford Dr., Toronto, ON, Canada M3C OJ4
www.HL7Book.com
Although the author and publisher have made every effort to ensure that the information in this book was correct at press time, the author and publisher do not assume and hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause
To Neelam Bhagat,
who knew this book was for real before I did.
Thank you ma.
Table of Contents
Preface
Part I
Scratching the surface
1. Introduction
2. What is HL7?
3. Integration Concepts
4. Evolution of HL7
Part II
Digging Deeper
5. Basic Concepts
6. Message Building Blocks
7. Working with a Message
8. Control Segments
9. Data Segments
10. Other Important Topics
Preface
After university, I got a job with a busy, Toronto based, healthcare consulting company. On day two at work, I was handed a printout with cryptic text on it, and a document called interface spec, to read and understand.
This was my introduction to HL7. At that time, I did not realize that this obscure messaging protocol would become my ticket to far off places, and the reason to meet and work with a lot of people.
It didn't take me long to learn HL7, my programming background helped. Later, I realized that my skill is in high demand and I became a consultant. I traveled to different cities and worked on various HL7 projects.
I also started running into people from non-technical background who wanted me to explain HL7 in the elevator or while chatting in their cubicle. There wasn’t any introductory book I could suggest, so the idea of writing one myself.
I'm glad I collaborated with Calvin Hui in writing this book. He not only took care of illustration and design but also nudged me when I was slacking after the first draft. My friend Erik Westermann was a great sounding board and helped me refine my ideas. And thanks to many colleagues who helped me develop my skills. In particular, Derrick Leung, who mentored me when I was just starting out.
So here it is. My idea of an introductory book on HL7. I hope you enjoy reading it.
Part I
Scratching the surface
1. Introduction
A technical book usually implies a dry subject. So its no surprise authors have a hard time figuring out ways to make the book interesting to the reader. HL7 is one such subject. It is a subject that is so high on the scale of dryness and no one comes to it willingly. The only reason someone would read a book on HL7 is because of his or her job. And if you are here, reading this book, then I assume you work in healthcare IT or intend to join the industry soon.
I have made every effort to take out the dryness of the subject and make this book interesting. There are no needless jargons or esoteric concepts thrown casually to trip you. In fact, you will see a heavy reliance on everyday examples and inclusion of background information to paint a complete picture. But HL7 and healthcare system integration are complex subjects so there will be topics that don't make sense right away. Please persevere. Tie a knot and hang in there. Gradually things will make sense.
This introductory book on HL7 goes in detail to explain what HL7 is. It gives you the basic concepts, tells you about the organization behind it and helps you create a mental map of the voluminous HL7 specification document. And, it takes you through a whirlwind tour of some of the most commonly used HL7 messages, all in a short span of time.
Early Railroads
HL7 was created to solve the problems of clinical system integration. But to truly understand the problems of system integration, let’s start with another integration problem we solved centuries ago.
The 1800’s were a time when railways were coming of age in America – just like battery driven cars, drones and other new technologies are coming of age today.
There were literally hundreds of companies competing for a piece of the railway pie. Enterprising companies would buy up land, lay down tracks and run a transport service between cities which had no other means of transportation except for horse-drawn wagons or, if one was fortunate, steamships.
By the time American civil war started (1861), vast stretches of the continent were already connected through rail and work was well underway on the construction of the transcontinental railroad to connect California with the rest of the country.
However, there was one problem. You could not just hop on a train and get off at your destination, like you can today. Because these railroads were built and run by different companies, they used different track gauges (horizontal distance between two rails of the track). This meant you had to get off and change trains whenever you hit a junction with two different gauge widths. There were well over twenty different track gauges being used at the time of the civil war. The army had to constantly load and unload cargo in its effort to get supplies to the troops. This was a serious problem!
And it was the reason that finally made the American government to push for the conversion of all railway tracks to a standard gauge—4 feet and 8.5 inches, the most commonly used gauge width. More than half of the existing tracks were built to this width so it was easiest to convert the remaining tracks to this width and achieve standardization.
Standardization of rail tracks was the first step towards creating an integrated system where goods and people could move freely across the whole network. It was followed by the development of a common signal system, time zones, harmonized train schedule, fixed coach height, a standard coal and water supply system and on and on.
It was evident that an integrated system needed a standard way of doing things.
Evolution of Healthcare IT Systems
Today, we are in a (somewhat) similar situation with the movement of healthcare information. It cannot seamlessly flow from one system to the next. Each organization has its own way of storing and sharing information. Whenever health information needs to move across organization boundaries, it hits the incompatible standards roadblock. Someone has to unload and reload the information.
Healthcare IT systems have evolved similar to railroads. Initially, hardware costs (think multi-million dollar mainframes) were the biggest factor, so only a few teaching hospitals with deep pockets had the means to build a system. These were primarily stand-alone systems meant to serve a specific purpose. For example, to manage patient population in a large hospital.
Then the hardware cost came down and minicomputers arrived on the scene. A computer could be had for less than $25,000 and didn’t need a room to house it. This allowed smaller players and even departments within a hospital to purchase systems of their own. Pharmacies installed systems to track prescriptions and dispensed medication while laboratories set up systems to track requests for tests and their results.
This led to dramatic improvement in productivity for these organizat
ions but there was no free flow of information between the clinical systems. The problem was lack of standardization. Information from one system had to be unloaded to paper and transported to where the other system was. Then a human operator would reload the information to the other system by manually typing it in.
Of course this was the worse case scenario. Improvements were made. Information was loaded on floppy disks and electronically moved to the other system. Still, there was no free flow of information between systems. This prevented us from realizing the true potential of electronic systems.
Then some IT vendors came up with a solution. Replace stand-alone systems with an integrated product - an EHR (electronic health record). If you are familiar with Cerner, Epic or Meditech then you know what I am talking about. A large system with modules for every department.
This eliminated the need for health information to cross system boundaries. Within the system, the modules would use a standard way of storing and sharing information and this would allow the information to flow seamlessly within the organization.
This approach worked well. EHRs have been very successful in eliminating the problem of integrating systems within an organization and they continue to be one of the cornerstones of the healthcare IT structure.
But what about sharing information outside the organization? Healthcare organizations don’t work in isolation. They need to share information with insurance companies and send patient care information to the government. They have to constantly communicate with the outside world.
To use our railway analogy, this was similar to the situation where each state could set its own standard gauge. You could travel all over a state without the need to switch trains but when you wanted to cross the state boundary, you would need to disembark and get on a train that ran on the other state’s standard gauge.
Clearly, EHRs were only a limited solution.
There was also the question of what to do with existing standalone clinical systems. These systems were built over many years through substantial monetary investment. An organization would be loath to scrap all that investment & hard work and replace it with an EHR.
Healthcare needed a better solution. It needed a standard gauge to connect these EHRs, standalone systems, external systems and systems that were yet to be built. It needed to move away from constantly loading and unloading information.
The solution was HL7.
2. What is HL7?
HL7 is an ANSI accredited, OSI level 7, application layer protocol for exchanging clinical and administrative data between healthcare systems.
Chances are, if you are not a network engineer or did not study computer science, then “OSI level 7, application layer protocol” probably means nothing to you.
In lay terms, you can say that HL7 is a language that clinical systems use to exchange information with each other. But even that doesn’t tell you anything. When I was learning HL7, the definition raised its own questions and left me with a vague sense of unease. It took a fair bit of research to figure out what HL7 is.
So instead of leaving with a sense of unease, why don’t we take the time and figure out what HL7 really is?
Application Layer Protocol
HL7 is an application layer protocol. This means that it defines the rules for exchanging data (clinical and administrative) between applications.
We often use the word system and application in an informal way, which clouds the distinction between the two. Historically an application was the same as a system. An old accounting system, with its hardware and printers and monitors had only one job or application– preparing and maintaining financial records.
Things changed when systems became more powerful and started taking on multiple roles. A great example is your smartphone. It’s not just a phone anymore. Making a phone call is just one of the many functions of the device. It has numerous “apps” or applications for all sorts of things.
Similarly, modern computer systems or servers run multiple applications, including clinical applications. When applications communicate with each other, they have to do so through their system. Basically, applications create a message in a language that is understood by their counterpart applications – in our case HL7 – and hand it over to their system for delivery. The system doesn’t understand the message. Its job is to reliably deliver the message to the destination system.
HL7 is one such specialized application-to-application language/messaging rule book/protocol – whatever you call it – for communication between clinical applications.
OSI Level 7
HL7 is also an OSI (Open System Interconnection) Level 7 protocol. This is just a formal way of saying that it is an application layer protocol.
Now, we are going to discuss OSI and its levels and that means splashing through packet based, network communication. If you are not interested in it, I would suggest skipping over to the next chapter.
OSI is a reference model that networking guys use to make sense of the network communication model and how things really happen at the bit and byte level.
It is not difficult to understand the OSI model. The secret is proper background knowledge and an understanding of the key concepts. Let’s see if we can do that in a few short pages here.
Historical Background
Using electricity for communication started with Samuel Morse, the inventor of the telegraph. He created a simple circuit with a battery, a bowl of mercury and two long wires grounded at ends.
If he dipped a wire in the bowl of mercury, it completed the circuit and current flowed through it. To send a short burst of electricity, he would dip the wire and pull it out quickly. This was like sending electric “smoke puffs” to the other end.
This basic idea was refined into the telegraph and Morse code. The code had two letters – a dot and a dash. A dot was a short puff of electricity and a dash was a longer puff (about 3 times the duration of a dot). Dots and dashes were combined to represent letters and voila! We had electronic communication.
SOS, the universal distress signal, owes its origin to Morse code. In Morse code, the pattern for the letter S is three dots and for the letter O, it is three dashes - hence the familiar sound of three short beeps, three long beeps and three short beeps for SOS.
Morse code evolved into Baudet code for Teletypes, which replaced the dots and dashes with bits. Basically, instead of looking out for puffs of electricity, systems checked if current was flowing in a slice of time. This slice of time was called a bit. Each bit had two states; either current was flowing or not flowing. They used to call them a marking state and a spacing state. Today we know them as 1 and 0.
The time duration of a bit is called bit time. To understand bit time, let’s assume a bit time of one second. If electricity was flowing for one second then that means a 1 was sent. If the electricity kept flowing during the next second then that means another 1. But, if there was no electricity after the first second, then that was a 0. In real life, bit times are extremely small. You can pack millions of bits in a second. This is also known as the bit rate (bits per second).
The success of electronic communication increased the need for communication lines for transmission. Back in the days, there were very few lines. So devices had to share lines to transmit their bits. The problem with this approach was that other devices had to wait until the transmitting device finished sending its message.
To give you an analogy, consider when we only had landlines. People had multiple handsets in the house but there was just one line. So if your teenage daughter was on the phone in her bedroom upstairs, you had better get busy doing whatever else you had to do. It would be a long time before it was your turn to make a call. Devices that had to share lines had a similar problem.
Packets
The solution was timesharing. The long stream of bits in a message was divided into smaller pieces called packets. Each computer on the network was given its share of time (say 1/100th of a second) on a rotating basis and w
hen its time came, it would transmit as many packets as it could. If all the packets were not sent in the allocated time, the computer would wait its turn to send the remaining packets. This way multiple computers were able to use the same transmission line without having to wait for an inordinate amount of time.
This method of message transmission has been so successful that today almost all communication is in the form of packets, even voice communication. If you have ever had a bad connection during a phone call, you may have noticed a number of gaps in the conversation. Those gaps were nothing but missing packets. They never made it in time!
For a message to be sent as packets requires a couple of things. One, the packets have to be numbered sequentially. If the packets are not assembled in the same order as they were sent, the message will become garbled. As a result, your thank you could end up before the hello.
And second, in a network with many computers, each packet will have to have the address of the destination computer. Otherwise where does the packet get delivered?
These details are attached to a packet in the form of a header, as additional bits in front of the packet.
When the packet reaches its destination, the headers are stripped and the data is pieced together one by one to rebuild the original message.
Ethernet
The Ethernet is the de-facto standard for connecting computers in a network. There were others, SNA, AppleTalk etc. but they didn’t survive the Darwinian laws of free market.
To set up an Ethernet, you first lay down the communication backbone, which is a simple coaxial cable. The network is built by connecting individual devices to this backbone. If a device wants to send a message to another device (a computer, printer etc.) on the network, it transmits the packets to the backbone. Every device connected to the backbone will hear and read the header of the packet. If the packet is not addressed to it, it will be ignored. Only the device with the matching address will save the packet.