HL7 Escape Characters Help

161 views
Skip to first unread message

Marc Lang

unread,
May 11, 2012, 10:40:46 AM5/11/12
to InterSystems: Ensemble in Healthcare
Hi,

We have a supplied who currently sends labs results in HL7 like this:

MSH|^~\&|SGHHIS|.|iLABTP|.|20120430132322||ORU^R01|7336|P|2.4
PID
PV1
ORC
OBR
OBX|1|NM|LYMPH^Lymphocytes||4.0|x10^9/L|1.0-2.8||||F 

However, they have stated in a next version they wish to send the "^" escaped, like so:

MSH|^~\&|SGHHIS|.|iLABTP|.|20120430132322||ORU^R01|7336|P|2.4
PID
PV1
ORC
OBR
OBX|10|NM|LYMPH^Lymphocytes||4.0|x10\S\9/L|1.0-2.8||||F

I have ran a sample message through, and it appears as though Ensemble is not un-escaping the \S| to ^ on the way out, so the receiving system is displaying the result as: x10\S\9/L

Any idea how I would get ensemble to un-escape?

Thanks


Atkinson, Gary

unread,
May 11, 2012, 10:53:59 AM5/11/12
to ensemble-in...@googlegroups.com

I do the reverse of this, but you’ll get the idea…

 

ClassMethod Unescape(pData As %String = "") As %String [ Final ]
{
            Set replace("\.br\")=$C(13)
            Set replace("\F\")="|"
            Set replace("\R\")="~"
            Set replace("\S\")="^"
            Set replace("\E\")="\"
            Set replace("\T\")="&"
            Quit $$replaceArray^EnsUtil(pData,.replace)
}

 

Thanks,
Gary


--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en

Marc Lang

unread,
May 11, 2012, 10:55:39 AM5/11/12
to InterSystems: Ensemble in Healthcare
Sorry, think I understand now - I need to unescape the entire message, and send the unescaped message out to receiving system, as it appears to do no unescaping, and treats  x10\S\9/L as literal

My production is a simple TCP HL7 Service / Router w Transform / TCP HL7 Operation

Ted Peck

unread,
May 11, 2012, 11:58:04 AM5/11/12
to ensemble-in...@googlegroups.com, Marc Lang
To recap - it sounds like you have a sending lab system and a receiving system that are both non-compliant in the same way and thus are happy together. Now the lab system wants to get compliant with the HL7 escaping standard but the receiving system isn't going to change.

Since the lab results are in a pretty strict format you can probably just use a DTL to unescape the fields you know will need it, to prepare them for sending to the non-compliant receiving application.

There are methods Escape() and Unescape() in class EnsLib.HL7.Segment that you can use.

Ted

Ted Peck

unread,
May 11, 2012, 2:15:59 PM5/11/12
to Marc Lang, ensemble-in...@googlegroups.com
The Escape() and Unescape() methods are designed to work on a segment instance because it is critical for them to know what the separators apply to the segment content being modified.  However this means you can't use the standard assign statements generated by drag-and-drop in the DTL editor, you have to use a code block something like this:

<code> Set tSegObj=source.GetSegmentAt("OBX") </code>

then a standard assign:
<assign property=target.{OBX:6} value=tSegObj.Unescape(tSegObj.GetValueAt(6)) />
or
<assign property=target.{OBX:6} value=tSegObj.Unescape(source.{OBX:6}) />
Reply all
Reply to author
Forward
0 new messages