web stats
Multiple insurance segments - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-11-2007, 08:41 AM
dfelton dfelton is offline
Mirth Newb
 
Join Date: Mar 2007
Posts: 7
dfelton
Default Multiple insurance segments

I have a channel's source data as HL7 v2.x ADT with a destination's template also HL7 v2.x. All source messages contain at least one IN1 segment. I am having diffiulty getting Mirth to automatically add more than one IN1 segment to the outgoing data template.

My javascript step looks like this:

Code:
var i = 0;
var tempInsuranceCarrierID = ""

while (msg['IN1']['IN1.3']['IN1.3.1'][i] != null) {
	tempInsuranceCarrierID = msg['IN1']['IN1.3']['IN1.3.1'][i].toString();
	if (tempInsuranceCarrierID.length > 0) {
		logger.info(i + ' insurance Carrier ID = ' + tempInsuranceCarrierID);
		tmp['IN1']['IN1.1']['IN1.1.1'][i] = msg['IN1']['IN1.1']['IN1.1.1'][i]
		tmp['IN1']['IN1.2']['IN1.2.1'][i] = msg['IN1']['IN1.2']['IN1.2.1'][i]
                ...
                ...
		}
	i = i + 1
}
When I process a source message with more than one IN1 segment, the output is a single IN1 segment with mutliple sub-fields. In the following output example, the source ADT-A04 had 3 IN1 segments:

IN1|1|100|
IN1|2|100|
IN1|3|100|

...resulting in output:

IN1|1^2^3|100^100^100|

The output is the same whether the index (i) is included and incremented, or not. What am I doing wrong?
Reply With Quote
  #2  
Old 06-13-2007, 10:48 AM
brendanh brendanh is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 191
brendanh
Default Re:Multiple insurance segments

Try putting the [i] in the following place...

tmp['IN1'][i]['IN1.1']['IN1.1.1'] = msg['IN1'][i]['IN1.1']['IN1.1.1']
tmp['IN1'][i]['IN1.2']['IN1.2.1'] = msg['IN1'][i]['IN1.2']['IN1.2.1']
__________________
Brendan Haverlock | Mirth Software Engineer | Mirth Corporation
Reply With Quote
  #3  
Old 06-14-2007, 10:43 AM
dfelton dfelton is offline
Mirth Newb
 
Join Date: Mar 2007
Posts: 7
dfelton
Default Re:Multiple insurance segments

I've made that change, with the result that this error occurs on source messages with multiple IN1 segments:

ERROR-300: Transformer error
ERROR MESSAGE: Error evaluating transformer
org.mozilla.javascript.EcmaError: TypeError: Cannot read property "IN1.1" from undefined

Additionally, after running a transaction through with multiple IN1 segments, the Mirth log shows this:

destination-transformation: 0 insurance Carrier ID = MEDO
destination-transformation: 1 insurance Carrier ID = MCD

So, at least for the purposes of logging, iterating the repeating segments has worked. It's only when I try to change a template variable that errors occur.

I see in version 1.5 that the incoming and outgoing data template properties for HL7 v2.x have a checkbox for "Handle repetitions". This is checked on both incoming and outgoing. Is that new feature intended to help in this scenario?

Anybody have any clues?
Reply With Quote
  #4  
Old 10-16-2007, 09:35 AM
jlehew jlehew is offline
OBX.1 Kenobi
 
Join Date: Sep 2007
Posts: 26
jlehew
Default Re:Multiple insurance segments

I know one solution but I wish there were a better one. You have to add a blank segment to the Output Template. For instance I had to add OBX|||||| to the template, then code like:

var i = 0;
var obx = tmp['OBX'];
tmp['OBX'][i] = obx;
tmp['OBX'][i]['OBX.2']['OBX.2.1']="ST";

would work.

Regards,
John
Reply With Quote
  #5  
Old 10-16-2007, 09:36 AM
jlehew jlehew is offline
OBX.1 Kenobi
 
Join Date: Sep 2007
Posts: 26
jlehew
Default Re:Multiple insurance segments

I know one solution but I wish there were a better one. You have to add a blank segment to the Output Template. For instance I had to add OBX|||||| to the template, then code like:

var i = 0;
var obx = tmp['OBX'];
tmp['OBX'][i] = obx;
tmp['OBX'][i]['OBX.2']['OBX.2.1']="ST";

would work.

Regards,
John
Reply With Quote
  #6  
Old 10-17-2007, 06:32 AM
dvenier dvenier is offline
Mirth Newb
 
Join Date: Oct 2007
Posts: 21
dvenier
Default Re:Multiple insurance segments

Jlehew,
Take a look at my post http://www.mirthproject.org/index.ph...d=4016&catid=2. You should be able to take the concept of that and apply it to the IN1 segment.
Thanks,
-Dave
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple XML segments from HL7 dugjohnson Support 1 01-04-2017 06:37 AM
Receive multiple OBX segments nilesh Support 16 02-07-2013 02:24 PM
Multiple IN1 Segments with Optional IN2 Segments bdilworth Support 4 07-29-2008 11:24 AM
Mapping Multiple Segments Datawalke Development 1 07-18-2007 05:37 PM
Patients w/ multiple insurance nshaik Support 2 10-05-2006 01:39 PM


All times are GMT -8. The time now is 03:54 PM.


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