Question
· Jul 5, 2017

DTL with subTransformation to get Message Details

Hi

 

I've got a Service that get ACK Messages originated by another system. 

 

I want to get the details of a Message when the ACK is CE (Failed Message).

 

I don't know whether this is the best approach but, at the moment, I have a DTL and I would like to search the Cache Database for a Message with the Control ID on the ACK in the MSA segment.

 

Any help with this would be great.

 

Tks.

Discussion (11)0
Log in or sign up to continue

Hi Joao,

I'm assuming you are sending an HL7 v2.x message from an operation, and its ACK is coming back via your service.

If this is the case then you might want to look at the deferred response functionality...

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

This allows you to automagically send the ACK back as a response to the sending process.

Depending on how you implement the process, you will have the original message in scope, or it will be passed as an on response argument with the ACK response.

Sean.

I've knocked up a quick example using dual ack's.

I've put the source code in a gist here...

https://gist.github.com/SeanConnelly/19b79c790daad530a754461923f9f2f1

Save the code to a file and import into a test namespace.

Either create the "in" and "archive" folders are per the inbound test file feeder, or change to suit your environment.

Drop an HL7 message into the "in" folder and this is what you will see in the trace...

The ACK message is sent into the service and is automatically forwarded to the sending operation where it is returned to the calling process as if it was original messages ACK.

Make sure to follow the instructions here when configuring the service and operation, they specifically need to be implemented using  EnsLib.HL7.Operation.TCPAckOutOperation and  EnsLib.HL7.Service.TCPAckInService

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

Also note, that you need to set the reply code actions so that the AE ACK is returned to the process, otherwise it will stop at the operation, I have set the actions to...

:?R=RF,:?E=W,:~=S,:?A=C,:*=S,:T?=C

Where a match on ?E will just warn and continue as if the message was ok.

Take a look at the custom class  Examples.DeferredHL7.CustomProcess

Which contains the following OnResponse method...

Method OnResponse(request As EnsLib.HL7.Message, ByRef response As EnsLib.HL7.Message, callrequest As EnsLib.HL7.Message, callresponse As EnsLib.HL7.Message, pCompletionKey As %String) As %Status
{
    $$$TRACE("request contains the inbound request "_request.RawContent)
    $$$TRACE("callrequest contains the sent request "_callrequest.RawContent)
    $$$TRACE("callresponse contains the deferred ACK "_callresponse.RawContent)
    quit $$$OK
}

This is where you will have both the original request messages and the ACK in the same scope. From here you can construct a new message from the data in both messages.

This is just one approach but should fit your needs.

Sean.

May I just  ask you another Question Sean?

We've got everything working. The only issue is that the operation partner which sends the original message out is dealing with the application ACKs (because it is the Partner). Our endpoint guys say they are getting a second message. Therefore, the original the ADT message and the ACK which the endpoint application don't want...

Is that because of the Reply Code Actions? I'm sorry if that's a dumb question. I am quite new to Ensemble and we don't learn everything at the Training...

Kind Regards,

Joao Palma