Announcement

Collapse

NextGen (Mirth) Connect 3.10.0 Released!

NextGen (Mirth) Connect 3.10.0 is now available as an appliance update and on our GitHub page. This release includes better SQL Server database support, security improvements through fixes and library updates, and improvements for the Advanced Clustering plugin with a focus on improving performance of many of the tasks that are carried out on a frequent interval. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Multiple insurance segments

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

  • Multiple insurance segments

    I have a channel's source data as HL7 v2.x ADT with a destination's template also HL7 v2.x. All source messages contain at least one IN1 segment. I am having diffiulty getting Mirth to automatically add more than one IN1 segment to the outgoing data template.

    My javascript step looks like this:

    Code:
    var i = 0;
    var tempInsuranceCarrierID = ""
    
    while (msg['IN1']['IN1.3']['IN1.3.1'][i] != null) {
    	tempInsuranceCarrierID = msg['IN1']['IN1.3']['IN1.3.1'][i].toString();
    	if (tempInsuranceCarrierID.length > 0) {
    		logger.info(i + ' insurance Carrier ID = ' + tempInsuranceCarrierID);
    		tmp['IN1']['IN1.1']['IN1.1.1'][i] = msg['IN1']['IN1.1']['IN1.1.1'][i]
    		tmp['IN1']['IN1.2']['IN1.2.1'][i] = msg['IN1']['IN1.2']['IN1.2.1'][i]
                    ...
                    ...
    		}
    	i = i + 1
    }
    When I process a source message with more than one IN1 segment, the output is a single IN1 segment with mutliple sub-fields. In the following output example, the source ADT-A04 had 3 IN1 segments:

    IN1|1|100|
    IN1|2|100|
    IN1|3|100|

    ...resulting in output:

    IN1|1^2^3|100^100^100|

    The output is the same whether the index (i) is included and incremented, or not. What am I doing wrong?

  • #2
    Re:Multiple insurance segments

    Try putting the [i] in the following place...

    tmp['IN1'][i]['IN1.1']['IN1.1.1'] = msg['IN1'][i]['IN1.1']['IN1.1.1']
    tmp['IN1'][i]['IN1.2']['IN1.2.1'] = msg['IN1'][i]['IN1.2']['IN1.2.1']
    Brendan Haverlock | Mirth Software Engineer | Mirth Corporation

    Comment


    • #3
      Re:Multiple insurance segments

      I've made that change, with the result that this error occurs on source messages with multiple IN1 segments:

      ERROR-300: Transformer error
      ERROR MESSAGE: Error evaluating transformer
      org.mozilla.javascript.EcmaError: TypeError: Cannot read property "IN1.1" from undefined

      Additionally, after running a transaction through with multiple IN1 segments, the Mirth log shows this:

      destination-transformation: 0 insurance Carrier ID = MEDO
      destination-transformation: 1 insurance Carrier ID = MCD

      So, at least for the purposes of logging, iterating the repeating segments has worked. It's only when I try to change a template variable that errors occur.

      I see in version 1.5 that the incoming and outgoing data template properties for HL7 v2.x have a checkbox for "Handle repetitions". This is checked on both incoming and outgoing. Is that new feature intended to help in this scenario?

      Anybody have any clues?

      Comment


      • #4
        Re:Multiple insurance segments

        I know one solution but I wish there were a better one. You have to add a blank segment to the Output Template. For instance I had to add OBX|||||| to the template, then code like:

        var i = 0;
        var obx = tmp['OBX'];
        tmp['OBX'][i] = obx;
        tmp['OBX'][i]['OBX.2']['OBX.2.1']="ST";

        would work.

        Regards,
        John

        Comment


        • #5
          Re:Multiple insurance segments

          I know one solution but I wish there were a better one. You have to add a blank segment to the Output Template. For instance I had to add OBX|||||| to the template, then code like:

          var i = 0;
          var obx = tmp['OBX'];
          tmp['OBX'][i] = obx;
          tmp['OBX'][i]['OBX.2']['OBX.2.1']="ST";

          would work.

          Regards,
          John

          Comment


          • #6
            Re:Multiple insurance segments

            Jlehew,
            Take a look at my post http://www.mirthproject.org/index.ph...d=4016&catid=2. You should be able to take the concept of that and apply it to the IN1 segment.
            Thanks,
            -Dave

            Comment

            Working...
            X