web stats
ACK Response - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2014, 01:57 AM
nirav.shah nirav.shah is offline
What's HL7?
 
Join Date: Apr 2014
Posts: 3
nirav.shah is on a distinguished road
Question 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

Last edited by nirav.shah; 04-16-2014 at 02:09 AM.
Reply With Quote
  #2  
Old 04-16-2014, 06:41 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

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).
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 05-15-2014, 01:16 AM
nirav.shah nirav.shah is offline
What's HL7?
 
Join Date: Apr 2014
Posts: 3
nirav.shah is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 05-15-2014, 06:03 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Quote:
Originally Posted by nirav.shah View Post
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.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Tags
ack, response message

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:54 PM.


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