Question
· Sep 17

Can I use a DTL for any HL7 message without specifying a DocType?

I have a theory that I could use an HL7 Data Transformer in a rule without specifying a specific DocType. I want to use the same DTL for a variety of different DocTypes. Here is my very simplistic DTL so far:

Class OrdRes.TestTransform Extends Ens.DataTransformDTL [ DependsOn = EnsLib.HL7.Message ]
{
    Parameter IGNOREMISSINGSOURCE = 1;
    Parameter REPORTERRORS = 1;
    Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
    XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
    {
        <transform sourceClass='EnsLib.HL7.Message' targetClass='EnsLib.HL7.Message' create='new' language='objectscript' >
            <assign value='source' property='target' action='set' />
            <assign value='"test"' property='target.{MSH-4}' action='set' />
        </transform>
    }

}

For the more visual people:

 But when I test this with any HL7 message I get the error

ERROR <Ens>ErrGeneral: Cannot recognize path before DocType is set

Is there not a way to write a DTL for any HL7 message without specifying the DocType? And also, am I referencing the field correctly with target.{MSH-4}? I want to use the segment name and position instead of the field name since I'm not using a DocType.

Product version: IRIS 2023.1
Discussion (5)4
Log in or sign up to continue

Yes, there's a "raw" syntax, but I think it's counterproductive in the long run. Segments and fields can be addressed numerically, i.e. target.{1:4} would reference MSH:4. Not very descriptive; one of the beauties of using the DTL editor and message DocTypes is that your transformations become somewhat self-documenting.

You could attempt to build an HL7 "SuperSchema" DocType/Category, I suppose, if your intent is to address message elements using the "symbolic" Virtual Document syntax. For that, you need a DocType.

You can do something similar by doing all transfroms in something like 2.4 ADT_A01, and then using code similar to below on all transforms to change the message Doctype to match the intended schema.

<![CDATA[

 //this part collates the info to set the doctype

 set version=target.GetValueAt("MSH:VersionID.versionID")

 set type=target.GetValueAt("MSH:MessageType.messagetype")

 set trigger=target.GetValueAt("MSH:MessageType.triggerevent")

 //set trigger="A05"

 if ((trigger = "A08")!(trigger = "A11")!(trigger = "A27")!(trigger = "A03")!(trigger = "A12")!(trigger = "A13")){SET trigger = "A01"}

 //this sets the doctype

 set target.DocType=version_":"_type_"_"_trigger

 //set target.DocType="2.4:ADT_A05"

 ]]></code>