Handling HL7 Documents in the Modern Era
HL7 is a standard format used by medical facilities and healthcare providers around the world to communicate and send data. These standards were created by the Health Level Seven International and it provides a system and definitive outline for the structuring of patient and medical data. This allows for electronic medical records to be distributed globally with reduced risk of errors related to misinterpretation.
MSH|^~\&|EPIC|^LINDAS TEST
ORGANIZATION|||||VXU^V04^VXU_V04|225|P|2.5.1||||AL|PID|1||E46749^^^^MR^||DOE^JOHN^C^JR^^^L|SMITH|2
140515|M|SMITH^JOHN|2106-3^WHITE^HL70005|115 MAINSTREET^^GOODTOWN^KY^42010^USA^L^010||^PRN^PH^^^270^6009800||EN^ENGLISH^HL70296||||523968712|||2186-5^NOT HISPANIC OR LATINO^HL70012||||||||N|
PD1|||LINDAS TEST ORGANIZATION^^SIISCLIENT818|^^^^^^^^^^^^MR|||||||02^Reminder/recall-any method^HL70215|||||A^Active^HL70441|20150202^20150202 NK1|1|DOE^MARY|MTH^MOTHER^HL70063|
PV1||R||||||||||||||||||V02^20150202|
ORC|RE||9645^SIISCLIENT001||||||20150202111146|2001^HARVEY^MARVIN^K|
RXA|0|1|20150202|20150202|20^DTaP^CVX^90700^DTAP^CPT|.5|ML^mL^ISO+||00^New immunization
record^NIP001|JONES^MARK|^^^SIISCLIENT818||||A7894-2|20161115|PMC^SANOFI
PASTEUR^MVX||||ARXR|ID^INTRADERMAL^HL70162|LD^LEFT DELTOID^HL70163
OBX|1|CE|64994-7^VACCINE FUNDING PROGRAM ELIGIBILITY CATEGORY^LN|1|
V02^MEDICAID^HL70064||||||F|||20150202|||VXC40^ELIGIBILITY CAPTURED AT THE IMMUNIZATION
LEVEL^CDCPHINVSOBX|2|CE|30956-7^VACCINE TYPE^LN|2|88^FLU^CVX||||||F|||20150202102525
OBX|3|TS|29768-9^Date vaccine information statement published^LN|2|20120702||||||FOBX|4|TS|29769
7^Date vaccine information statement presented^LN|2|20120202||||||F
RXA|0|1|20141215|20141115|141^influenza, SEASONAL 36^CVX^90658^Influenza
Split^CPT|999|||01^HISTORICAL INFORMATION – SOURCE UNSPECIFIED^ NIP001||||||||||||A
All messages will start with ‘MSH’ which stands for ‘Message Header.’ The ‘MSH’ is an example of a segment, which can indicate any number of things, and is always three characters, and is located at the start of a new line. For example, the segment ‘NK1’ indicates the Next of Kin, and ‘OBX’ is an observation or result. Caristix does a great job breaking down the segments, giving context to their meanings, and also providing information about the individual fields within each segment.
If you are working in health tech, learning how to handle HL7 files is crucial. There are several options for how to work with this data. The two main routes are cloud vs. library.
Solutions
Major cloud providers offer a solution to handling this sort of data. Depending on the scale of your project, the data privacy requirements, and the types of product you are engineering, there is a solution out there that is best suited for you.
Google Cloud provides and API with excellent documentation on how to best parse and transform the data. Their API works with Python, Go, Node.js, and Java. Azure’s Healthcare API for FHIR is also a very comprehensive solution that can assist enterprise solutions in the world of health tech. FHIR is a standard which is published by HL7, and any implemented solution should adhere to this standard.
If for whatever reason a cloud solution does not work for you...maybe you want a lighter-weight solution or want to hit the ground running a bit faster, there are libraries out there than can help developers parse and understand the contents of HL7 files. Here is a useful tutorial for someone building with Django and Python use the hdl7apy library. If you are building in Node.js, hl7-standard is an equally lightweight solution that can help make this hard to understand data much easier to work with.
The moral of the story is that while HL7 data is a bit wonky and not very easy on the eyes, the standards it is built on is crucial for the healthcare industry and there are solutions out there that can make hard to understand data a dream to work with.