Announcement

Collapse
No announcement yet.

Cannot Generate HL7 Formatted Output

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot Generate HL7 Formatted Output

    Hi All!

    I'm attempting to do something which should be extremely simple. I want to deliver an HL7 message into Mirth via an LLP listener, extract ONLY the MSH and PID segments, and write those segments (MSH and PID) to a file in HL7 format.

    The LLP listener works just fine. The full HL7 message comes into Mirth.

    The Destination is set up as a File Writer. I've tried the following transformation: I map the MSH and PID segments to variables - msh and pid. I can see these variables in the Endpoints overview page and I can drag and drop them into the Template. When I run the interface the destination file contains the msh & pid segments but they're in XML format NOT HL7. How the heck does one simply move an entire segment from input to output and keep it in HL7 format.

    Also - some of the examples use a template with the following: ER7: ${HL7 ER7}. I canot find any reference whatsover to this. What is ER7? What does ${HL7 ER7} mean?????

    Is there any documentation anywhere that provides a fuller explanation on how to use the Template area, and how to use the Message Builder Type in the transformations editing page?

    We use the eGate interface engine here at work and, so far, Mirth is extremely frustrating to try and get working.

    Thanks in advance!!!!!

    Bob D.
    Bob Dilworth
    University of Toledo Medical Center
    Toledo, Ohio

  • #2
    Re: Cannot Generate HL7 Formatted Output

    Bob,

    Mirth treats everything as XML internally - once the message comes in, it is transformed to an XML representation. If you would like to just output segments from the original message, you would have to perform a small regular expression on the "rawData" variable.

    For example, to pull out the PID segment you would want your JS step to look something like this:

    Code:
    var pid = messageObject.getRawData() + ''; // makes a copy of the rawData
    pid = pid.replace(/.*(PID.*).*/g, "\1"); // the regular expression will match the entire message, but pull out the PID segment into the \1 reference
    connectorMap.put('pid', pid); // the resulting pid var should be placed into the connector map
    You will probably need to adjust that regex a bit, but that's the general idea. As far as the examples with ${HL7 ER7}, those are for older versions of Mirth. The documentation and examples will be updated soon with the latest variables and mappings. (FYI, HL7 ER7 is the same as messageObject.getRawData now).

    As far as the Template area and Message Builder, do you have specific questions? We apologize for the lack of documentation, and are working hard to provide as much as we can.

    -Chris
    Chris Lang

    Comment


    • #3
      Re: Cannot Generate HL7 Formatted Output

      Hi Chris!

      Thanks for the info! It looks like it'll be enough to get me back on track. I'll continue to mess around with it. I'm sure it's just a matter of traversing the learning curve. :-)

      Bob D.
      Bob Dilworth
      University of Toledo Medical Center
      Toledo, Ohio

      Comment


      • #4
        Re:Cannot Generate HL7 Formatted Output

        Try this:

        var input = messageObject.getRawData() + '';
        var start = /pid/gi;
        var end = /pv1/gi;
        var index1 = input.search(start);
        var index2 = input.search(end);
        var output = input.substring(index1,index2);

        connectorMap.put('output',output);

        Comment

        Working...
        X