Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. 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 IN1 Segments with Optional IN2 Segments

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

  • Multiple IN1 Segments with Optional IN2 Segments

    Hi All!

    The vast majority of our interface work here at the University of Toledo Medical Center is HL7 to HL7 data mapping/transformation. We?re currently using the eGate interface engine (v4.5.3) but I?ve been doing a LOT of experimenting with Mirth lately and am actually finding that Mirth compares really favorably (so far) with eGate. I?m still not completely comfortable building interfaces with Mirth but the longer I play around with it the greater my comfort level is becoming.

    Anyhoo, I?ve run into a mental block with regards to determining exactly how to move multiple IN1 segments with an optional single IN2 segment from the inbound to the outbound message.

    For example, say you have an incoming message with the following IN1 IN2 pattern:

    IN1
    IN2
    IN1
    IN1
    IN1
    IN2
    IN1
    IN2

    I was able to successfully process the multiple IN1 segments and move them over to the outbound message via a javascript step (for each (in1 in msg..IN1) ) but I?m stuck on exactly how to go about attaching the optional IN2 segment to its ?parent? IN1 segment. I see how I could add another section of javascript code at the bottom of the for each (in1 in msg..IN1) loop to do this but I?m not sure how to detect the presence of a corresponding IN2 segment possibly occurring under the IN1 segment in the incoming message.

    Any thought as to how one might go about coding this?
    Also - I'm not married to using javascript exclusively do do this. Any creative (and/or intuitive or "appproved") method is fine with me!

    Thanks in advance!!!!!!!!!!!!!!!!

    Bob Dilworth
    University of Toledo Medical Center
    Toledo Ohio
    [email protected]
    Bob Dilworth
    University of Toledo Medical Center
    Toledo, Ohio

  • #2
    Re:Multiple IN1 Segments with Optional IN2 Segments

    Repeating should be indexed. IN1.1.1 should be a single integer and its matching IN2.1.1 should have the same index. So you would just loop through each IN1, check to see if there is an IN2 with the same index and match 'em up.
    Jon Bartels

    Zen is hiring!!!!
    http://consultzen.com/careers/
    Talented healthcare IT professionals wanted. Engineers to sales to management.
    Good benefits, great working environment, genuinely interesting work.

    Comment


    • #3
      Re:Multiple IN1 Segments with Optional IN2 Segments

      jbartels wrote:
      Repeating should be indexed. IN1.1.1 should be a single integer and its matching IN2.1.1 should have the same index. So you would just loop through each IN1, check to see if there is an IN2 with the same index and match 'em up.
      Hi Jon!

      Thanks for the info. However, I'm a bit perplexed as to how to code the check to see if there is an IN2 with the same index.

      Do you happen to have an example of something like that you can share?

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

      Comment


      • #4
        Re:Multiple IN1 Segments with Optional IN2 Segments

        bdilworth wrote:
        Do you happen to have an example of something like that you can share?
        [/quote]

        Not specifically, but I think it would look something like this:

        Code:
        //build index of IN2 segments
        
        //init empty array to store indexes of IN2 segments
        in2_segment_indexes = []
        
        for in2_seg in msg['IN2']
        {
          //push the index onto the array
          in2_segment_indexes << msg['IN2'][in2_seg]['IN2.1']['IN2.1.1']
        }
        
        //iterate through IN1 segments
        
        for in1_seg in msg['IN2']
        {
         //do stuff with IN1 segment...
        
         //check to see if IN1.1.1 has matching IN2.1.1. 
         //Double check this I dont know all of the JS array methods
         if (in2_segment_indexes.contains(msg['IN1'][in1_seg]['IN1.1']['IN1.1.1'])
         {
          //we have an in2 segment that matches up with an in1 segment
          //do stuff with the in2 segment...
         }
        }
        Post edited by: jbartels, at: 07/29/2008 10:59
        Jon Bartels

        Zen is hiring!!!!
        http://consultzen.com/careers/
        Talented healthcare IT professionals wanted. Engineers to sales to management.
        Good benefits, great working environment, genuinely interesting work.

        Comment


        • #5
          Re:Multiple IN1 Segments with Optional IN2 Segments

          Hi Again Jon!

          Well, our admitting system does not insert an index value into IN2.1.1. As a matter of fact IN2.1.1 is defined as the Insured's Employee ID and apparently is always blank (at least in the HL7 transactions I've seen coming out of our McKesson STAR system.

          So .. it appears the index detection method you've outlined isn't gonna work in this particular situation. That is of course unless I'm mis-understanding what you mean by index in this context. Are you implying that Mirth keeps an internal index of some kind separate from the actual values stored in the message that one can access via the [IN2.1.1] syntax? It didn't look like it based on your sample code but, again, my comfort level with Mirth and all of it's little niceties is not fully "there" yet.

          Any other thoughts on how to accomplish pairing a single, optional IN2 segment with it's corresponding IN1?

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

          Comment

          Working...
          X