replacing hl7 escaped characters

287 views
Skip to first unread message

Atkinson, Gary

unread,
Feb 1, 2012, 9:48:05 AM2/1/12
to ensemble-in...@googlegroups.com

I have system that cant parse the hl7 escaped characters.  Is there a way to code in the dtl that if (\T\, \E\, etc) are found anywhere in the hl7 message to replace with (&, \ etc)?

Thx,

Gary Atkinson MS, BS MT (ASCP)

Integration Programmer

Information Technology Department

Baltimore Washington Medical Center

University of Maryland Medical System

BWMC Office:410-787-6777

Cell:443-883-5785

gatk...@bwmc.umms.org

This email may contain protected health information about an identifable patient.  State and federal law protect the confidentiality of this information.  If you are not the intended receipient, you are prohibited from using, disclosing, reproducing, or distributing this information.  You should immediately notify the sender by telephone or email, and delete this document.

Noé Andrés Rodríguez González

unread,
Feb 1, 2012, 10:09:31 AM2/1/12
to ensemble-in...@googlegroups.com
Hi

It is possible to call a static function in the DTL that parse the string where you want to remove the escape sequences, but probably you have already think about that.






2012/2/1 Atkinson, Gary <GAtk...@bwmc.umms.org>

--
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



--
Atentamente:

       Noé A. Rodríguez Glez.

Atkinson, Gary

unread,
Feb 1, 2012, 10:14:55 AM2/1/12
to ensemble-in...@googlegroups.com

I want to search the entire message.  Here is an example test messageà

 

1    MSH  | ^~\& |  · |  · |  · |  · | 20120131182602 | RISTECH | ORM ^ O01 | 772 | P | 2.3 |  · |  · | AL |  · |  · |  · |  · |  · |  ·

 

  2    PID  | 1 |  · | 1300654 ^  · ^  · ^ N ^ MR |  · | FUJI ^ OP |  · | 19850621 | F |  · | 1 | 5600 EAST ROAD ^  · ^ BALTIMORE ^ MD ^ 21212 ^ US ^  · ^  · ^  · |  · | (410)443-7895 |  · |  · | 1 |  · |  · | 212-45-7896 |  · |  · |  · |  ·

 

  3    PV1  |  · |  · | CAFC ^  · ^  · ^ 4101 ^  · ^  · ^  · ^  · ^  · ^  · ^ BWMCDEP |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  ·

 

  4    ORC  | NW | 31446626 ^ EPC | 7708818 ^ EPC |  · | S |  · |  · ^  · ^  · ^  · ^  · ^ ROUTINE |  · | 201201311826 | RISTECH ^ RADIOLOGY ^ TECHNOLOGIST ^  · ^  · |  · | 511 ^ RAMIREZ ^ JORGE ^  · ^  · ^  · ^  · ^  · ^ BWMCSTAR ^  · ^  · ^  · ^ SER | 4141011020 ^  · ^  · ^ 4101 ^  · ^  · ^  · ^  · ^ BWMC CAFC | (410)768-0919 |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · |  · | O |  ·

 

  5    OBR  | 1 | 31446626 ^ EPC | 7708818 ^ EPC | 1170 ^ CT CHEST \T\ ABDOMEN \T\ PELVIS W/ CONTRAST ^ BWMC RAD ^  · ^ CT CHEST ABD PELVIS W CON |  · | 20120131 |  · |  · |  · |  · | 44 |  · |  · |  · |  · | 511 ^ RAMIREZ ^ JORGE ^  · ^  · ^  · ^  · ^  · ^ BWMCSTAR ^  · ^  · ^  · ^ SER | (410)768-0919 |  · |  · |  · |  · |  · |  · | CT | S |  · |  · ^  · ^  · ^  · ^  · ^ ROUTINE |  · |  · |  · |  · ^ The signs and symptoms with \T\ (amp) \R\ (Tilda) \S\(upper carrot) \E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at)  |  · |  · |  · |  · | 201201311845 |  · |  · |  · |  · |  · |  · |  · |  · |  ·

 

  6    NTE  | 1 |  · | The comment with \T\ (amp) \R\ (Tilda) \S\(upper carrot) \E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at) 

 

  7    NTE  | 2 |  · | Pregnant?:_No |  · |  ·

 

  8    NTE  | 3 |  · | Signs and Symptoms:_The signs and symptoms with \E\T\E\ (amp) \E\R\E\ (Tilda) \E\S\E\(upper carrot) \E\E\E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at)  |  · |  ·

 

  9    NTE  | 4 |  · | History/Additional Information:_History with \E\T\E\ (amp) \E\R\E\ (Tilda) \E\S\E\(upper carrot) \E\E\E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at)  |  · |  ·

 

 

Thanks,
Gary


David Loveluck

unread,
Feb 1, 2012, 10:17:16 AM2/1/12
to ensemble-in...@googlegroups.com

The un-escaped characters will then be treated as separators in any later processing, so results are unpredictable if you do anything to the message after this point.

 

You could just find separators that don’t clash with the data and specify those in the BO. All the escaping will then be taken care of properly.

 

But if the system can’t handle escaped characters, it may not handle arbitrary separators.

 

dave

 

From: ensemble-in...@googlegroups.com [mailto:ensemble-in...@googlegroups.com] On Behalf Of Noé Andrés Rodríguez González
Sent: Wednesday, February 01, 2012 10:10 AM
To: ensemble-in...@googlegroups.com
Subject: Re: [InterSystems-EnsHlth] replacing hl7 escaped characters

 

Hi

Atkinson, Gary

unread,
Feb 1, 2012, 10:20:53 AM2/1/12
to ensemble-in...@googlegroups.com

The receiving system is treating them as text, they don’t understand that \T\ == & etc.  Ideally I would want control over which segment and fields I do the replacing.

 

Thanks,
Gary


David Blake

unread,
Feb 1, 2012, 10:27:18 AM2/1/12
to ensemble-in...@googlegroups.com

Hi Gary

 

Can you not just use the escape and unescape methods defined in the segment class.

 

E.g.

 

source.GetSegmentAt("PID",source.Separators).Unescape(source.{PID:PatientName.familyname})

 

Dave

David Loveluck

unread,
Feb 1, 2012, 10:28:34 AM2/1/12
to ensemble-in...@googlegroups.com

My point was that the message only escapes the & because it is the subcomponent separator. If you could specify something else as the subcomponent separator (a setting on the BO config item), the BO would un-escape the & before it went over the wire. But that depends on you finding an alternative to & that is not in your text and the receiving application being able to handle a different subcomponent separator.

 

dave

Atkinson, Gary

unread,
Feb 1, 2012, 10:38:43 AM2/1/12
to ensemble-in...@googlegroups.com

Ah didn’t know about that!  Still learning J

 

Thanks,
Gary


David Blake

unread,
Feb 1, 2012, 10:58:01 AM2/1/12
to ensemble-in...@googlegroups.com

Hi Gary

 

You should probably be aware that if you are planning on unescaping OBX segments that are greater than 32k then you will have problems. Let me know if you do and we can go through it.

 

Regs

Atkinson, Gary

unread,
Feb 1, 2012, 11:01:49 AM2/1/12
to ensemble-in...@googlegroups.com

No OBX’s in used.  Trying to use Dave suggestion, but I believe my syntax is wrong?

 

<code>

<![CDATA[

source.GetSegmentAt("ORCgrp().OBRuniongrp.NTE()",source.Separators).Unescape.{ORCgrp().OBRuniongrp.NTE():Comment()})

]]>

</code>

David Blake

unread,
Feb 1, 2012, 11:07:23 AM2/1/12
to ensemble-in...@googlegroups.com

Ah, no need for a code block. The example was mearly the ‘value’. Here’s a more complete example…

 

<assign property='target.familyname'

value='source.GetSegmentAt("NK1").Unescape(source.{NK1(1):Name(1).familyname})'

action='set'/>

Atkinson, Gary

unread,
Feb 1, 2012, 11:44:03 AM2/1/12
to ensemble-in...@googlegroups.com

When testing I receive a <INVALID OREF> error.  Is my syntax wrong?

 

<assign property='target.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)}' value='source.GetSegmentAt("ORCgrp(k2).OBRuniongrp.NTE(k4)").Unescape(source.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)})' action='set'/>

David Blake

unread,
Feb 1, 2012, 11:51:20 AM2/1/12
to ensemble-in...@googlegroups.com

Hi Gary

 

That may be the result of the segment not existing. You should test for it beforehand…

 

<if condition='source.{<segment>}=""'> // i.e. does not exist or is empty

<true>

// Set value as desired or otherwise

</true>

<false>

<assign …………../>

</false>

Atkinson, Gary

unread,
Feb 1, 2012, 1:28:20 PM2/1/12
to ensemble-in...@googlegroups.com

Here is the test message I am using, the NTE segment is there.

 

MSH|^~\&|||||20120131182602|RISTECH|ORM^O01|772|P|2.3|||AL||||||

PID|1||1300654^^^N^MR||FUJI^OP||19850621|F||1|5600 EAST ROAD^^BALTIMORE^MD^21212^US^^^||(410)443-7895|||1|||212-45-7896||||

PV1|||CAFC^^^4101^^^^^^^BWMCDEP||||||||||||||||||||||||||||||||||||||||||||||||

ORC|NW|31446626^EPC|7708818^EPC||S||^^^^^ROUTINE||201201311826|RISTECH^RADIOLOGY^TECHNOLOGIST^^||511^RAMIREZ^JORGE^^^^^^BWMCSTAR^^^^SER|4141011020^^^4101^^^^^BWMC CAFC|(410)768-0919|||||||||||||||O|

OBR|1|31446626^EPC|7708818^EPC|1170^CT CHEST \T\ ABDOMEN \T\ PELVIS W/ CONTRAST^BWMC RAD^^CT CHEST ABD PELVIS W CON||20120131|||||44|||||511^RAMIREZ^JORGE^^^^^^BWMCSTAR^^^^SER|(410)768-0919|||||||CT|S||^^^^^ROUTINE||||^The signs and symptoms with \T\ (amp) \R\ (Tilda) \S\(upper carrot) \E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at) |||||201201311845|||||||||

NTE|1||The comment with \T\ (amp) \R\ (Tilda) \S\(upper carrot) \E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at)

NTE|2||Pregnant?:_No||

NTE|3||Signs and Symptoms:_The signs and symptoms with \E\T\E\ (amp) \E\R\E\ (Tilda) \E\S\E\(upper carrot) \E\E\E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at) ||

NTE|4||History/Additional Information:_History with \E\T\E\ (amp) \E\R\E\ (Tilda) \E\S\E\(upper carrot) \E\E\E\ (Backslash) /(Forward slash) ' (aposterphe) @ (at) ||

 

Thanks,
Gary

David Blake

unread,
Feb 2, 2012, 8:04:28 AM2/2/12
to ensemble-in...@googlegroups.com

Hi Gary

 

I have done some testing and it appears that the GetSegmentAt method, when used in DTL, will not accept variable keys. It appears to work only when the key is explicitly set. This is causing the invalid oref error

 

I would recommend opening a WRC issue for this problem.

Erman, Laura

unread,
Feb 2, 2012, 8:17:22 AM2/2/12
to ensemble-in...@googlegroups.com

Hi Gary,

 

 You may want to tray changing your code as highlighted and see it makes a difference.

 

 

<assign property='target.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)}' value='source.GetSegmentAt("ORCgrp(“_k2_”).OBRuniongrp.NTE(“_k4”_)").Unescape(source.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)})' action='set'/>

 

 

 

Thanks,

 

Laura Erman

Sr. Project Manager - Integration

Health Information Technology

NorthShore University HealthSystem

4901 Searle Parkway, Suite 210

Skokie, IL 60077

Phone: 847.982.5563

Fax: 847.982.5378

Email: ler...@northshore.org

 

 

 

 

Legal Disclaimer:  Information contained in this e-mail, including any files transmitted with it, may contain confidential medical or business information intended only for use by the intended recipient(s).  Any unauthorized disclosure, use, copying, distribution or taking of any action based on the contents of this email is strictly prohibited.  Review by any individual other than the intended recipient does not waive or surrender the physician-patient privilege or any other legal rights.  If you received this e-mail in error, please delete it immediately and notify the sender by return email.

Erman, Laura

unread,
Feb 2, 2012, 8:21:14 AM2/2/12
to Erman, Laura, ensemble-in...@googlegroups.com

Made a typo. It should read

 

<assign property='target.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)}' value='source.GetSegmentAt("ORCgrp(“_k2_”).OBRuniongrp.NTE(“_k4_”)").Unescape(source.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)})' action='set'/>

 

 

Thanks,

 

Laura Erman

Sr. Project Manager - Integration

Health Information Technology

NorthShore University HealthSystem

4901 Searle Parkway, Suite 210

Skokie, IL 60077

Phone: 847.982.5563

Fax: 847.982.5378

Email: ler...@northshore.org

 

 

 

 

 

From: Erman, Laura
Sent: Thursday, February 02, 2012 7:17 AM
To: ensemble-in...@googlegroups.com
Subject: RE: [InterSystems-EnsHlth] replacing hl7 escaped characters

 

Hi Gary,

 

 You may want to tray changing your code as highlighted and see it makes a difference.

 

 

<assign property='target.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)}' value='source.GetSegmentAt("ORCgrp(“_k2_”).OBRuniongrp.NTE(“_k4”_)").Unescape(source.{ORCgrp(k2).OBRuniongrp.NTE(k4):Comment(1)})' action='set'/>

 

 

 

Thanks,

 

Laura Erman

Sr. Project Manager - Integration

Health Information Technology

NorthShore University HealthSystem

4901 Searle Parkway, Suite 210

Skokie, IL 60077

Phone: 847.982.5563

Fax: 847.982.5378

Email: ler...@northshore.org

 

 

 

 

Legal Disclaimer:  Information contained in this e-mail, including any files transmitted with it, may contain confidential medical or business information intended only for use by the intended recipient(s).  Any unauthorized disclosure, use, copying, distribution or taking of any action based on the contents of this email is strictly prohibited.  Review by any individual other than the intended recipient does not waive or surrender the physician-patient privilege or any other legal rights.  If you received this e-mail in error, please delete it immediately and notify the sender by return email.

Atkinson, Gary

unread,
Feb 2, 2012, 8:34:52 AM2/2/12
to ensemble-in...@googlegroups.com

I have open ticket with intersystem.  Another co-worker of mine wrote a small function, which seems to work.

 

Thanks,
Gary


Reply all
Reply to author
Forward
0 new messages