Announcement

Collapse
No announcement yet.

Dealing with Data in Repeating Segments

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

  • Dealing with Data in Repeating Segments

    Hi All!

    I have a couple of questions that are probably pretty basic but I'm having a heckuva time trying to figure out how to get Mirth to do it.

    1. What is the "proper" technique for extracting things from incoming HL7 repeating segments and placing a subset of those extracted things into repeating segments in the outbound HL7 message? Does anyone have any working examples they'd be willing to share?

    2. Can data extracted from the incoming message via javascript be inserted directly into the outgoing message without resorting to the use of variables in the outgoing message template??? If so, how do you do this? Again, does anyone have any working examples they'd be willing to share?

    Thanks in Advance!!!!!

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

  • #2
    Reealing with Data in Repeating Segments

    Can you post a sample message that we can reference?
    Chris Lang

    Comment


    • #3
      Reealing with Data in Repeating Segments

      Hey Bob D!

      I've done this things with "Javascript" type of transformer on outgoin' connection.

      All you have to do is create a loop of existing HL7 segments and mae new segment out of this!

      Example:
      Code:
      var count = 0;
      
      for each (dg in msg..DG1){
      
      	
      	tmp['seg3']['rpt'][count] = msg['DG1']['DG1.4'][count].toString();
      	
      	count++; 
      }
      So, my goal was create XML message from HL7 message with all DG1-4 values.
      I added sample XML structure to Outgoin' tab.
      Code:
      <seg1>
        <rpt></rpt>
      </seg1>
      That's it! I get that much <rpt> segments, as much is DG1 segments in incoming message!


      Hope that helps!

      Comment


      • #4
        Reealing with Data in Repeating Segments

        Hi Chris!

        Here's a sample message as per your request above ...

        Code:
        MSH|^~\\&|HBOC|A|NONPCM|A|200705011035||ADT^A08|19378204|D|2.2|19378204||AL||
        EVN|A08|200705011035||
        PID||00664951|00727550^^^A|27650^A121280|TEST^KATHLEENB^^^^||19420707|F||1|100 TEST AVE.^^TOLEDO^OH^43614^US^C^LUCAS|LUCAS|(419)125-8874|(419)383-3405|ENGLISH^4^|S||0710100001^^^A|456-63-2010||||||
        PD1||||51372^AKPUNONU^BASIL^^^^^
        PV1||I|6CD^6152^01^A^|3|||51372^AKPUNONU^BASIL^^^^MD|51372^AKPUNONU^BASIL^^^^MD|""|RHB||||1|||51372^AKPUNONU^BASIL^^^^MD|IR|0710100001^^^A|PP|||||||||||||||||||A|OCC^OCCUPIED||||200704110910|||||
        DG1|0|I9||TEST||ADMITTING||||||||
        DG1|99|I9||TEST||WORKING||||||||
        GT1|1|27650|TEST^KATHLEENB^^||100 TEST AVE.^^TOLEDO^OH^43614^US^C^LUCAS|(419)125-8874||19420707|F||S|456-63-2010|||1|MEDICAL COLLEGE HOSP^MCO|ATTN- BUSINESS OFFICE^P.O. BOX 10008^TOLEDO^OH^43699^US^^LUCAS|(419)383-3405||1
        IN1|1|||||||||||||^^||^^|||||||||||||||||||||||||||||
        ZCA||
        Bob Dilworth
        University of Toledo Medical Center
        Toledo, Ohio

        Comment


        • #5
          Reealing with Data in Repeating Segments

          Hi Oleg!

          Thanks for response!!!!!

          I'll give it a try and let you know what happens.

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

          Comment


          • #6
            Reealing with Data in Repeating Segments

            OK, well I FINALLY figured this out!!!! It was a real D'Oh! moment, let me tell ya.

            My mistake was using a destination template with the outbound HL7 message in it like this:
            Code:
            MSH|^~\\&|PCM|A|XYZ|A|${msh7}|OkToBundle|${msh9}|${msh10}|P|2.2|||AL|NE${cr}PID|1||${pid3}||${pid5}||${pid7}|${pid8}||||||||||${pid19}|${pid19}||${cr}PV1||I|6CD^6152^01^A^|3|||51372^AKPUNONU^BASIL^^^^MD|51372^AKPUNONU^BASIL^^^^MD|""|RHB||||1|||51372^AKPUNONU^BASIL^^^^MD|IR|0710100001^^^A|PP|||||||||||||||||||A|OCC^OCCUPIED||||200704110910|||||${cr}DG1||${holder}||TEST||ADMITTING||||||||
            I couldn't get the repeating segments to actually repeat. I suspected that I was overthinking things (which I tend to do a lot). It suddenly occurred to me that, rather than putting the ACTUAL HL7 in the destination template (as above), perhaps all I need to do was use ${message.encodedData} in the destination template and use my javascript step in my transformer to insert the variables into the outgoing message area like this:
            Code:
            tmp['MSH']['MSH.7']['MSH.7.1'] =  $('msh7');
            Damn if it didn't work!!!!!! For grins, and for anyone having similar troubles, here's the javascript step in my transformer:

            Code:
            var count = 0;
            tmp['MSH']['MSH.3']['MSH.3.1'] = "PCM";
            tmp['MSH']['MSH.5']['MSH.5.1'] = "XYZ";
            tmp['MSH']['MSH.7']['MSH.7.1'] =  $('msh7');
            tmp['MSH']['MSH.9'] = $('msh9');
            tmp['MSH']['MSH.10']['MSH.10.1'] = $('msh10');
            tmp['PID']['PID.3'] = $('pid3');
            tmp['PID']['PID.5'] = $('pid5');
            tmp['PID']['PID.7']['PID.7.1'] = $('pid7');
            tmp['PID']['PID.8']['PID.8.1'] = $('pid8');
            tmp['PID']['PID.19']['PID.19.1'] = $('pid19');
            
            for each (dg in msg..DG1)
            {
                logger.info('dg.1: ' + msg['DG1'][count]['DG1.1']['DG1.1.1'].toString());
                logger.info('tmp dg.1: ' + tmp['DG1'][count]['DG1.1']['DG1.1.1']);
                tmp['DG1'][count]['DG1.1']['DG1.1.1'] = msg['DG1']['DG1.1']['DG1.1.1'][count].toString()
                count++;
            }

            Also - if anyone wants this channel for use as an example e-mail me offline and I'll send it to you.

            Hurray! Hurray!

            Bob D. (Hurray!)

            Post edited by: bdilworth, at: 05/10/2007 08:28
            Bob Dilworth
            University of Toledo Medical Center
            Toledo, Ohio

            Comment


            • #7
              Reealing with Data in Repeating Segments

              can I get a copy of your repeating segments channel?

              thanks a lot,
              Julia

              Comment


              • #8
                Hi

                Can you give me also one of those copies?

                Thanks in advance,
                João

                Comment


                • #9
                  Reealing with Data in Repeating Segments

                  Can I also get a copy of your repeating segments channel?

                  Thanks a lot,
                  Sly

                  Comment


                  • #10
                    Need sample channel

                    Please send me sample channel to process repeating segments in Mirth.

                    Comment


                    • #11
                      Does anyone have a sample channel that shows this looping process?

                      Thanks

                      Comment

                      Working...
                      X