web stats
HL7 query response built with web service response - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2014, 12:55 AM
achtus achtus is offline
What's HL7?
 
Join Date: Apr 2014
Posts: 4
achtus is on a distinguished road
Default HL7 query response built with web service response

I’m looking for the best practices to create a channel that accepts a HL7 query (TCP) and return the HL7 query result. The response is built after a web service call that returns extra information.

Query generated by the client software :
MSH|^~\&|SOFT|||| Date ||QRY^A19|45|P|2.x
QRD|QueryDate|R|I|GETPAT1454|||1^&RD|800325|DEM^SO FT


Expected response structure [simplified] (outbound template on “Destination 1”) :

MSH|^~\&| SOFT || SOFT ||Date||COR^A19|1|P|2.x
PID|||Number|800325|Name^Firstname^^^ |DoB|M|||Road 12^^City^^ZipCode^Country|||Sex|


Mirth Connect Channel Configuration
Source
Connector Type = TCP Listener / Basic TCP on 6661 (Basic TCP is used because MLLP is not supported by the software => the query message does not start with a VT so we need to customize the message delimiter: <Message Data><FS><CR>)
- Source Queue = OFF
- Response = ReturnResponse (variable)
- Encoding Windows-1252
- 3 transformers are needed to extract query parameters
Destination 1
- Connector Type = Web Service Reader that returns a SOAP response and use the extracted parameters during the source transformation (Two-way without authentication)
- The Soap response will be converted to an HL7 query response with 3 Response scripts (2 message builders + 1 JavaScript)
- The script use responseMap.put("ReturnResponse", ResponseFactory.getSentResponse(SerializerFactory. getSerializer('HL7V2').fromXML(tmp)));
- Return the result on the same connection that used by the query
Scripts => none

Q1. Convert Web Service response to HL7 using the Response Script
- What’s the best practice to do that?
- I use an outbound template and when I try to change a value with JavaScript Builder, it automatically add a new segment even if it is already present in the outbound template

For example:
tmp['PID']['PID.1']['PID.1.1']=$('RequeteValeur'); => will add another PID segment.
But when I use the message builder BEFORE the JavaScript Response , it works perfectly

Q2. Add a carriage return after the last line (I check the outbound template and that should be ok)
- I have unchecked “Convert line breaks” in “Outbound properties” window it works but when I do that the outbound template tree cannot be used

Thanks for your time !
Reply With Quote
  #2  
Old 06-04-2014, 06:01 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 achtus View Post
Q1. Convert Web Service response to HL7 using the Response Script
- What’s the best practice to do that?
- I use an outbound template and when I try to change a value with JavaScript Builder, it automatically add a new segment even if it is already present in the outbound template

For example:
tmp['PID']['PID.1']['PID.1.1']=$('RequeteValeur'); => will add another PID segment.
But when I use the message builder BEFORE the JavaScript Response , it works perfectly
If tmp does not contain a PID segment and you set "tmp['PID']... = ...", then yes a PID segment will be automatically appended. That's expected. I have no idea what you're doing in the Message Builder step. If you post your channel it would be easier for people here to troubleshoot.

Quote:
Originally Posted by achtus View Post
Q2. Add a carriage return after the last line (I check the outbound template and that should be ok)
- I have unchecked “Convert line breaks” in “Outbound properties” window it works but when I do that the outbound template tree cannot be used

Thanks for your time !
I think you have some misunderstandings about what the data type properties do. The Convert Line Breaks property only applies to the serialization of the outbound template. It is not true that the "tree cannot be used" in that case. Instead, you probably didn't have a valid HL7 message in the template itself (with CRs). When Convert Line Breaks is disabled, only carriage returns are considered to delimit segments, as per the HL7 specifications. In any case, why do you need to disable that in the first place? If you don't have a good reason or you don't know what it does, generally you will want to leave it alone.
__________________
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 06-05-2014, 06:34 AM
achtus achtus is offline
What's HL7?
 
Join Date: Apr 2014
Posts: 4
achtus is on a distinguished road
Default

Thank you for your answer !

Q1 : I try to set PID and MSH values in Javascript. I'm probably doing something wrong The 2 message builder expressions before the Javascript work perfectly.
So I assume that :
- The hl7 outbound template is not valid/correct > Mirth does not recognize it like a valid HL7 and "ignore" it
- The tmp should be initialized. But how ? I use logger.info(SerializerFactory.getSerializer('HL7V2 ').fromXML(tmp)) just before fixing any values and I got the template in the console.
- I'm a n00b <= probably the best answer btw

Part of the Javascript (Response builder)

Code:
tmp['MSH']['MSH.7']['MSH.7.1']=dateString.toString();
tmp['PID']['PID.2']['PID.2.1']=objetResultat.Patient.NumeroPatient.toString();
tmp['PID']['PID.3']['PID.3.1']=objetResultat.Patient.Niss.toString();
tmp['PID']['PID.4']['PID.4.1']=objetResultat.Patient.NumeroPatient.toString();
Response

Code:
MSH|^~\&|MirthConnect||MirthConnect||200811111017||ADR^A19|179|P|2.4
PID|123|456|10000437363|508003|Bremer^Hans^^^||19631101|M|||Mercedesstr 12^^Bergheim^^68123^D|||||M|
MSH|||||||20140605154921
PID||24756|123456789|24756|Foo^Bar||1970101|F|||^^^^^|||||U
Q2 : Yes I made a mistake in the outbound template. I removed CR between segment so the HL7 template was wrong.
Attached Files
File Type: xml FotoFinder Dermato MLLP.xml (33.5 KB, 23 views)
Reply With Quote
  #4  
Old 06-06-2014, 03:28 AM
achtus achtus is offline
What's HL7?
 
Join Date: Apr 2014
Posts: 4
achtus is on a distinguished road
Default

Quote:
Originally Posted by achtus View Post
Q1 : I try to set PID and MSH values in Javascript. I'm probably doing something wrong The 2 message builder expressions before the Javascript work perfectly.
So I assume that :
- The hl7 outbound template is not valid/correct > Mirth does not recognize it like a valid HL7 and "ignore" it
- The tmp should be initialized. But how ? I use logger.info(SerializerFactory.getSerializer('HL7V2 ').fromXML(tmp)) just before fixing any values and I got the template in the console.
- I'm a n00b <= probably the best answer btw
Part of the Javascript (Response builder)
I found this snippet to get around

var deserializationProperties = SerializerFactory.getDefaultDeserializationPropert ies('HL7V2');
var templateTempo = SerializerFactory.getSerializer('HL7V2', null, deserializationProperties).fromXML(tmp);
tmp = new XML(SerializerFactory.getSerializer('HL7V2').toXML (templateTempo));
Reply With Quote
Reply

Tags
query reponse, response, tcp listener, web service destination

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 12:47 PM.


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