web stats
Create NTE after all OBX's following OBR if it meets criteria - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-05-2017, 09:16 AM
vackerman vackerman is offline
Mirth Newb
 
Join Date: May 2015
Posts: 23
vackerman is on a distinguished road
Default Create NTE after all OBX's following OBR if it meets criteria

I have the following message that I need to create an NTE after all of the OBX's following the first OBR, and not the second OBR.

If OBR.4.1 = "CD FLD", then I need to create an NTE segment following each of the child OBX's.

Mirth Version 3.4

OBR|1|6486^LAB|6486^LAB|CD FLD^Cell Count Diff Fluid^L|||201706201328|||||||201706201328||FAMHA^F amily^Hays^FACP^^^MD FACC||00005960||||||LAB|F||^^^^^R|
OBX|1|ST|rbcfl^RBC, Body Fluid^L|1|2|cmm|See Below|N||A^S|F|||201706201330|IH^Hays Medical Center 4382800^L|
OBX|2|ST|wbcfl^WBC, Body Fluid^L|1|3|cmm|See Below|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|3|ST|flc^Color, Body Fluid^L|1|COLORLESS||See Below|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|4|ST|flapp^Appearance, Body Fluid^L|1|CLEAR||See Below|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|5|ST|neufl^Neutrophils, Body Fluid^L|1|1|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|6|ST|lymphfl^Lymphocytes, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|7|ST|monofl^Mononuclear WBCs, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|8|ST|eosfl^Eosinophils, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|9|ST|basofl^Basophils, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|10|ST|source fld cd^Source^L|1|PERITONEAL|||N||A^S|F|||201706201331 |IH^Hays Medical Center 4382800^L|
NTE|1||REFERENCE RANGES:|
NTE|2||COLOR ...................... PALE YELLOW|
NTE|3||APPEARANCE ................. CLEAR|
NTE|4||WBC ........................ <500/cmm|
NTE|5||RBC ........................ <25,000/cmm|
NTE|6|
NTE|7||INTERPRETATION:|
NTE|8|| Cell Type Associated Pathologic Conditions|
NTE|9|| --------- --------------------------------|
NTE|10|| Neutrophilia Peritonitis and malignancy|
NTE|11|
NTE|12|| Lymphocytosis Tuberculosis, malignancy, chylous|
NTE|13|| ascites and lymphoproliferative|
NTE|14|| disorders.|
NTE|15|
NTE|16|| Eosinophilia Chronic peritoneal dialysis,|
NTE|17|| lymphoma atrophy, vasculitis,|
NTE|18|| eosinophilic gastroenteritis,|
NTE|19|| and ruptured hydatid cyst|
OBR|2|6486^LAB|6486^LAB|CD CSF^Cell Count/Rflx Diff CSF^L|||201706201328|||||||201706201328||FAMHA^Fam ily^Hays^FACP^^^MD FACC||00005960||||||LAB|F||^^^^^R|
OBX|1|ST|csfc^Color, CSF^L|1|COLORLESS||Colorless|N||A^S|F|||2017062013 31|IH^Hays Medical Center 4382800^L|
OBX|2|ST|csfapp^Appearance, CSF^L|1|CLEAR||Cryst Clr|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|3|ST|wbc csf^WBC, Cerebrospinal Fluid^L|1|2|cmm|0-5|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
OBX|4|ST|rbc csf^RBC, Cerebrospinal Fluid^L|1|1|cmm|0-1|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
NTE|20||NOTE: RBC counts in CSF have limited diagnostic value. A|
NTE|21||few RBC's are normal in all CSF due to contamination by|
NTE|22||blood vessels injured during the lumbar puncture.|
Reply With Quote
  #2  
Old 07-10-2017, 06:02 AM
Thoughts_Shared Thoughts_Shared is offline
OBX.2 Kenobi
 
Join Date: Dec 2016
Posts: 60
Thoughts_Shared is on a distinguished road
Default

From what I understand if you encounter OBR.4.1 = "CD FLD" then create NTE after every OBX for that OBR. You can try this:

Code:
if (OBR4.1 == 'CD FLD') {
		for each (obx in getSegmentsAfter(msg, msg.OBR[0],'OBX')) {
			
			// Create the NTEs
		}
}
For the given example, it will create 10 NTEs - one after every OBX

Last edited by Thoughts_Shared; 07-10-2017 at 06:02 AM. Reason: I
Reply With Quote
  #3  
Old 07-12-2017, 12:39 PM
rkMC rkMC is offline
OBX.1 Kenobi
 
Join Date: May 2017
Posts: 48
rkMC is on a distinguished road
Default

How do you access the function, getSegmentsAfter()?
Is this from a jar we can download?
Reply With Quote
  #4  
Old 07-13-2017, 01:29 AM
Thoughts_Shared Thoughts_Shared is offline
OBX.2 Kenobi
 
Join Date: Dec 2016
Posts: 60
Thoughts_Shared is on a distinguished road
Default

Quote:
Originally Posted by rkMC View Post
How do you access the function, getSegmentsAfter()?
Is this from a jar we can download?
This should help:

http://www.mirthcorp.com/community/f...4608#post24608
Reply With Quote
  #5  
Old 07-17-2017, 02:59 PM
rkMC rkMC is offline
OBX.1 Kenobi
 
Join Date: May 2017
Posts: 48
rkMC is on a distinguished road
Default

Mirth 3.5

Thanks for the link to the routines. I still have another question. How do you build the NTE's? Do you reference the msg and tmp same as normal mapping? If you are going to build NTE's should the outbound template contain NTE? one or more? If the inbound has NTE's in the message (msg) and you create an NTE for each OBX, how do you reference the NTE iteration? The example above has 10 OBX's and 19 NTE's, how do you create new NTE's off of the OBX's without mixing up the inbound NTE's?
You can see I'm a little confused.
Bottom line for this newb is what should the inbound and outbound template look like for the above example and how do you create the new messages? I'm trying, but the code is getting one error after another such as:

Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: Lab Results
CONNECTOR: Destination 1
SCRIPT SOURCE: TRANSFORMER
SOURCE CODE:
443: {
444: for each(obx in getSegmentsAfter(msg, obr, 'OBX', true))
445: {
446: // map inbound obx to outbound obx
447: // OBX.1 Set ID
448: tmp['OBX'][obx_index]['OBX.1']['OBX.1.1'] = obx_index + 1;
449:
450: // OBX.2 Resulting Value Type
451: tmp['OBX'][obx_index]['OBX.2']['OBX.2.1'] = msg['OBX'][obx_index]['OBX.2']['OBX.2.1'].toString();
452:
LINE NUMBER: 448
DETAILS: TypeError: Cannot read property "OBX.1" from undefined
at abbcf63f-498a-4d0c-a767-e1fb01585839:448 (doTransform)
at abbcf63f-498a-4d0c-a767-e1fb01585839:509 (doScript)
at abbcf63f-498a-4d0c-a767-e1fb01585839:511
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Reply With Quote
  #6  
Old 07-18-2017, 02:39 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 838
siddharth is on a distinguished road
Default

Before you can reference OBX.1 of OBX[0], you need to create OBX[0].
Reply With Quote
  #7  
Old 07-18-2017, 11:10 AM
rkMC rkMC is offline
OBX.1 Kenobi
 
Join Date: May 2017
Posts: 48
rkMC is on a distinguished road
Default

Does anyone know where I can find the routine/function for "createSegmentAfter"?
I have found code to use this function, but I have only found the createSegmentBefore function.
Thanks in advance.
btw: I'm using version 3.5.0.8232 of Mirth Connect
Reply With Quote
  #8  
Old 02-20-2018, 08:58 AM
ashishshetty1992 ashishshetty1992 is offline
Mirth Newb
 
Join Date: Jan 2018
Location: Boston
Posts: 17
ashishshetty1992 is on a distinguished road
Default

Quote:
Originally Posted by rkMC View Post
Does anyone know where I can find the routine/function for "createSegmentAfter"?
I have found code to use this function, but I have only found the createSegmentBefore function.
Thanks in advance.
btw: I'm using version 3.5.0.8232 of Mirth Connect
Look for 'Create Segment After Segment' in the Reference tab of filter/transformer.
Reply With Quote
  #9  
Old 02-20-2018, 10:31 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

Quote:
Originally Posted by rkMC View Post
Does anyone know where I can find the routine/function for "createSegmentAfter"?
I have found code to use this function, but I have only found the createSegmentBefore function.
Thanks in advance.
btw: I'm using version 3.5.0.8232 of Mirth Connect
You have to add the code in the Code Templates. Otherwise you can't call it. Once you have the Code Template configured you can just use it as shown previously.
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 02:23 PM.


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