HL7 - it's a medical email!
I have had cause to look at the HL7 standard as part of my desire to suck data from the world on my patients! Specifically in this case, from the world of the laboratory, but it works just as well for any data that you can find.
When a test is done in a lab, it can be printed and sent, but increasingly, a message is sent from the lab to the Information System of the requesting doctor. The message has two characteristics:
- There is a portion that determines where it comes from and where it does to (like an email), and a text file encapsulated within.
- the text file contains all the data needed - patient name, DOB, sending facility, test performed, result, normal range, messages/notes - it is quite involved
- the text file is written in PLAIN TEXT and it therefore very insecure. This is why it is usually sent on encrypted networks, though it could be encrypted using a private/public key pair (PGP encryption).
So here is an example of an output from a lab, and the resulting HL7 message. (I have loaded in two files with the same data)
This is the information coming from the lab that must be imported into the IS (Value, TestDate), or is required for patient matching (MRN, LastName, FirstName, DOB), or is required for specific placement in receiver's IS (TestCode)
MRN | Lastname | FirstName | Value | TestDate | TestCode | ~ DOB |
---|---|---|---|---|---|---|
iCCCDEPT | Miller | Alexis | 0.39 | 20220818 | 2857-1^PSA | 19550511 |
On receipt that HL7 mechanism in the receiver's IS will strip out the text message file and save it into a local directory. That directory is polled episodically by the IS to see if there are new files. When a new file is found, the IS then checks the text to see if there is the same identifiers in their system, if there is the same testcode, and if all of the date and other parameters are formatted correctly. When all matches and the stars align and your tongue is on the left, the message imports and the Value now looks like it belongs to the patient and appears as a new value in the Test (PSA).
The HL7 file relating to the PSA test is listed below. There are four lines, the message header (MSH), the patient identifier (PID), the Observation Required (OBR) and the Observation (OBX) with lots of '|' separators. You can tell by the variable number of '|'s between values that each space has a particular meaning. You can google the HL7 specification if you want to know more.
MSH|^~\&|Prosaiq||||20220901||ORU^R01|1|P|2.3.1|123
PID|1||iCCCDEPT||Miller^Alexis||19550511|
OBR|1||1234^LAB|88304|||20220901||||||||||||||||||F
OBX|1|ST|2857-1^PSA||0.39|ug/L|||||F|||20220818
(Please note that while I am gratified that my PSA is so low, this message will not actually import as I have removed my MRN and made other alterations)