web stats
Proper way to start a project - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2015, 01:40 PM
Turanga_Fry Turanga_Fry is offline
Mirth Newb
 
Join Date: Sep 2015
Posts: 10
Turanga_Fry is on a distinguished road
Default Proper way to start a project

Hi there, i am new to the Mirth tool, only done a few channels for laboratory requests, and now i have a new challenge and would like the opinion of the community.

So, I have to store in my DB certain OBX segments line by line, certain OBX meaning the value from OBX.3.2 must be for example (=="a" or =="b").

My thought is, first i have to create a channel to see if the HL7 message has some OBX segment with this 2 values in the various OBX.3.2 that can exist in the HL7 message( here i can't proceed because it filters all messages except the ones where the OBX are only "a" or "b"), i want to be possible to see if the message has an OBX.3.2 with this values not necessarily all.

this code is in the filter area.

Code:
for each( obx in msg.OBX){
if(obx.elements('OBX.3.2') == "a" || obx.elements('OBX.3.2') == "b")
return true
}
Then i want to send the accepted message to another channel where i will only get the OBX.3.2 with the values of "a" and "b" to store in a DB.
Here i think i have to make mappings with javascript.

Please tell me what you think and how would you do it
REgards
Reply With Quote
  #2  
Old 09-22-2015, 01:21 AM
Turanga_Fry Turanga_Fry is offline
Mirth Newb
 
Join Date: Sep 2015
Posts: 10
Turanga_Fry is on a distinguished road
Default

Made it already to send the HL7 messages that have in any of the OBX segments, in the field OBX.3.2 the values "a" and "b" and to filter that ones that don't pass this rule.

Code:
var i = 0;
while(msg['OBX']['OBX.3']['OBX.3.2'][i] != null) {

	if( msg['OBX']['OBX.3']['OBX.3.2'][i] == "a" || msg['OBX']['OBX.3']['OBX.3.2'][i] == "b")
{	
	return true;
	}
	i =i+1;
	
	}

Still thinking what is the better way now to store this values, do i in the same channel map the elements i want and in destinations store in DB with a loop again throught the OBX segments to store line by line in the table, OR do I send to another channel to do this ?

Regards
Reply With Quote
  #3  
Old 09-23-2015, 06:49 AM
Turanga_Fry Turanga_Fry is offline
Mirth Newb
 
Join Date: Sep 2015
Posts: 10
Turanga_Fry is on a distinguished road
Default

So I got a view of other solutions for the problem i presented in the comment above and I decided to transform in the destination each of my desired OBX segments, the OBX.3.2 = "a" or "b", so that each segment is sent alone as delimited text to another channel, i accomplished this with this code.

Code:
var i = 0;
while(msg['OBX']['OBX.3']['OBX.3.2'][i] != null) {

	if(msg['OBX']['OBX.3']['OBX.3.2'][i] == "a" || msg['OBX']['OBX.3']['OBX.3.2'][i] == "b")
{	
	var result = msg['OBX']['OBX.3']['OBX.3.2'][i].toString();
		
		router.routeMessageByChannelId('detination-channel-id-here',result);
	}
	i =i+1;
	
}
This loops throught the OBX segments to search for the desired values in certain field, this case the OBX.3.2, and then it send the string value from that segment to another channel, where this will be stored in a database after some transforms i need to do.

Regards
Reply With Quote
Reply

Tags
data base, mapping, mirthconnect, obx

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:07 AM.


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