Iterate of OBX/NTE segments skip segments

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate of OBX/NTE segments skip segments

  • Creator
    Topic
  • #51952
    Jerry Schnecker
    Participant

      I am fairly new to Cloverleaf but have worked with other translators. Some of my questions for this were answered by previous posts/discussions. Thank you for those but I was unable to solve the following.

      I have an assignment to add NTE segments after OBX segments when certain conditions are present. One of the NTE segments must be added after the last NTE segment in the OBX segments.

      The problem I am having is the iterate is not including all of the OBX segments when it processes the transaction. I have the iterate set at the OBX/NTE group and OBX segment level. When the iterates run they seem to set itself so that it counts the OBX segments based on the number of OBX segments before the first note. For example:

      OBX

      OBX

      OBX

      OBX

      NTE wil count the OBX segments in groups of four skipping segments until it gets to the next NTE segments. I have changed the input transaction so the first NTE is after the third OBX segment and it then counts in groups of three.

      He is a copy of part of the transaction I am testing with:

      OBR|1|860491673^HNAM_ORDERID||CMP^Comp Panel|||20100810044500|||||||20100810044900|Blood&Blood|B90853^Cooney^Terence^M^^^^^Doctor Univeral Pin Number^Personnel^^^DOCUPIN~00899^Cooney^Terence^M^^^^^DPF #^Personnel^^^ORGANIZATION DOCTOR^HCM~NE0017004^Cooney^Terence^M^^^^^HCM License Number^Personnel^^^LICENSENBR^HCM~Internal Medicine^Cooney^Terence^M^^^^^Provider Specialty Code^Personnel^^^Provider Group Number~0612^Cooney^Terence^M^^^^^MH PCI Transcription^Personnel^^^COMMUNITY DR NBR~1316051584^Cooney^Terence^M^^^^^Personnel NPI^Personnel^^^NPI||||000002010222000394^HNA_ACCN~12516362^HNA_ACCNID||20100810053148||General Lab|F||1^^^20100810040000^^RT~^^^^^Routine|||||||||20100810030000

      OBX|1|NUM|NA^Sodium||143|mmol/L^mmol/L|136-145^136^145|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|2|NUM|AST^AST(SGOT)||25|U/L^U/L|0-35^0^35|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|3|NUM|GLU^Glucose||86|mg/dL^mg/dL|70-99^70^99|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|4|NUM|CA^Calcium||8.8|mg/dL^mg/dL|8.4-10.4^8.4^10.4|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      NTE|1|79|Results consistent with patient condition.

      OBX|5|NUM|ALT^ALT(SGPT)||16|U/L^U/L|0-40^0^40|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|6|NUM|CRE^Creatinine||1.1|mg/dL^mg/dL|0.5-1.2^0.5^1.2|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|7|NUM|ALKPHOS^Alk Phos||53|U/L^U/L|38-126^38^126|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|8|NUM|BUN^BUN||19|mg/dL^mg/dL|6-22^6^22|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|9|NUM|BILIT^Total Bilirubin||0.7|mg/dL^mg/dL|0.0-1.2^0.0^1.2|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|10|NUM|CO2^CO2||26|mmol/L^mmol/L|22-36^22^36|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|11|NUM|CL^Chloride||106|mmol/L^mmol/L|96-106^96^106|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      NTE|1|79|Results consistent with patient condition.

      OBX|12|NUM|GLOB^Globulin||2.1|g/dL^g/dL|2.1-3.7^2.1^3.7|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|13|NUM|ALB^Albumin||3.8|g/dL^g/dL|3.5-5.2^3.5^5.2|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|14|NUM|K^Potassium||3.3|mmol/L^mmol/L|3.5-5.5^3.5^5.5|LOW||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|15|NUM|TP^Total Protein||5.9|g/dL^g/dL|6.2-8.2^6.2^8.2|LOW||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      In the attached file is the iterate code that I have built and when it is run against this transaction it yields the following echo output:

      @CountOBXsegs is now 1

      @CountOBXsegs is now 2

      @CountOBXsegs is now 3

      @CountOBXsegs is now 4

      @CountOBXsegs is now 5

      @CountOBXsegs is now 6

      @CountOBXsegs is now 7

      @CountOBXsegs is now 8

      @CountOBXsegs is now 12

      @CountOBXsegs is now 13

      @CountOBXsegs is now 14

      @CountOBXsegs is now 15

      If I use a copy of the transaction with the first NTE segment after the third OBX segment as follows:

      OBR|1|860491673^HNAM_ORDERID||CMP^Comp Panel|||20100810044500|||||||20100810044900|Blood&Blood|B90853^Cooney^Terence^M^^^^^Doctor Univeral Pin Number^Personnel^^^DOCUPIN~00899^Cooney^Terence^M^^^^^DPF #^Personnel^^^ORGANIZATION DOCTOR^HCM~NE0017004^Cooney^Terence^M^^^^^HCM License Number^Personnel^^^LICENSENBR^HCM~Internal Medicine^Cooney^Terence^M^^^^^Provider Specialty Code^Personnel^^^Provider Group Number~0612^Cooney^Terence^M^^^^^MH PCI Transcription^Personnel^^^COMMUNITY DR NBR~1316051584^Cooney^Terence^M^^^^^Personnel NPI^Personnel^^^NPI||||000002010222000394^HNA_ACCN~12516362^HNA_ACCNID||20100810053148||General Lab|F||1^^^20100810040000^^RT~^^^^^Routine|||||||||20100810030000

      OBX|1|NUM|NA^Sodium||143|mmol/L^mmol/L|136-145^136^145|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|2|NUM|AST^AST(SGOT)||25|U/L^U/L|0-35^0^35|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|3|NUM|GLU^Glucose||86|mg/dL^mg/dL|70-99^70^99|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      NTE|1|79|Results consistent with patient condition.

      OBX|4|NUM|CA^Calcium||8.8|mg/dL^mg/dL|8.4-10.4^8.4^10.4|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|5|NUM|ALT^ALT(SGPT)||16|U/L^U/L|0-40^0^40|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|6|NUM|CRE^Creatinine||1.1|mg/dL^mg/dL|0.5-1.2^0.5^1.2|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|7|NUM|ALKPHOS^Alk Phos||53|U/L^U/L|38-126^38^126|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      NTE|1|79|Results consistent with patient condition.

      OBX|8|NUM|BUN^BUN||19|mg/dL^mg/dL|6-22^6^22|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|9|NUM|BILIT^Total Bilirubin||0.7|mg/dL^mg/dL|0.0-1.2^0.0^1.2|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|10|NUM|CO2^CO2||26|mmol/L^mmol/L|22-36^22^36|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|11|NUM|CL^Chloride||106|mmol/L^mmol/L|96-106^96^106|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      NTE|1|79|Results consistent with patient condition.

      OBX|12|NUM|GLOB^Globulin||2.1|g/dL^g/dL|2.1-3.7^2.1^3.7|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|13|NUM|ALB^Albumin||3.8|g/dL^g/dL|3.5-5.2^3.5^5.2|N||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|14|NUM|K^Potassium||3.3|mmol/L^mmol/L|3.5-5.5^3.5^5.5|LOW||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      OBX|15|NUM|TP^Total Protein||5.9|g/dL^g/dL|6.2-8.2^6.2^8.2|LOW||U|F|||20100810053147||^Arens^Tom^^^^^^^Personnel|^^^1a2b3c

      In this case I get:

      @CountOBXsegs is now 1

      @CountOBXsegs is now 2

      @CountOBXsegs is now 3

      @CountOBXsegs is now 4

      @CountOBXsegs is now 5

      @CountOBXsegs is now 6

      @CountOBXsegs is now 8

      @CountOBXsegs is now 9

      @CountOBXsegs is now 10

      @CountOBXsegs is now 12

      @CountOBXsegs is now 13

      @CountOBXsegs is now 14

      Notice in each case some of the segments were not included:

      In the first example segments 9, 10 and 11 were not included and in the second example 7, 11 and 15 were not included.

      I have tried both including and excluding the first group iteration and that makes no difference whether it is there or not. The group iteration for the OBX/NTE must be there or you only get the count down to the first NTE and nothing after. That makes sense but the skipping of the rest of the segments does not make sense.

      The attached file contains the structure of the iterate code and a copy of how the variant is setup.

      I should also say that I tried to control the iteration variables using the ADD funtion but still could not get all of the OBX segments counted.

      Has anyone else run into this? If so what is the solution?

      Thanks

      Jerry

    Viewing 1 reply thread
    • Author
      Replies
      • #72470
        Jim Kosloskey
        Participant

          Jerry,

          Is that variant one you built or one provided?

          The reason I ask is normally one does not see the OBX segment repeat inside of an OBX group that repeats.

          Typically the OBX group is like this:

          {

           OBX

           [{NTE}]

          }

          which means the OBX and NTE are paired in a group and the NTE is oprionally a member of that group but the OBX is required.

          Such that you can have

          OBX

          OBX

          OBX

          NTE

          OBX

             etc…

          Your definition would imply this:

          OBX

          OBX

          OBX

          OBX

          NTE

          But that is not how the data is presented – it is presented as one would normally expect to see.

          So the first thing I would suggest is to make sure your variant is accurate.

          Then (assuming it is not currently accurate) you need to ITERATE over the PID group (only need to do this if there will be more than one patient per message), then INSIDE the PID group ITERATE ITERATE over the OBR Group (only needed if there will be more than one OBR group per message, and finally INSIDE the OBR group ITERATE ITERATE over the OBX GROUP and inside of the OBX Group ITERATE over the NTE SEGMENT.

          If you do need the nesting described above (dependent on whether there will actually be repetitions at the various levels or you just want to account for them) remember to insert the previous group’s counter in the appropriate position in the address path of the basis.

          Once you have that together just make sure you copy sufficient fields to make sure you are navigating the message appropriately.

          Once you have that working, you can then build out what you need to do the NTE magic.

          To do the NTE stuff, you will need to know how many NTE segments exist for a particular OBX group. This can be accomplished by ITERATING through the NTE segments and storing off the counter value. Now you have the high-water mark and your NTEs will begin at a counter value one higher than the high water mark.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

        • #72471
          Jerry Schnecker
          Participant

            Jim thanks i think the variant is the answer. I changed it and it then worked as I thought it should. I will need to get with my associates on the change to the vairant

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.