Saturday 3 October 2020

Double double-quotes in HL7

Firstly, what does it mean?

PID||""|564346^^^MRN^MR

The simple answer is that the value represents blank.  But that raises the next question:  Isn't that the same as just leaving it blank?

No.  In HL7, if nothing is between the pipes it means that the value wasn't provided, or that it isn't known by the sending system.  That means that if you receive an update patient message, for example, where the patient's surname name is not provided in the PID-5.1, you should leave your records as they are. It would be wrong to update your database to nothing in this instance.

However, if you receive an "" then the sending system is telling you to update your database value to nothing, even if you have a value.  Yep, it's a way to blank out your value.

To me it feels like an awkward extension to HL7, I can picture when some tech in the early '90s pointed out this need and it got fudged into the HL7 structure.  However, it is what it is...

But then the important question is how to deal with it?

Well, now that I do my integrations in HL7 Soup's Integration Host, things have become simpler (yeah, like everything else).

Any binding between messages or variables supports a right-click option to "HL7 Encode with Quotes" that will automatically add the quotes into any value if it's omitted. Great if you're converting data in your system or another file to HL7 and want to put in the "" when it's blank to update the other system (without having to write code all the time!)

And the reverse is there too.  Say you receive an HL7 message and don't have the capacity in your web services to handle the "" value, well, you can right-click and "HL7 Decode with Quotes" and any "" value will be converted to an empty string of text.  

Even better, these functions will also handle the & and pipes that may occur to. 



No comments:

Post a Comment