Question
John Nurmi · Sep 23, 2020

Unescaping a HL7 field in a transform and set to a variable

I need some help with unescaping a value in TXA 2 of an MDM message that I am writing to a variable, to be used in a filename for a PF. Would I use the method Unescape(pData) if so how can I use it in a transform to set the variable? The reason I need to do this is I need to use the name as file name when writing the PDF to a directory. The escape characters and invalid for file names .

 

00
5 0 5 212
Log in or sign up to continue

Hi John,

If I understood, you want to pass the code to a method and return the description.

All descriptions of HL7 code tables are stored in the global ^EnsHL7.Description.

The structure of global is ^EnsHL7.Description(<category>,"CT",<codeTableCode,valurKey>)=<descritpion>.

For HL7 Schema Category 2.3.1 the global have the content:

^EnsHL7.Description("2.3.1","CT",270)="Document type"
^EnsHL7.Description("2.3.1","CT",270,"AR")="Autopsy report"
                                     "CD")="Cardiodiagnostics"
                                     "CN")="Consultation"
                                     "DI")="Diagnostic imaging"
                                     "DS")="Discharge summary"
                                     "ED")="Emergency department report"
                                     "HP")="History and physical examination"
                                     "OP")="Operative report"
                                     "PC")="Psychiatric consultation"
                                     "PH")="Psychiatric history and physical examination"
                                     "PN")="Procedure note"
                                     "PR")="Progress note"
                                     "SP")="Surgical pathology"
                                     "TS")="Transfer summary"

A generic method would be like:

I am not looking to get the description  I am looking to Un-escape  the value out of TXA 2.2. Epic is escaping the TXA 2.2 value  in the message from H&P to H\T\P.  I am already pulling TXA 2.2 and storing it , problem in I need original value.

how do you use the Unescape in a Transformation?

Would a <code> section work?

How do you pass the source and return something useful to use in the transform?

I got a note comment that has escape sequence in it.

Thank you

A <code> section would work, but if you're going to use this regularly within your DTLs, it might make sense to create a custom method that would be available through the Function drop-down list in the DTL Editor. For Example:

Class User.Test.FunctionSet Extends Ens.Util.FunctionSet
{
/// Unescapes the field value provided in <var>pPath</var> and returns it as a String.
ClassMethod UnEscapeHL7(pPath As %String, pSeps As %String = "|^~\&", pEsc As %String = "\") As %String
{
    Return ##class(EnsLib.HL7.Segment).UnescapeEx(pPath, pSeps, pEsc)
}
}

Call it like this (replacing the field in my example with the field containing your note comment):

I've updated the method to optionally accept separators and the escape character as arguments; you would use source.Separators and source.ESC to override the default values with the ones supplied in the source message.