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

Inbound Lab HL7 repeated segments

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

  • Inbound Lab HL7 repeated segments

    Mirth version - 1.7.1

    I am trying to map Inbound Lab Hl7 to Xml.
    In the HL7 there are multiple NTE segments for different segments.
    I am having problem matching the NTE segment to the exact segment to which this belongs. Here is the sample message.

    MSH|^~\&|LAB|MET||7608112115|20080811211650||ORU^R 01|20080812461030900000|D|2.3|||||||
    PID|1|82581235|WH06434741T|34412081|TEST^PATONE||1 980120101|M||||||||||000127354|||||||||||||
    NTE|1|TX|TESTING FIELD 20 FOR REPORT COMMENT FIELD. THIS IS LINE ONE.|
    ORC|RE|344081|WH06434741T||CM|||||||1234^MCKERAHAN ^KELLY^L^^^^^UPIN||||||||
    OBR|1|344081|WH0643434741T|10165SB=^BASIC METABOLIC PANEL W/EGFR^^10165SB=^BASIC METABOLIC PANEL W/EGFR|||20080807115900|||||||20080811165000||1234^M CKERAHAN^KELLY^L^^^^^UPIN|||||
    OBX|1|NM|25000000^GLUCOSE^^25000000^GLUCOSE^||90|m g/dL|65-99|N|||F|||20080811181600|EN^^L|||
    NTE|1|| FASTING REFERENCE INTERVAL|
    OBX|2|NM|25000100^UREA NITROGEN (BUN)^^25000100^UREA NITROGEN (BUN)^||3|mg/dL|7-25|L|||F|||20080811181600|EN^^L|||
    NTE|1||TESTING FREE TEXT RESULTING. THIS IS LINE ONE USING MAXIMUM CHARACTER.|
    NTE|2||THIS IS LINE TWO OF TESTING FREE TEXT RESULTING.|
    OBR|2|344081|WH064741T|926RQEZ=^VITAMIN B6^^926RQEZ=^VITAMIN B6|||20080807115900|||||||20080811165000||1234^MCK ERAHAN^KELLY^L^^^^^UPIN|||||
    OBX|1|NM|85987130^VITAMIN B6^^85987130^VITAMIN B6^||12|ng/mL|||||F|||20080811181600|EZ^^L|||
    NTE|1||Reference Range:|
    NTE|2||2.1-21.7|
    NTE|3||Conversion Factor: Nanograms/mL x 4.046 = nanomoles/L|


    I used msg.children() to get segemnts.
    But when I use msg['NTE'].. I get all NTE segments that are in the message.
    I am trying to iterate each segment.
    Please help me out.. I am also attaching the channel though its not complete..


    Thanks

    Quest_Inbound_channel.xml (15343 bytes)

  • #2
    Re:Inbound Lab HL7 repeated segments

    You'll need to use a for each statement to iterate through each individual segment. A quick search of the forums on for each should return plenty of examples.

    Comment


    • #3
      Re:Inbound Lab HL7 repeated segments

      I know about the for each usage but the problem is there are multiple NTE segments for PID, OBX. How do you identify to which segment these NTE belongs to.

      Comment


      • #4
        HL7 repeated segments question

        there are multiple NTE segments for PID, OBX. How do you identify to which segment these NTE belongs to.

        I was wondering if anyone knew the answer to this question. I am having the same problem.

        Comment


        • #5
          Originally posted by newmirthuser View Post
          there are multiple NTE segments for PID, OBX. How do you identify to which segment these NTE belongs to.

          I was wondering if anyone knew the answer to this question. I am having the same problem.
          This is asked pretty often. Try searching around the forums and the wiki. The basic answer is that you need to loop through all segments in the message and then keep track of what type of segment you are on in each iteration of the loop and do whatever logic you want to based on the current and previous segments. Use the following to get all segments:
          Code:
          msg.children()
          Jacob Brauer
          Director, Software Development
          NextGen Healthcare

          sigpic

          Comment


          • #6
            I am in the exactly same situation and can not identify how to related the NTe segments with respective PID, OBX or OBR segments?
            This is seen when we try and convert HL7 to XML using transformer.
            Can anyone point to the right link on the forum to the solution for this?

            Comment


            • #7
              Originally posted by jacobb View Post
              This is asked pretty often. Try searching around the forums and the wiki. The basic answer is that you need to loop through all segments in the message and then keep track of what type of segment you are on in each iteration of the loop and do whatever logic you want to based on the current and previous segments. Use the following to get all segments:
              Code:
              msg.children()
              Hello Jacob,
              As per many people suggested here, I have browsed throught the entire Mirth community forum page by page to read almost all the threads that are being discussed.
              I was not really able to land on a page which gives a clear solution about how to identify the Multiple NTE segments which belongs to different segments like PID, OBR or OBX.
              The main purpose is to convert the HL7 message to a defined XML template having a right hierarchy of elemnts as per standard defined message.

              Can you please advide further?

              Comment


              • #8
                Hi,


                Maybe this will help ...


                for each (segNTE in msg..NTE) {
                var comment_value = segNTE['NTE.3']['NTE.3.1'].toString();
                logger.error(comment_value + " - segment above = " + msg.children()[segNTE.childIndex()-1].name());
                }


                Kind Regards

                Nico
                Nico Vannieuwenhuyze

                Amaron.be

                Comment

                Working...
                X