Quest and Mirth – 2


Already I wrote how to send an ORM file to Quest lab. Please refer this link – Quest and Mirth – 1
Now I am going to write here how to get/receive a result file (ORU) from Quest Lab.

You may have a different requirements, but as per my need I have created 2 channels for just getting the result and processing them within our system

1. 1st Channel Name : Quest-Results Import
2. Configuration Source:     
   Connector Type : JavaScript Reader
We need to define a timeline to trigger the java script code. Based on this pulling mechanism, your mirth request will be triggered to hit the Quest server for getting the result from them. Coz as I belive, once you send an order to Quest lab, they are not going to convey you that when did they upload the result. Hence we need to automate the process.

In javascript editor box write any valid java script code otherwise leaving it blank will throw you an error. like var app = “Quest”;

3. Configuration Destination:    
Connector Type : SOAP Sender
WSDL Path: https://<UserName>:<Password>@cert.hub.care360.com:443/resultsHub/observations/hl7?wsdl
Service Endpoint URI : https://<UserName>:<Password>@cert.hub.care360.com:443/resultsHub/observations/hl7
Send Response To : Quest Result WS  [This is your 2nd Channle – why? – You will come to know]
User Persistence QueueS : No
Method : GetHL7Results
Now you need to fill up the parameters to above method carefully under “Method” block in Mirth

> Click on string endDate – right side under value fill null
> int maxMessages = 1
> startDate = null
> rest you can leave them blank

Using above method you will get the result from Quest which will be sent to the 2nd channel. But Quest sends you an encoded ORU file (not the plain HL7 ORU file). Hence our target is to decode it and get the right HL7 ORU file.

4. 2nd Channel Name : Quest-Results-WS-Decoder
5. Configuration Source: channel reader ( from 1st channel )
Use the tranformation as below:

//This transformer reads the encoded result message, decodes it, convert it into string and writes to a file.
var qstORUmsg = new XML(msg);
//var qstORUmsgSize = qstORUmsg.*::Body.*::getHL7ResultsResponse.*::result.*::HL7Messages.*.length().toString();
var qstORUmsgSize = qstORUmsg.*::Body.*::getHL7ResultsResponse.*::result.*::HL7Messages.*::HL7Message.length().toString();

//channelMap.put('qstORUmsgSize',qstORUmsgSize);
var encoded = "", decoded = "", finalMsg = "", msgfileId  = "";
for(var i=0; i &lt; qstORUmsgSize; i++){
 encoded = qstORUmsg.*::Body.*::getHL7ResultsResponse.*::result.*::HL7Messages.*::HL7Message[i].*::['message'].toString();
 decoded = FileUtil.decode(encoded);
 finalMsg = Packages.java.lang.String(decoded);
 msgfileId = UUIDGenerator.getUUID();//DateUtil.getCurrentDate("hhmmss.SSS");
 FileUtil.write('C:/MedLink_IX/Quest/Results_Test/Decoded/'+msgfileId+'.hl7', false, finalMsg); 
}

This will be writing each HL7 ORU message into a file with unique name.

5. Message template to be used

Inbound Message Template – If you need the explanation of this envelope please let me know – rajesh4it@gmail.com

  <env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <env:Body>
                    <m:getHL7ResultsResponse>
                                <result>
                                              <HL7Messages>
                                                              <HL7Message>
                                                                          <controlId xsi:type="xsd:string">00000000000001043797</controlId>
                                                                          <message xsi:type="xsd:base64Binary">AnythingHere1</message>
                                                                </HL7Message>
                                                              <HL7Message>
                                                                          <controlId xsi:type="xsd:string">00000000000001066486</controlId>
                                                                          <message xsi:type="xsd:base64Binary">AnythingHere2</message>
                                                                </HL7Message>
                                                </HL7Messages>
                                                <isMore xsi:type="xsd:boolean">false</isMore>
                                                <requestId xsi:type="xsd:string">721fac9e0a801e0c112d96f02a978781</requestId>
                                  </result>
                      </m:getHL7ResultsResponse>
          </env:Body>
  </env:Envelope>

Outbound Message Template:
Keep a valide HL7 message of ORU type. [MSH, PID, PV1 …..]
6. Configuration Destination:  
Channel Writer (Dummy destination for WS Decoder) – as you already got the file using FileUtil.write

Advertisements

5 comments on “Quest and Mirth – 2

  1. Charline says:

    Hey very cool web site!! Man .. Beautiful .. Amazing .. I’ll bookmark your web site and take the feeds also…I am happy to find numerous useful info here in the post, we need work out more techniques in this regard, thanks for sharing. . . . . .

  2. Animesh says:

    Please explain the inbound and outbound envelope of transformer. i am working with mirth 2.2.1.
    Is their any different approach for getting Quest lab results on mirth 2.2.1.

  3. NS says:

    HI,
    I had Quest channels functional for 1.8. Due to business reasons we need to upgrade to 2.2.1 and I find that web-service sender conversion basically runs into weird issues. Getting the response from quest fails – no matter what combination of URL/service/ports I use. Do you have any insight into how to make this conversion work?
    thx

    • schoolhood says:

      Although I have not tried this in In 2.x version.
      But this should work : You should not embed username/pass into the url. You got a separate entry while configuring the destination for them.
      Let me know if pressing the “Get Operations” results you something in SOAP envelope text area if Mirth.

  4. Chris says:

    How can I acknowledge these results now that I have them?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s