web stats
Cannot read property "NTE.3.1" from undefined - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2014, 04:31 AM
LDHL7 LDHL7 is offline
Mirth Guru
 
Join Date: Apr 2011
Posts: 200
LDHL7 is on a distinguished road
Default Cannot read property "NTE.3.1" from undefined

I cannot figure out why I get this error as when I have a channelMap.put in place it writes the value to the mappings.

Code:
for each(orc in msg.ORC){
for each(obr in msg.OBR){
    for each(obx in msg.OBX){
        var nteGroup = getSegmentsAfter(msg,obx,'NTE',true);
	    if(nteGroup.length > 0){
                for each(nte in nteGroup){
		    if(nte['NTE.3']['NTE.3.1'].toString().indexOf('Isolate 1:') > -1 || nte['NTE.3']['NTE.3.1'].toString().indexOf(' Colony Count:') > -1){
		        obx['OBX.8']['OBX.8.1'] = 'ABNORMAL';
				}
			}
		}
	}
}
}
sample message:
Code:
MSH|^~\&|LAB||||201406071251||ORU^R01|20140607125130227|P|2.4|||||||||
PID|1||L79215B||TEST^PATIENT^^||20070620|F|||21 STREWT ST^^QUEENS^NY^11101|||||||||||||||||||||||||
ORC|RE|1605569^LAB|7702W1017295X1||||||201406041655|||10^TEST^DOCTOR^^^P||||^|
OBR|1|1605569|7702W1017295X1|2911^URINALYSIS /W MICROSCOPIC REVIEW^L^81003^^CPT|||201406041655|||GG|A|||201406042046||10^TEST^DOCTOR^^^^P|||||||||F||1^^^^^R^^^|^^^~^^^~^^^|||||||||
OBX|1|ST|10^COLOR||YELLOW||YELLOW - AMBER||||F|||201406051219||GG||||201406051219
OBX|2|ST|11^APPEARANCE||CLOUDY||CLEAR||||F|||201406051219||GG||||201406051219
OBX|3|ST|12^BLOOD||NEGATIVE||NEGATIVE||||F|||201406051219||GG||||201406051219
OBX|4|ST|13^GLUCOSE||NEGATIVE|MG/DL|NEGATIVE||||F|||201406051219||GG||||201406051219
OBX|5|ST|14^BILIRUBIN||NEGATIVE||NEGATIVE||||F|||201406051219||GG||||201406051219
OBX|6|ST|15^SPEC. GRAVITY||1.027||1.001 - 1.030||||F|||201406051219||GG||||201406051219
OBX|7|ST|16^PH||6.0||5.0 - 8.5||||F|||201406051219||GG||||201406051219
OBX|8|ST|17^PROTEIN||NEGATIVE|MG/DL|NEGATIVE||||F|||201406051219||GG||||201406051219
OBX|9|ST|18^UROBILINOGEN||<2.0|MG/DL|0.0 - 2.0||||F|||201406051219||GG||||201406051219
OBX|10|ST|19^LEUKOCYTE ESTERASE||NEGATIVE||NEGATIVE||||F|||201406051219||GG||||201406051219
OBX|11|ST|20^KETONES||NEGATIVE||NEGATIVE||||F|||201406051219||GG||||201406051219
OBX|12|ST|21^NITRITE||POSITIVE||NEGATIVE|A|||F|||201406051219||GG||||201406051219
OBX|13|ST|2151^MICROSCOPIC RBC||1 /HPF|HPF|0-3||||F|||201406051219||GG||||201406051219
OBX|14|ST|2152^MICROSCOPIC WBC||11 /HPF|HPF|0-5||||F|||201406051219||GG||||201406051219
OBX|15|ST|2165^EPITHELIAL CELL||OCCASIONAL|HPF|NEGATIVE|A|||F|||201406051219||GG||||201406051219
OBX|16|ST|2195^CALCIUM OXALATES||OCCASIONAL|HPF|NEGATIVE|A|||F|||201406051219||GG||||201406051219
ORC|RE|1605569^LAB|7702W1017295X1||||||201406041655|||10^TEST^DOCTOR^^^^P||||^|
OBR|2|1605569|7702W1017295X1|5000^URINE CULTURE^L^87088^^CPT|||201406041655|||ST|A|||201406042046||10^TEST^DOCTOR^^^^P|||||||||F||1^^^^^R^^^|^^^~^^^~^^^|||||||||
NTE|1|L|ADDED BY ELSIE ON 6-5-14 @ 12:00PM GT
ORC|RE|1605569^LAB|7702W1017295X1||||||201406041655|||10^TEST^DOCTOR^^^^P||||^|
OBR|3|1605569|7702W1017295X1|50005^EPICENTER WORKUP^L^^^CPT|||201406041655|||ST|A|||201406042046||10^TEST^DOCTOR^^^^P|||||||||F||1^^^^^R^^^|^^^~^^^~^^^|||||||||
OBX|1|TX|50070^~Results||||||||F|||201406071235||ST||||201406071235
NTE|1|L|Source:
NTE|2|L| URINE
NTE|3|L|
NTE|4|L|Isolate 1: .Esch. coli
NTE|5|L| Colony Count: >100,000 CFU/mL 
NTE|6|L|
NTE|7|L|Sensitivity Isolate 1 
NTE|8|L|------------------------- ----------------- 
NTE|9|L|Amikacin <=8 S 
NTE|10|L|Ampicillin >16 R 
NTE|11|L|Ampicillin/Sulbactam 16/8 I 
NTE|12|L|Aztreonam <=2 S 
NTE|13|L|Cefazolin <=2 S 
NTE|14|L|Cefepime <=1 S 
NTE|15|L|Cefoxitin <=4 S 
NTE|16|L|Ceftazidime <=0.5 S 
NTE|17|L|Ceftriaxone <=2 S 
NTE|18|L|Cefuroxime <=4 S 
NTE|19|L|Ciprofloxacin <=0.5 S 
NTE|20|L|Gentamicin <=2 S 
NTE|21|L|Imipenem <=1 S 
NTE|22|L|Levofloxacin <=1 S 
NTE|23|L|Meropenem <=1 S 
NTE|24|L|Nitrofurantoin 32 S 
NTE|25|L|Piperacillin/Tazobactam <=2/4 S 
NTE|26|L|Tetracycline <=2 S 
NTE|27|L|Tobramycin <=2 S 
NTE|28|L|Trimethoprim/Sulfamethoxaz >2/38 R
Reply With Quote
  #2  
Old 07-03-2014, 06:01 AM
LDHL7 LDHL7 is offline
Mirth Guru
 
Join Date: Apr 2011
Posts: 200
LDHL7 is on a distinguished road
Default

Just to update. I got it working....here is the code in case someone else runs into something similar....

Code:
for each(orc in msg.ORC){
	for each(obr in msg.OBR){
		for each(obx in msg.OBX){
			var nteGroup = getSegmentsAfter(msg,obx,'NTE');
			if(nteGroup.length > 0){
				for(var i =0; i < nteGroup.length;i++){
					var nteValue = nteGroup[i]['NTE.3']['NTE.3.1'].toString();
					if(nteValue.indexOf('Isolate 1:') > -1 || nteValue.indexOf(' Colony Count:') > -1){
						obx['OBX.8']['OBX.8.1'] = 'ABNORMAL';
					}
				}
			}
		}
	}
}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation