Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   ACK Response (http://www.mirthcorp.com/community/forums/showthread.php?t=10374)

nirav.shah 04-16-2014 02:57 AM

ACK Response
 
Hello Guys.. I am totally new on Mirth and just starting today so please never mind my silly quesition!!

Well, Here is what I was doing and stuck..

I am using Mirth Connect Server 3.0.1.7051 and trying to process ADT 04 messaege for training. I've created a channel w/ below configuration.

Source:
Connector Type: TCP Listener
Source Queue: Off (Respond after Processing)
Response: Destination 1

Its source data is HL2.x

Destination:

Connector Type: File Writer


When I send message to this channel, it writes data to a file sucessfully and also sending me ACK BUT now I want different structure in ACK.


Here is the sample Hl7 message
MSH|^~\&|HIS|HIS|CSRIS|CSRIS|20140324121500||ADT^A 04|1z15447789|P|2.3.1|||AL|NE
EVN|A04|20140324121415||||20140324121415|^WED
PID|1||TL70471669^^^CHI ||LastName^FirstName||19840514|1|||Example^50 Netherton Street^Test^City^234RT|||||||||||1A||||||||
PV1|1|W||||||||C8|||||||||O0002685421||||||||||||| ||||||||||||20140301121412|


Default ACH that I am getting now is:
MSH|^~\&|CSRIS|CSRIS|HIS|HIS|20140416120459||ACK|2 0140416120459|P|2.3.1
MSA|AA|1z15447789


I want ACK in this format
MSH|^~\&|CSRIS|CSRIS|HIS|HIS|||ACK|RIS1z15447789|P |2.3.1||||||8859/1
MSA|AA|1z15447789


I tried to do this in Destination Response Tranformer, It was not working. Could you please help me w/ this?


I am a .NET guy and so I am used to intelligence support in coding BUT mirth does not have it :( Where can I find all list of functions available and very good sample code?

Thank you so much and I am sure this is just the start of many more questions:)

narupley 04-16-2014 07:41 AM

The destination response transformer transforms the response from your destination. A File Writer isn't a request/response connector in the way that a TCP Sender or HTTP Sender is, so there's no actual response payload to transform (hence the response transformer will not run, unless the data type is set to Raw).

Instead, set your source connector's Response setting to Postprocessor, and then build up your ACK manually in the postprocessor script:

Code:

var serializer = SerializerFactory.getSerializer('HL7V2');
var ack = new XML(serializer.toXML(new ACKGenerator().generateAckResponse(message.getConnectorMessages().get(0).getRawData(),'AA','')));
delete ack.MSH['MSH.7'];
ack.MSH['MSH.10']['MSH.10.1'] = 'RIS' + ack.MSA['MSA.2']['MSA.2.1'].toString();
ack.MSH['MSH.18']['MSH.18.1'] = '8859/1';
return serializer.fromXML(ack);

There are code templates on the right-hand side to help you with common things like converting between HL7 and XML, etc. Also for classes like ACKGenerator, you can right-click and select "View User API" to look at how they're used (or go here).

nirav.shah 05-15-2014 02:16 AM

Thanks Nick for your help. I was able to condtruct custom ACK and then sent to other system. It worked well.

I have one question though, How do I parse ACK message and fetch particular values.

for example,

I am getting this ACK and based on sucess/failure, I want to update my database. I want to fetch the ID here from MSA i.e. 227 in this message.

MSH|^~\&|RIS|RIS|APAS|Chelmsford|20140515143659||A CK|20140515143659|P|2.3.1
MSA|AA|227

I believe we need to write this in postprocessor script?

Please help me again..

Thank you so much.

narupley 05-15-2014 07:03 AM

Quote:

Originally Posted by nirav.shah (Post 39540)
Thanks Nick for your help. I was able to condtruct custom ACK and then sent to other system. It worked well.

I have one question though, How do I parse ACK message and fetch particular values.

for example,

I am getting this ACK and based on sucess/failure, I want to update my database. I want to fetch the ID here from MSA i.e. 227 in this message.

MSH|^~\&|RIS|RIS|APAS|Chelmsford|20140515143659||A CK|20140515143659|P|2.3.1
MSA|AA|227

I believe we need to write this in postprocessor script?

Please help me again..

Thank you so much.

If you're receiving an ACK in a destination connector and you want to parse it, that's what the response transformer is for.


All times are GMT -8. The time now is 11:55 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation