Announcement

Collapse
No announcement yet.

splitting the HL7 message

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

  • splitting the HL7 message

    One Lab result HL7 message is combination of multiple HL7 messages, can I split that to generate multiple HL7 messages by using mirth?

  • #2
    Re:splitting the HL7 message

    dabimahesh wrote:
    One Lab result HL7 message is combination of multiple HL7 messages, can I split that to generate multiple HL7 messages by using mirth?
    Yes you can. I have a channel that does that and I have attached it.

    This channel sends the first message immediately and then delays the remaining messages. This is a constraint of the receiving system which needed some time to process the lab request in each message to prevent duplicates. Split_ORU_R01.xml (6257 bytes)
    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:splitting the HL7 message

      I'm also trying to process lab results messages but would like to process the entire message.

      However this requires the ability to process the structure that is implied by the segment ordering.
      For example, the message below (details removed and segments indented to indicate their implied position within the tree)
      has 2 OBRs, the first of which has 5 OBXs, one of which has 3 NTEs.

      MSH
      PID
      OBR
      OBX
      OBX
      NTE
      NTE
      NTE
      OBX
      OBX
      OBX
      OBR
      OBX
      NTE
      NTE
      OBX
      NTE
      OBX
      NTE

      My question is, can Mirth deal with this kind of structure?

      I've tried code of the following form to walk the implied tree:

      Code:
        for each (obr in msg..OBR) {
          for each (obx in obr) {
            for each (nte in obx) {
          }
        }
      but without success.

      Looking at the transformed message in the admin console indicates that
      Mirth considers all of these segments to be directly connected to a common root ie there appears to be no nested hierarchy as far as Mirth is concerned.

      I'm new to Mirth and am having to try and figure things out by educated guesswork (and uneducated guesswork hence this post!) and searching the forum.
      However, I can't be the first person to want to do this so if you (or anyone else) could point me in the right direction that would be greatly appreciated.

      Comment


      • #4
        Re:splitting the HL7 message

        I'm also trying to process lab results messages but would like to process the entire message.

        However this requires the ability to process the structure that is implied by the segment ordering.
        For example, the message below (details removed and segments indented to indicate their implied position within the tree)
        has 2 OBRs, the first of which has 5 OBXs, one of which has 3 NTEs.

        MSH
        PID
        OBR
        OBX
        OBX
        NTE
        NTE
        NTE
        OBX
        OBX
        OBX
        OBR
        OBX
        NTE
        NTE
        OBX
        NTE
        OBX
        NTE

        My question is, can Mirth deal with this kind of structure?

        I've tried code of the following form to walk the implied tree:

        Code:
          for each (obr in msg..OBR) {
            for each (obx in obr) {
              for each (nte in obx) {
            }
          }
        but without success.

        Looking at the transformed message in the admin console indicates that
        Mirth considers all of these segments to be directly connected to a common root ie there appears to be no nested hierarchy as far as Mirth is concerned.

        I'm new to Mirth and am having to try and figure things out by educated guesswork (and uneducated guesswork hence this post!) and searching the forum.
        However, I can't be the first person to want to do this so if you (or anyone else) could point me in the right direction that would be greatly appreciated.

        Comment


        • #5
          Re:splitting the HL7 message

          I'm also trying to process lab results messages but would like to process the entire message.

          However this requires the ability to process the structure that is implied by the segment ordering.
          For example, the message below (details removed and segments indented to indicate their implied position within the tree)
          has 2 OBRs, the first of which has 5 OBXs, one of which has 3 NTEs.

          MSH
          PID
          OBR
          OBX
          OBX
          NTE
          NTE
          NTE
          OBX
          OBX
          OBX
          OBR
          OBX
          NTE
          NTE
          OBX
          NTE
          OBX
          NTE

          My question is, can Mirth deal with this kind of structure?

          I've tried code of the following form to walk the implied tree:

          Code:
            for each (obr in msg..OBR) {
              for each (obx in obr) {
                for each (nte in obx) {
              }
            }
          but without success.

          Looking at the transformed message in the admin console indicates that
          Mirth considers all of these segments to be directly connected to a common root ie there appears to be no nested hierarchy as far as Mirth is concerned.

          I'm new to Mirth and am having to try and figure things out by educated guesswork (and uneducated guesswork hence this post!) and searching the forum.
          However, I can't be the first person to want to do this so if you (or anyone else) could point me in the right direction that would be greatly appreciated.

          Comment


          • #6
            Re:splitting the HL7 message

            I'm also trying to process lab results messages but would like to process the entire message.

            However this requires the ability to process the structure that is implied by the segment ordering.
            For example, the message below (details removed and segments indented to indicate their implied position within the tree)
            has 2 OBRs, the first of which has 5 OBXs, one of which has 3 NTEs.

            MSH
            PID
            OBR
            OBX
            OBX
            NTE
            NTE
            NTE
            OBX
            OBX
            OBX
            OBR
            OBX
            NTE
            NTE
            OBX
            NTE
            OBX
            NTE

            My question is, can Mirth deal with this kind of structure?

            I've tried code of the following form to walk the implied tree:

            Code:
              for each (obr in msg..OBR) {
                for each (obx in obr) {
                  for each (nte in obx) {
                }
              }
            but without success.

            Looking at the transformed message in the admin console indicates that
            Mirth considers all of these segments to be directly connected to a common root ie there appears to be no nested hierarchy as far as Mirth is concerned.

            I'm new to Mirth and am having to try and figure things out by educated guesswork (and uneducated guesswork hence this post!) and searching the forum.
            However, I can't be the first person to want to do this so if you (or anyone else) could point me in the right direction that would be greatly appreciated.

            Comment


            • #7
              Re:splitting the HL7 message

              In order to get the appropriate nesting I have found that you need to check the "Use Strict Parser" in the properties of the Inbound Message Template. You will notice that the Inbound Message Template Tree will nest the segments.

              Comment


              • #8
                Re:splitting the HL7 message

                I didn't notice this thread before as I was looking in the support section.

                I am trying to deal with the same problem.

                I tried the Parse strict option and the message is supposedly not valid hl7 under strict. So the problem is still there. I have no control over the sending side.

                I'll paste the message that does not validate under strict option.

                Code:
                MSH|^~\&|dvscnr|vmhmdvip|LABRESULT|caradata|200307211731|PKI|ORU|591249|P|2.1
                MSA|AA|591249
                PID|1|1|2|3|Duck^Donald^D||19761010|M|||12 Disney Pl^Fantasy Land^Disneyland^USA 
                PV1||O|""
                OBR|1||M047507-07211730-01|T0301^General Micro Report^L|NM||200307190000|||||||200307190000||04498^Arator^Axel||||04498^Arator^Axel||200307211730
                OBX|1|FT|0301^General Micro Report^L||SPECIMEN: Faeces, No 2 in series\.br\\.br\MACROSCOPIC APPEARANCE: Semiformed ; Normal colour\.br\\.br\MICROSCOPIC EXAMINATION:\.br\- No intestinal parasites\.br\\.br\ROTAVIRUS: Negative\.br\GIARDIA SPECIFIC ANTIGEN - Negative.\.br\\.br\OCCULT BLOOD - Positive by peroxidase method. Negative by specific anti-\.br\human haemoglobin antibody method.\.br\This suggests proximal G.I.T. bleed or diet/drug interference.           ***\.br\\.br\CULTURE:\.br\\.br\       No Salmonella, Shigella, Campylobacter or Yersinia isolated. ---\.br\|||""|||F
                PID|2|1|2|3|Duck^Donald^D||19761010|M|||12 Disney Pl^Fantasy Land^Disneyland^USA 
                PV1||O|""
                OBR|1||L4920450-07211730-01|1918^Received from Health Waikato L^L|NM||200307081115|||||||200307080000||21892^Arator^Axel||||23460^Match^Footy||200307211730
                OBX|1|ST|1004324^Specimen^L||THROAT||||||F
                OBX|2|ST|1006800^VIRAL CULTURE^L||""||||||F
                OBX|3|ST|1005632^ Respiratory Culture^L||NEGATIVE||||||F
                NTE|1||  No Virus Isolated
                PID|3|1|2|3|Duck^Donald^D||19761010|M|||12 Disney Pl^Fantasy Land^Disneyland^USA 
                PV1||O|""
                OBR|1||L4934336-07211730-01|30^Complete Blood Count^L|NM||200307211220|||||||200307210000||29045^Day^Doris||||29045^Day^Doris||200307211730
                OBX|1|ST|8003^Haemoglobin^L||129|g/L|( 115 - 155 )||||F
                OBX|2|ST|8002^  RBC^L||4.11|x10\S\12/L|(3.60 - 5.50)||||F
                OBX|3|ST|8004^  Hct^L||0.37||(0.34 - 0.45)||||F
                OBX|4|ST|8005^  MCV^L||89.8|fL|(80.0 - 99.0)||||F
                OBX|5|ST|8006^  MCH^L||31.3|pg|(27.0 - 34.0)||||F
                OBX|6|ST|8010^ESR^L||4|mm/Hr|(   1 - 30  )||||F
                OBX|7|ST|8007^Platelet Count^L||248|x10\S\9/L|( 160 - 400 )||||F
                OBX|8|ST|8009^Platelet Morphology^L||Normal||||||F
                OBX|9|ST|8001^Total WBC^L||7.1|x10\S\9/L|( 4.0 - 11.0)||||F
                OBX|10|ST|8016^  Neutrophils Seg^L||4.64|x10\S\9/L|( 2.0 - 7.0 )||||F
                OBX|11|ST|8017^  Lymphocytes^L||1.53|x10\S\9/L|( 1.0 - 4.0 )||||F
                OBX|12|ST|8018^  Monocytes^L||0.62|x10\S\9/L|( 0.2 - 1.0 )||||F
                OBX|13|ST|8019^  Eosinophils^L||0.24|x10\S\9/L|( 0.0 - 0.6 )||||F
                OBX|14|ST|8020^  Basophils^L||0.04|x10\S\9/L|( 0.0 - 0.2 )||||F
                OBR|2||L4934336-07211730-02|42^Renal^L|NM||200307211220|||||||200307210000||29045^Day^Doris||||29045^Day^Doris||200307211730
                OBX|1|ST|1540^S. Uric Acid^L||0.14|mmol/L|( 0.18-0.47 )|L|||F
                PID|4|1|2|3|Duck^Donald^D||19761010|M|||12 Disney Pl^Fantasy Land^Disneyland^USA 
                PV1||O|""
                OBR|1||L4933563-07211730-01|15^Serological Tests for Syphilis^L|NM||200307210900|||||||200307210000||29045^Day^Doris||||29045^Day^Doris||200307211730
                OBX|1|ST|4505^TPHA^L||NEGATIVE||||||F
                PID|5|1|2|3|Duck^Donald^D||19761010|M|||12 Disney Pl^Fantasy Land^Disneyland^USA 
                PV1||O|""
                OBR|1||L4933563-07211730-01|15^Serological Tests for Syphilis^L|NM||200307210900|||||||200307210000||29045^Day^Doris||||23460^Match^Footy||200307211730
                OBX|1|ST|4505^TPHA^L||NEGATIVE||||||F

                Comment


                • #9
                  Re:splitting the HL7 message

                  I can get it to work if someone can answer one question.
                  How do I iterate through each node.

                  How do I get the name/type of the node your currently using. I want do do something like

                  for each (obj in msg)
                  {
                  //find out what kind of node the obj is, ie. PID, OBR, ORX
                  }

                  how do I do the above?

                  Cheers

                  Comment


                  • #10
                    Re:splitting the HL7 message

                    Did you solve that ?

                    Comment


                    • #11
                      Re:splitting the HL7 message

                      This is what I did. Not sure if it was for the before mentioned hl7 message but if not it was something similar.
                      This goes through the results and puts each set of results into a table.

                      Code:
                          var iObx = 0; // 0 based format
                          var iObr = 0; // 0 based format
                          var iOpi = 0; // 0 based format
                      
                        // Get the requests and patient details
                        for (var iOpi = 0; iOpi < msg['ORU_R01.PATIENT_RESULT'].length(); iOpi++)
                        {
                          // Patient details
                          var patientID = msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.PATIENT']['PID']['PID.2']['PID.2.1'].toString();
                          var patientID2 = msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.PATIENT']['PID']['PID.3']['CX.1'].toString();
                          var patientName = msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.PATIENT']['PID']['PID.5']['XPN.1']['FN.1'].toString() + msg['PID']['PID.5']['PID.5.3'].toString() + msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.PATIENT']['PID']['PID.5']['XPN.2'].toString();
                          var patientDOB = msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.PATIENT']['PID']['PID.7']['TS.1'].toString();
                          var patientSex = msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.PATIENT']['PID']['PID.8'].toString();
                      
                          // Read the results!
                          do
                          {
                              // Request details
                              var SetNo = msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.ORDER_OBSERVATION']
                              msg['OBR'][iObr]['OBR.1']['OBR.1.1'].toString();
                              var OrderNumber = msg['OBR'][iObr]['OBR.3']['OBR.3.1'].toString();
                              var UniversalServiceText = msg['OBR'][iObr]['OBR.4']['OBR.4.2'].toString();
                              var DateTimeRequested = msg['OBR'][iObr]['OBR.6']['OBR.6.1'].toString();
                              var OrderingProvider = msg['OBR'][iObr]['OBR.16']['OBR.16.2'].toString();
                              var ObservationDate = msg['OBR'][iObr]['OBR.7']['OBR.7.1'].toString();
                              var SpecimenSource = msg['OBR'][iObr]['OBR.15']['OBR.15.1'].toString();
                              // Process your OBX segment - msg['OBX'][iObx] - here
                              var Ob_ID = "NULL";
                              var Ob_Name = "NULL";
                              var Ob_Coding = "NULL";
                              var Ob_Range = "NULL";
                              var Ob_Value = "NULL";
                              var Units = "NULL";
                              var Abnormal_Flags = "NULL";
                              var Observ_result_status = "NULL";
                      
                              //variable obervation Name
                              var Ob_ID = msg['OBX'][iObx]['OBX.3']['OBX.3.1'];
                              var Ob_Name = msg['OBX'][iObx]['OBX.3']['OBX.3.2'];
                              var Ob_Coding = msg['OBX'][iObx]['OBX.3']['OBX.3.3'];
                              var Ob_Value = msg['OBX'][iObx]['OBX.5']['OBX.5.1']; 
                              var Units = msg['OBX'][iObx]['OBX.6']['OBX.6.1'];
                              var Ob_Range = msg['OBX'][iObx]['OBX.7']['OBX.7.1']; 
                              var Abnormal_Flags = msg['OBX'][iObx]['OBX.8']['OBX.8.1']; 
                              var Observ_result_status = msg['OBX'][iObx]['OBX.11']['OBX.11.1']; 
                              
                               //obr id needed to identify which obr this obx belongs to
                               var expression = "INSERT IGNORE INTO results ";
                      	 expression += "(LabNumber,Name,UR,DOB,Sex,CollectionDate,Test,TestName,Result,Range,Specimen,Flag,Units) ";
                      	 expression += "values ('" + OrderNumber + "', '" + patientName + "', '" + patientID2 + "', '" + patientDOB + "', '" + patientSex + "', '" + ObservationDate + "', '" + Ob_ID + "', '" + Ob_Name + "', '" + Ob_Value + "','" + Ob_Range + "','" + SpecimenSource + "', '" + Abnormal_Flags + "','" + Units + "');";
                      	 bigexpression = bigexpression + "\n" + expression;
                               var result = dbConn.executeUpdate(expression);
                      
                          	iObr++;
                          }
                          while (iObr < msg['ORU_R01.PATIENT_RESULT'][i0pi]['ORU_R01.ORDER_OBSERVATION'].length() && 1 != msg['OBR'][iObr]['OBR.1']['OBR.1.1']);
                        }
                      
                          //simply closes the connection to the DB
                          dbConn.close();
                      }

                      Comment

                      Working...
                      X