Question Smythe Smythee · Sep 28, 2022

Ens.DataTransform

Hi ,

I am Converting HL7 message into SDA3 format by using Ens.DataTransform Class but transformation is not happening while using this class and throwing the below error

ERROR <Ens>ErrException: <UNDEFINED>zTransform+1^Hosiptal.SDA3.DataTrans.1 *target -- logged as '-' number - @' Set target.Patient.Name=source.GetValueAt("PID:5")'

Let me know if any mistake please refer the below code

Class Hosiptal.SDA3.DataTrans Extends Ens.DataTransform
{

ClassMethod Transform(source As EnsLib.HL7.Message, target As HS.SDA3.Container) As %Status
{
 
   Set target.Patient.Name=source.GetValueAt("PID:5")
   Set target.Patient.BirthGender=source.GetValueAt("PID:8")
 
   Set $ZT="Trap",tSC=$$$OK
do {
$$$ASSERT(0) // Subclass Responsibility
Set tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
while (0)
Exit
Quit tSC
Trap
Set $ZT="",tSC=$$$EnsSystemError
Goto Exit
}}
 

Thanks,

Smythee

Product version: Ensemble 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.1 (Build 312_1_18937U) Fri Apr 26 2019 17:58:36 EDT

Comments

Eduard Lebedyuk · Sep 28, 2022

You need to create HS.SDA3.Container object in Transform method before using it. Something like this:

Class Hosiptal.SDA3.DataTrans Extends Ens.DataTransform
{

ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container, aux) As%Status
{
    #Dim sc As%Status = $$$OKSet sc =  ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml)
    Quit:$$$ISERR(sc) sc
    Set target = ##class(HS.SDA3.Container).%New()
    Set sc = target.InitializeXMLParse(.xml)
    Quit sc
}

}
0
Smythe Smythee  Sep 28, 2022 to Eduard Lebedyuk

Can you please give me an example so that i can learn from the example?

0
Eduard Lebedyuk  Sep 28, 2022 to Smythe Smythee

Code block in my answer is exactly that. What error are you getting  with it?

0
Smythe Smythee  Sep 28, 2022 to Eduard Lebedyuk

I am getting ERROR <Ens>ErrNotImplemented: Method Hosiptal.SDA3.DataTrans.Transform() not implemented error 

Please find the method i am using 

ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container) As %Status
{
   Set sc= ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml)
   Set target=##class(HS.SDA3.Container).%New()
   Do target.InitializeXMLParse(.xml)
   Set target.Patient.Name=source.GetValueAt("PID:5")
   Set target.Patient.BirthGender=source.GetValueAt("PID:8")
   Set $ZT="Trap",tSC=$$$OK
do {
$$$ASSERT(0) // Subclass Responsibility
Set tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
while (0)
Exit
Quit tSC
Trap
Set $ZT="",tSC=$$$EnsSystemError
Goto Exit
}}
 

0
Eduard Lebedyuk  Sep 28, 2022 to Smythe Smythee

Yes, well, you explicitly set your error in:

do {
$$$ASSERT(0) // Subclass ResponsibilitySet tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
} while (0)
Exit
Quit tSC
Trap
Set$ZT="",tSC=$$$EnsSystemErrorGoto Exit
} 

You need to remove that.

Also Patient info should be in SDA already, so you can remove:

Set target.Patient.Name=source.GetValueAt("PID:5")
Set target.Patient.BirthGender=source.GetValueAt("PID:8")
0
Smythe Smythee  Sep 28, 2022 to Eduard Lebedyuk

Ok thank you 

I have done the same in my studio but in custom business process i m not getting the value of transformed message 

my business process looks like this

Method OnRequest(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status
{
   
   Set tSC=##class(Hosiptal.SDA3.DataTrans).Transform(pRequest)
   Set NewObj=##class(%Library.GlobalCharacterStream).%New()
   Set pRequest=##class(Ens.StreamContainer).%New(NewObj)
   Set tOneTarget=..TargetConfigNames
   Set tSC=$$$OK   $$$LOGINFO("tSC"_tSC) For iTarget=1:1:$L(..TargetConfigNames, ",") Set tOneTarget=$ZStrip($P(..TargetConfigNames,",",iTarget),"<>W") Continue:""=tOneTarget
   Set tSC1=..SendRequestAsync(tOneTarget,pRequest) Quit:$$$ISERR(tSC)
   Set:$$$ISERR(tSC1) tSC=$$$ADDSC(tSC,tSC1)
   }
}

0
David Hockenbroch  Sep 29, 2022 to Smythe Smythee

Set tSC=##class(Hosiptal.SDA3.DataTrans).Transform(pRequest)

Is that a typo? Should maybe be "Hospital", not "Hosiptal".

0
Smythe Smythee  Sep 29, 2022 to David Hockenbroch

Hi David,

It is not a typo, I have used the same name in data transform class

i am not getting the value from the data transform class or Do i need to make any changes in my Business process class,Can you suggest do i need to make any changes?

0
Smythe Smythee  Sep 29, 2022 to Eduard Lebedyuk

hi,

Do i need make any changes in the Business process

0
Smythe Smythee  Oct 3, 2022 to Smythe Smythee

Hi,

Can you please explain the need of passing xml value into HS.Gateway.HL7.HL7ToSDA3 class

ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container, aux) As %Status {

#Dim sc As %Status = $$$OK

Set sc = ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml) Quit:$$$ISERR(sc) sc

Set target = ##class(HS.SDA3.Container).%New()

Set sc = target.InitializeXMLParse(.xml)

Quit sc

Thank you,

Smythee

}

0
Eduard Lebedyuk  Oct 3, 2022 to Smythe Smythee

GetSDA method accepts HL7 source in source variable and returns SDA stream in xml variable.

0
Smythe Smythee  Oct 3, 2022 to Eduard Lebedyuk

Thank you can i convert the output from GetSDA method into stream output 

because my business operation will only accepts stream as input?

0
Smythe Smythee  Oct 3, 2022 to Eduard Lebedyuk

i am getting below swizzle object error

ERROR <Ens>ErrException: <METHOD DOES NOT EXIST>zNewRequestMessage+4^Ens.MessageHeader.1 *%GetSwizzleObject,HS.SDA3.Container -- logged as '-' number - @' Set:(''tSC) tSC=pMessageBody.%GetSwizzleObject(0,.tOID)

0
Eduard Lebedyuk  Oct 3, 2022 to Smythe Smythee

HS.SDA3.Container is a registered, not persistent object so you can't pass it between business hosts.

Pass xml stream instead.

0