web stats
Copy part of OBX text to another segment. - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2016, 02:33 PM
HL7Chick HL7Chick is offline
What's HL7?
 
Join Date: Aug 2014
Location: Utah
Posts: 1
HL7Chick is on a distinguished road
Default Copy part of OBX text to another segment.

I found threads similar to this but not really what I am looking for. I am a novice when it comes to javascript so please bear with me.

I am trying to copy BiRADS out of a block of text. These are single OBX messages so that's why I was having a hard time searching for threads. This is an example message I have. Sometimes it can be BiRADS: 2 or even BiRADS: 2A for example and it will not always be at the end of the report. It can be at the beginning or even in the middle. How do I account for this? I'd like to put it somewhere like OBR 4.1.

Thank you!

MSH|^~\&|RIS|Facility|Mirth|Facility|2015090218350 3.0000+02:00||ORU^R01|e6A4KAxgVjLSlzBfSc7W|P|2.3
PID|1||123456||LASTNAME^FIRSTNAME||19000101000000. 0000+01:00|M||||||||||1
PV1|1|O|||||1^test^TEST||||||||||||||||||||||||||| ||||||||||20150902183024.0000+02:00
ORC|RE|2015227909|1||||^^30^20150816235300.0000+02 :00^20150817002300.0000+02:00||20150902183306.0000 +02:00|4^ACCOUNT^SYSTEM
OBR|1|2015227909|1||||20150902183333.0000+02:00||| ||||||||2015227909||||||CR|F||^^30^20150816235300. 0000+02:00^20150817002300.0000+02:00|||||1^test^TE ST||||||||||||70501^BREAST^^^BREAST TEST
OBX|1|TX|||TEST TEST TEST TEST TEST TEST TEST~TEST TEST TEST TEST TEST TEST TEST. ~TEST TEST TEST TEST TEST TEST TEST ~TEST TEST TEST.~TEST TEST TEST TESTTEST TEST TEST TEST ~TEST TEST TEST TEST TEST TEST TEST~TEST TEST TEST TEST TEST TEST TEST ~TEST TEST ~ITEST TEST TEST TEST TEST TEST TEST~TEST TEST TEST TEST TEST TEST TEST.~TEST TEST TEST TEST TEST TEST TEST.~~TEST TEST TEST TEST TEST TEST TEST.~~FIRSTNAME LASTNAME M.D.~ ~~~Imaging Technologist: FIRSTNAME
LASTNAME RT(R)(M), XX Medical Center~BiRADS: 2~||
Reply With Quote
  #2  
Old 07-11-2016, 05:22 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

For this you need to use the special ~ character.
In your channel, Go to HL7 v2.x Props-> Parse Field Repetitions and check it.

This will parse all ~ to serve the purpose of repeating field. Eg.

OBX|1|TX|||TEST1~TEST2~TEST3|

This means that OBX.5.1 can have 3 values TEST1,TEST2, and TEST3.

Now, you can use this small script below.
Code:
noOfOBX5=msg['OBX']['OBX.5'].length();
i=0;
while(i < noOfOBX5)
{
if(msg['OBX']['OBX.5'][i]['OBX.5.1'].toString() == "BiRADS: 2") {
	capture=msg['OBX']['OBX.5'][i]['OBX.5.1'].toString();
}


//map capture to OBR-4
msg['OBR']['OBR.4']['OBR.4.1']= capture;
Reply With Quote
  #3  
Old 07-11-2016, 06:13 AM
anadkat2000 anadkat2000 is offline
Mirth Newb
 
Join Date: May 2012
Posts: 20
anadkat2000 is on a distinguished road
Send a message via Yahoo to anadkat2000 Send a message via Skype™ to anadkat2000
Default Using JS search function

You can also use js search function something like this -

var obvalue = msg['OBX']['OBX.5']['OBX.5.1'].toString();

if(obvalue.search("BiRADS: 2")!=-1){
msg['OBR']['OBR.4']['OBR.4.1'] = "BiRADS: 2";
}
if(obvalue.search("BiRADS: 2A")!=-1){
msg['OBR']['OBR.4']['OBR.4.1'] = "BiRADS: 2A";
}
Reply With Quote
  #4  
Old 07-12-2016, 04:24 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

I have doubts that search function will work, now that msg is not a string but in E4x/XML format. But give it a try.
Reply With Quote
  #5  
Old 07-12-2016, 04:28 AM
anadkat2000 anadkat2000 is offline
Mirth Newb
 
Join Date: May 2012
Posts: 20
anadkat2000 is on a distinguished road
Send a message via Yahoo to anadkat2000 Send a message via Skype™ to anadkat2000
Default Copy part of OBX text to another segment.

I am able to achieve desired result. Did you try and experience any issue?
Reply With Quote
Reply

Tags
copy, obx, single

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 10:48 PM.


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