web stats
Multiple IN1 Segments with Optional IN2 Segments - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2008, 08:05 AM
bdilworth bdilworth is offline
OBX.2 Kenobi
 
Join Date: Aug 2006
Location: Toledo, Ohio USA
Posts: 79
bdilworth
Default Multiple IN1 Segments with Optional IN2 Segments

Hi All!

The vast majority of our interface work here at the University of Toledo Medical Center is HL7 to HL7 data mapping/transformation. We?re currently using the eGate interface engine (v4.5.3) but I?ve been doing a LOT of experimenting with Mirth lately and am actually finding that Mirth compares really favorably (so far) with eGate. I?m still not completely comfortable building interfaces with Mirth but the longer I play around with it the greater my comfort level is becoming.

Anyhoo, I?ve run into a mental block with regards to determining exactly how to move multiple IN1 segments with an optional single IN2 segment from the inbound to the outbound message.

For example, say you have an incoming message with the following IN1 IN2 pattern:

IN1
IN2
IN1
IN1
IN1
IN2
IN1
IN2

I was able to successfully process the multiple IN1 segments and move them over to the outbound message via a javascript step (for each (in1 in msg..IN1) ) but I?m stuck on exactly how to go about attaching the optional IN2 segment to its ?parent? IN1 segment. I see how I could add another section of javascript code at the bottom of the for each (in1 in msg..IN1) loop to do this but I?m not sure how to detect the presence of a corresponding IN2 segment possibly occurring under the IN1 segment in the incoming message.

Any thought as to how one might go about coding this?
Also - I'm not married to using javascript exclusively do do this. Any creative (and/or intuitive or "appproved") method is fine with me!

Thanks in advance!!!!!!!!!!!!!!!!

Bob Dilworth
University of Toledo Medical Center
Toledo Ohio
bob.dilworth@utoledo.edu
__________________
Bob Dilworth
University of Toledo Medical Center
Toledo, Ohio
bob.dilworth@utoledo.edu
Reply With Quote
  #2  
Old 07-29-2008, 09:51 AM
jbartels jbartels is offline
Mirth Guru
 
Join Date: Oct 2006
Posts: 728
jbartels is on a distinguished road
Default Re:Multiple IN1 Segments with Optional IN2 Segments

Repeating should be indexed. IN1.1.1 should be a single integer and its matching IN2.1.1 should have the same index. So you would just loop through each IN1, check to see if there is an IN2 with the same index and match 'em up.
__________________
Jon Bartels

Zen is hiring!!!!
http://consultzen.com/careers/
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote
  #3  
Old 07-29-2008, 10:34 AM
bdilworth bdilworth is offline
OBX.2 Kenobi
 
Join Date: Aug 2006
Location: Toledo, Ohio USA
Posts: 79
bdilworth
Default Re:Multiple IN1 Segments with Optional IN2 Segments

jbartels wrote:
Quote:
Repeating should be indexed. IN1.1.1 should be a single integer and its matching IN2.1.1 should have the same index. So you would just loop through each IN1, check to see if there is an IN2 with the same index and match 'em up.
Hi Jon!

Thanks for the info. However, I'm a bit perplexed as to how to code the check to see if there is an IN2 with the same index.

Do you happen to have an example of something like that you can share?

Bob D.
__________________
Bob Dilworth
University of Toledo Medical Center
Toledo, Ohio
bob.dilworth@utoledo.edu
Reply With Quote
  #4  
Old 07-29-2008, 10:58 AM
jbartels jbartels is offline
Mirth Guru
 
Join Date: Oct 2006
Posts: 728
jbartels is on a distinguished road
Default Re:Multiple IN1 Segments with Optional IN2 Segments

bdilworth wrote:
Do you happen to have an example of something like that you can share?
[/quote]

Not specifically, but I think it would look something like this:

Code:
//build index of IN2 segments

//init empty array to store indexes of IN2 segments
in2_segment_indexes = []

for in2_seg in msg['IN2']
{
  //push the index onto the array
  in2_segment_indexes << msg['IN2'][in2_seg]['IN2.1']['IN2.1.1']
}

//iterate through IN1 segments

for in1_seg in msg['IN2']
{
 //do stuff with IN1 segment...

 //check to see if IN1.1.1 has matching IN2.1.1. 
 //Double check this I dont know all of the JS array methods
 if (in2_segment_indexes.contains(msg['IN1'][in1_seg]['IN1.1']['IN1.1.1'])
 {
  //we have an in2 segment that matches up with an in1 segment
  //do stuff with the in2 segment...
 }
}
Post edited by: jbartels, at: 07/29/2008 10:59
__________________
Jon Bartels

Zen is hiring!!!!
http://consultzen.com/careers/
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote
  #5  
Old 07-29-2008, 11:24 AM
bdilworth bdilworth is offline
OBX.2 Kenobi
 
Join Date: Aug 2006
Location: Toledo, Ohio USA
Posts: 79
bdilworth
Default Re:Multiple IN1 Segments with Optional IN2 Segments

Hi Again Jon!

Well, our admitting system does not insert an index value into IN2.1.1. As a matter of fact IN2.1.1 is defined as the Insured's Employee ID and apparently is always blank (at least in the HL7 transactions I've seen coming out of our McKesson STAR system.

So .. it appears the index detection method you've outlined isn't gonna work in this particular situation. That is of course unless I'm mis-understanding what you mean by index in this context. Are you implying that Mirth keeps an internal index of some kind separate from the actual values stored in the message that one can access via the [IN2.1.1] syntax? It didn't look like it based on your sample code but, again, my comfort level with Mirth and all of it's little niceties is not fully "there" yet.

Any other thoughts on how to accomplish pairing a single, optional IN2 segment with it's corresponding IN1?

Bob D.
__________________
Bob Dilworth
University of Toledo Medical Center
Toledo, Ohio
bob.dilworth@utoledo.edu
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
Multiple DG1 Segments into a database mrslatezb Support 3 02-24-2016 06:14 PM
Problem with multiple OBX segments dblodgett Support 11 05-13-2008 06:12 PM
Mapping Multiple Segments Datawalke Development 1 07-18-2007 05:37 PM
Multiple IN1 Segments in ADT messages arumpke Support 2 11-01-2006 02:04 PM


All times are GMT -8. The time now is 02:39 PM.


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