I had two ADT^A04 messages this week. Same EMR, same hospital, same patient. One registered Sam Brown without a fuss. The other got rejected. If you put them side by side in Notepad they looked the same until you got to the street.
Firstly, what does that actually mean?
The one that worked had this PID:
PID|1||74232^^^MRN||Brown^Sam||19780429|M|||19 High \T\ Main St^^Albany^NY^12207||555-555-2004
The one that failed had this:
PID|1||74232^^^MRN||Brown^Sam||19780429|M|||19 High & Main St^^Albany^NY^12207
The simple answer is that one of them escaped the ampersand in "High & Main", and the other one typed it in raw. But that raises the next question: isn't that just a different way of writing the same street?
No. In HL7, & is the subcomponent separator. You can see it declared right there in MSH-2 as part of ^~\&. It is not a letter in the address. It is punctuation that splits a field into smaller pieces.
So when the sending system wrote High & Main and left the & alone, the parser stopped treating Main as part of the street. Main, or the rest of that street, now sits in a different location than it does in the working message. The working one wrote \T\, which is the official escape for an ampersand. Same letters on the screen. Different place in the message.
To me it feels like an awkward leftover from the original delimiter design. I can picture a perfectly ordinary street sign, and some interface from the early '90s treating the & as structure. However, it is what it is...
But then the important question is how to deal with it?
Well, now that I do this in HL7 Soup, things have become simpler (yeah, like everything else). Open the message you already have. Then Tools, Compare.
The left pane is the current message. Paste the other one on the right. That is the usual job. I put the working ADT on the left and the rejected one on the right.

The list on the left is SEMANTIC DIFFERENCES. Each row has a path, a tag, and a short description.
The street is the interesting one. The working message kept High \T\ Main St as a single street value. The rejected one split it. PID-11.1.1 Street or Mailing Address is ONLY ON RIGHT, value 19 High. PID-11.1.2 Street Name is ONLY ON RIGHT, value Main St. Those paths do not exist on the left, because \T\ never created the subcomponents. Same street on the screen. Different place in the message. That is the row that explains the rejection.
Click PID-11.1.1. The top bar says Street or Mailing Address. Left: (not present). Right: 19 High. You stop saying "something in the PID" and start saying Main is sitting in a different location.

The other differences are real too. The working message has a home phone in PID-13, 555-555-2004. The failing one stops the PID after the address, so that field is only on one side. I would mention it on the vendor call. PID-12 is empty on the left and not present on the right. That is a real difference as well. Some systems treat empty and missing as the same thing. Some do not. MSH-10 is just the two control IDs, OK001 versus BAD001. None of that is why the second one failed. The ampersand is.
The right side is EDITABLE TEXT COMPARE. Side by side, both sides editable, the usual red and green. Useful when you want to stare at the raw PID line. I still start with the semantic list. That is the bit that understands HL7 paths instead of characters.
Why start there?
Because a text compare will happily tell you that & and \T\ are different characters, then leave you to work out what that does to every field after it. I have counted those pipes in Mirth exports more times than I want to admit. One extra delimiter and you are staring at the wrong slot. Click PID-11.1.1 and it tells you the street moved. You do not have to remember which number the street is, and you do not have to re-count after someone stuffed an extra caret into the name.
If you want to try the same two messages, here they are. Working first, then the one that failed.
MSH|^~\&|EMR|CITYHOSP|ADT|CITYHOSP|202608191000||ADT^A04^ADT_A01|OK001|P|2.5 EVN|A04|202608191000 PID|1||74232^^^MRN||Brown^Sam||19780429|M|||19 High \T\ Main St^^Albany^NY^12207||555-555-2004 PV1|1|O
MSH|^~\&|EMR|CITYHOSP|ADT|CITYHOSP|202608191000||ADT^A04^ADT_A01|BAD001|P|2.5 EVN|A04|202608191000 PID|1||74232^^^MRN||Brown^Sam||19780429|M|||19 High & Main St^^Albany^NY^12207 PV1|1|O
Anyway. Two messages, one works, one doesn't, and Compare points at the unescaped street ampersand. That is the whole trick.
Next time I will cover the little << and >> buttons on each difference. Those let you cherry-pick a field from one message into the other without counting a single pipe.
No comments:
Post a Comment