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