Shamus Clifford · Mar 21, 2022 go to post

Replace HL7.{propertypath} with Document.{propertypath}. For example,

Document.{MSH:9}

You will not have virtual property completion to refer to the segments/fields in an HL7 message, but you can continue to build your conditions in your HL7 message router and paste them in.

Shamus Clifford · Mar 30, 2022 go to post

I see two things here. First, in your Data Transformation, since PIDgrpgrp() repeats, you will need to specify a repetition in the parenthesis like PIDgrpgrp(1) for the first repetition.

<assign value='##class(CUSTOM.Training.Functions).DateTime(source.{PIDgrpgrp(1).PIDgrp.PID:7.1})' property='target.{PID:7.1}' action='set' />

Then, in your DateTime method, you will need to return the year. For example, if the DateTime was formatted YYYYMMDD:

ClassMethod DateTime(DateTime As %Integer)
 {
   Set Year = $EXTRACT(DateTime,1,4)
   Quit Year
 }
Shamus Clifford · Apr 1, 2022 go to post

Have you tried GetContentArray() from EnsLib.HL7.Message? Then you could do something similar to Testing Virtual Property Paths in the Terminal. For example,

ClassMethod PrintPropertyPaths(){
 set string="MSH|^~\&|MIHIN PATIENT GEN|1.2.3.4.5.9.99.999.9999.1004||2.16.840.1.113883.3.1481|20200103000000+0000||ADT^A01^ADT_A01|1092|P|2.6|1091|||||||||Windward General Hospital"_$C(13,10)_
            "EVN||20200110000000+0000|||||1.2.3.4.5.9.99.999.9999.1004"_
            "PID|1|3170|44c8a6bba5c743538e476a813256959b^^^^CKS~000003170^^^^SS||Santana^Pearl||19900609|F||2054-5^Black or African American^HL70005|364 NE Oak Circle^^Trenton^MI^48183||||||||000003170|||N^Not Hispanic or Latino^HL70189|||||||20200110000000+0000|N"_$C(13,10)_
            "PD1|||Windward General Hospital^^^^^^^^^1.2.3.4.5.9.99.999.9999.1004|9999992221^Johnston^Karl^^^^^^^^^^NPI^^^^^^^^MD"_$C(13,10)_
            "PV1|1|I|^^67^1.2.3.4.5.9.99.999.9999.1004||||9999992221^Johnston^Karl^^^^^^^^^^NPI||||||||||||17a5e3aa59a34ad5af017998278a5eb5||||||||||||||||||&HOME^20200110000000+0000|||||||20200103000000DG1|1||Z34.90^Normal pregnancy^I10||20200103000000+0000|F|^Become_Pregnant"_$C(13,10)_
            "IN1|1|1772^STATE HEALTH PLAN|1027|MEDICAID||||||||||||Santana^Pearl^Gladys|||364 NE Oak Circle^^Trenton^MI^48183"_$C(13,10)
 set target=##class(EnsLib.HL7.Message).ImportFromString(string,.status)
 if 'status {do $system.Status.DisplayError(status) quit}
 set target.DocType="2.6:ADT_A01"
 
 do target.GetContentArray(.propertyPaths,, target.DocType)
 for i=1:1:propertyPaths {
   for j=1:1:propertyPaths(i) {
     i, ".", j, propertyPaths(i,j, "name"), !
   }
 }}
Shamus Clifford · Apr 1, 2022 go to post

To use the Euro symbol € as an example, it is a character in UTF-8. However, it is not a character in Latin1. Your Business Service uses the Default Char Encoding setting to read the message, so it does not read the Euro symbol as you would expect. Changing the Default Char Encoding to "unicode utf-8" would allow the Business Service to read that character as you would expect.

When you output your message, nothing in the message has actually changed (unless you have done some sort of Data Transformation). So, when you open the text editor, which uses UTF-8, you are able to see the Euro symbol again.

Shamus Clifford · Apr 13, 2022 go to post

You should create a custom schema with a custom ADT_A01 message type and structure. Documentation has a section on Creating a New Custom Schema.

Then, you may use that custom schema as you would any of the standard schemas. So, you can use your custom ADT_A01 message structure (with the MRG segment) as the target in your data transformation.

Shamus Clifford · Sep 14, 2022 go to post

You can override the OnConstructReply method from EnsLib.HL7.Service.Standard. The following worked for me.

Class DC.CustomACKBS Extends EnsLib.HL7.Service.TCPService
{

Method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As%String, ByRef pSC As%Status, pEarlyAck As%Boolean) As%Status
{
    Set pReplyDoc=##class(EnsLib.HL7.Message).%New()
    Set pReplyDoc.DocType="2.4:ACK"Set MSHStr="MSH|^~\&|EnsembleHL7|ISC|ARiM Server|ROWA|"_$REPLACE($REPLACE($ZDATETIME($HOROLOG,8,1),":",""), " ","")_"||ACK|"_pOriginalDoc.GetValueAt("MSH:10")_"|P|2.3"Set MSHSeg=##class(EnsLib.HL7.Segment).ImportFromString(MSHStr,.tSC,pOriginalDoc.Separators)
    Set MSAStr="MSA|AA|"_pOriginalDoc.GetValueAt("MSH:10")
    Set MSASeg=##class(EnsLib.HL7.Segment).ImportFromString(MSAStr,.tSC,pOriginalDoc.Separators)
    Set tSC=pReplyDoc.SetSegmentAt(MSHSeg,1)
    Set tSC=pReplyDoc.AppendSegment(MSASeg)

    Quit tSC
}

}
Shamus Clifford · Sep 21, 2022 go to post

That sounds correct. You should also have a Red Update button when you change the class. When you click that Update button, the component will start using your new code. If you do not have the update button you can restart the component by double clicking on the component and clicking Restart.

If that does not do the trick, perhaps you can post your code and ACK related settings for your component. I'm also interested to hear what is happening. Is the standard ACK being returned? No ACK at all?

Shamus Clifford · Sep 21, 2022 go to post

The output is being passed by reference. Are you using the correct variable name for your response message? The first argument in my method signature is pReplyDoc so I use pReplyDoc throughout my method.

Then don't forget to restart your component...I just forgot like 3 or 4 times.

Shamus Clifford · Sep 21, 2022 go to post

Ok, I just copy and pasted your code and it seems to work for me. Is this the response you are expecting?

And here is the Visual Trace. I added $$$LOGINFO("Constructing Reply") in the first line to make sure your method was being called.

Shamus Clifford · Dec 8, 2022 go to post

You can use the following:

<assignproperty='target.Source'value='source.Source'action='set'/>

This applies to any body property. Notice the difference between source (lowercase 's') representing the source message and Source (uppercase 'S') representing the body property. The more general syntax would be:

<assignproperty='target.BodyPropName'value='source.BodyPropName'action='set'/>

If you are using the graphical editor, you add a set action and type in the Property and Value.