web stats
How to process multiple PID, NTE, ZDR, OBR in the same file - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2010, 12:40 PM
Benzo Benzo is offline
OBX.1 Kenobi
 
Join Date: May 2010
Location: Québec Canada
Posts: 35
Benzo is on a distinguished road
Question How to process multiple PID, NTE, ZDR, OBR in the same file

Hi All

I need your help to figure it

In a ORU^R01 version 2.3 LAB FILE i find this structure.

Code:
MSH					Message Header (One per file sent)
{
	PID				Patient Identification (can be several)
	{[NTE]}				One or more Notes related to Patient Demographics
	{[ZDR]}			One or more physicians/clients/CC’s associated with order
	{	OBR			Observation Request
		{[NTE]}			One or more notes related to Observation Request
		{	OBX		Observation/Result
			{[NTE]}		One or more notes related to Observation/Result
			OBX		A second OBX segment within the same OBR
			...
		}
		OBR			A second OBR segment within the same PID
		...
	}
	PID				A second PID within the same MSH
	...
}					End of message (marked by end of file or by another MSH).

Do i need to do a nesting of For each PID with a for each Nte in it With a for Each ZDR etc... to process this kind of file ?

What is the best way to do this ?


TIA Benzo
Reply With Quote
  #2  
Old 07-28-2010, 02:35 PM
dans dans is offline
Mirth Employee
 
Join Date: Apr 2007
Location: Irvine, CA
Posts: 590
dans is an unknown quantity at this point
Default

Yes, you need to do that to process all data in all possible scenarios... But it is highly unlikely that you will need to do that. For example, it is very rare that you have multiple PID segments in an ORU message. Most vendors probably do not even support it... My suggestion is to get the spec and sample messages from the vendor and code your interface to it.

A normal ORU interface will have nested OBR, OBX, NTE loops however.
__________________
Daniel Svanstedt
Software Engineer
Mirth Corporation

Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!
Reply With Quote
  #3  
Old 07-29-2010, 06:06 AM
Benzo Benzo is offline
OBX.1 Kenobi
 
Join Date: May 2010
Location: Québec Canada
Posts: 35
Benzo is on a distinguished road
Question

Hi dans

I Have the spec and a sampel file and guess what
it contains 18 Pid Segement
each with muiltiple obr and obx segment
some with multiple NTE AND OBR ,OBX
and some with multiple ZDR

All in the same file

What is exactly Process Batch Files? Can it help me with this kind of file
Reply With Quote
  #4  
Old 07-29-2010, 06:41 AM
mourisj mourisj is offline
Mirth Guru
 
Join Date: Feb 2007
Location: Luxembourg
Posts: 407
mourisj is an unknown quantity at this point
Default

Batch files contain multiple messages; for HL7 this means that you have multiple MSH segments in the file.
__________________
JJ Mouris
FFE Luxembourg
IT-Department
Reply With Quote
  #5  
Old 07-29-2010, 06:42 AM
austinmoody austinmoody is offline
Mirth Newb
 
Join Date: Oct 2007
Location: Johnson City, TN
Posts: 24
austinmoody
Default

Not sure what you are needing to do with your data, but check this thread out for an example of javascript code to loop over segments in a transformer step. Not sure if that helps or not.

Process Batch Files on the File Reader screen will split an HL7 file into separate messages by MSH I believe (someone at Mirth may correct me on this). So, for example, if your 1 file had 10 MSH segments this would flow through Mirth as 10 different messages. However, according to what you are saying about your file it will still only go through as 1 message.
Reply With Quote
  #6  
Old 07-29-2010, 07:00 AM
Benzo Benzo is offline
OBX.1 Kenobi
 
Join Date: May 2010
Location: Québec Canada
Posts: 35
Benzo is on a distinguished road
Default

Im going to take a look at the thread, I only got on MSH in the file so i can't use the Process Batch
Reply With Quote
  #7  
Old 07-29-2010, 11:23 AM
Benzo Benzo is offline
OBX.1 Kenobi
 
Join Date: May 2010
Location: Québec Canada
Posts: 35
Benzo is on a distinguished road
Default

Hi

I know I have to loop for each segment PID and I still have to loop for each one of multiple different segments. This might give me a very large file java script

Is there a way to loop through each segment PID and when I meet an NTE segment "or another type of multiple segment" , call another function that it loops through the NTE segment which is in the PID segment underway.

Each function will add the information into a table sql

In this case I would not have a large java script and it would be easier to debug.

Can we use multiple destinations to do that if yes how to enable the destination at the right time. ?

Do you have a better way to do this ?
Reply With Quote
  #8  
Old 07-29-2010, 11:30 AM
dans dans is offline
Mirth Employee
 
Join Date: Apr 2007
Location: Irvine, CA
Posts: 590
dans is an unknown quantity at this point
Default

Yeah, you can define functions in javascript:

Code:
for(var i=0;i<msg.children().length();i++){
   var curSeg = msg.children()[i];
   if(curSeg.name() == "OBR"){
       processOBR(curSeg);
   }
   if(curSeg.name() == "OBX"){
       processOBX(curSeg);
   }
   if(curSeg.name() == "NTE"){
       processNTE(curSeg);
   }
}

function processNTE(msg){
// code here
}

function processOBR(msg){

}
function processOBX(msg){

}
__________________
Daniel Svanstedt
Software Engineer
Mirth Corporation

Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!
Reply With Quote
  #9  
Old 07-29-2010, 02:13 PM
Benzo Benzo is offline
OBX.1 Kenobi
 
Join Date: May 2010
Location: Québec Canada
Posts: 35
Benzo is on a distinguished road
Default

Can i create the functions in the Preprocessor script ?

TIA
Benzo
Reply With Quote
  #10  
Old 07-29-2010, 02:19 PM
mourisj mourisj is offline
Mirth Guru
 
Join Date: Feb 2007
Location: Luxembourg
Posts: 407
mourisj is an unknown quantity at this point
Default

Typically, you create them in the "Edit Code Templates" section. It is available in the channel tasks.
Those functions are available in all the channels.
You should save/export them separately, they are not included in the channels.
__________________
JJ Mouris
FFE Luxembourg
IT-Department
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:41 PM.


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