web stats
Do destinations inherit transformers from preceding destinations - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-17-2012, 12:18 PM
DeeWerner DeeWerner is offline
Mirth Newb
 
Join Date: Sep 2012
Location: Seattle, WA
Posts: 6
DeeWerner is on a distinguished road
Unhappy Do destinations inherit transformers from preceding destinations

Hi all,

Fair warning, I'm a total Mirth noob. I tend to learn software very quickly, usually without documentation, so I kind of dove right in. And now I'm SO close to having a solution in place, but keep hitting the same oddities.

I've been working with Mirth 2.2.1 (for just under 3 weeks so far) to receive HL7 messages from various health care systems (lately a lot of Epic), and in the current phase, those messages will be transformed, and output as a simple .txt file.

I'm a bit confused on where I need to put my transformers. I put transformers for segments that all event types will have in common (MSH, EVN, PID, PD1, PV1) in the source transformers. Then I have filters based on event types, and transformers on the destinations that have additional segments like PV2, NK1, DG1, and/or OBX. I thought that if a destination is above other destinations, those subsequent destinations can use transformers from them. A06 is the first that has NK1, so I put it above the other destinations hoping that any subsequent destinations would be able to use the NK1 transformers as well, but this doesn't seem to be the case, as subsequent destinations do not have values for those variables, despite data being present in the raw message.

I suppose this comes down to one question: Do I need to put transformers for segments/fields on every destination that uses them, or is there a way to allow destinations to inherit transformers from other destinations (as opposed to using the source transformers)?

I'm posting the channel, and if it's helpful, I can scrub some data and post sample messages.
Attached Files
File Type: xml IncomingInterface.xml (128.4 KB, 2 views)
Reply With Quote
  #2  
Old 10-17-2012, 12:41 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Actually, although by default destinations will execute in order, the filter and transformer steps do not stack on top of each other. When the source connector finishes, its encoded data is copied over as the raw data for each and every destination connector that executes.

That said, in a synchronized channel you can simulate the "stacking" effect just by using a filter/transformer to overwrite the msg variable with the transformed data of the previous destination. Probably the best way to do that is to place a reference to the MessageObject in the previous destination:

Code:
$c(connector,messageObject);
And then use it in the subsequent destination:

Code:
msg = new XML($c('Destination 1').getTransformedData());
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 10-17-2012, 01:52 PM
DeeWerner DeeWerner is offline
Mirth Newb
 
Join Date: Sep 2012
Location: Seattle, WA
Posts: 6
DeeWerner is on a distinguished road
Default

Interesting... I'll give that a go. Thanks!

Cheers!
D
Reply With Quote
  #4  
Old 10-17-2012, 01:58 PM
DeeWerner DeeWerner is offline
Mirth Newb
 
Join Date: Sep 2012
Location: Seattle, WA
Posts: 6
DeeWerner is on a distinguished road
Default

Ugh. I take it back. Too noob.

So...where do I put $c(connector,messageObject)?

And where do I set the msg on the subsequent destination?
msg = new XML($c('Destination 1').getTransformedData());

Are these just new steps?

Thanks again - really appreciate the quick response!
Reply With Quote
  #5  
Old 10-17-2012, 03:57 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

The first piece of code would go somewhere in your previous destination connector, and the second piece would go basically at the beginning of your subsequent destination's filter or transformer.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #6  
Old 10-18-2012, 12:45 PM
DeeWerner DeeWerner is offline
Mirth Newb
 
Join Date: Sep 2012
Location: Seattle, WA
Posts: 6
DeeWerner is on a distinguished road
Default

Yeah...that's where the noobishness comes in.

Just in case clarity is helpful, here's what I need: I have my NK1 fields in one destination (A06), but I need them available to all subsequent destinations. I can't put the NK1 transformers on the source since they occasionally don't exist, which causes an "undefined" error. So I need to make transformers for the NK1 fields on my A06 destination, and I need to be able to reference those transformers in my A02 destination (and any others after it).

Quote:
The first piece of code would go somewhere in your previous destination connector, and the second piece would go basically at the beginning of your subsequent destination's filter or transformer.
So...hmm. Do I add this as a step in the A06? If so, I'm a little lost on just what to do with it. Would that be a Javascript type transformer? Is the part in the code below that says connector to be replaced with the name of my channel? I don't see a spot that has a name for the connector. Also, the "c" between the $ and ( is new to me - does that trigger anything special? I've not seen characters in there.

Code:
$c(connector,messageObject);
Sorry for needing such hand-holding, just new to all of this. Really appreciate your help!

Thanks!
Dee
Reply With Quote
  #7  
Old 10-19-2012, 09:17 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

I've attached a sample channel to show you what I mean. I've also altered the code I use to make it work more easily with more than two destinations. Basically at the end of any given destination, add a JavaScript step that does this:

Code:
$c('messageObject',messageObject);
Then in subsequent destinations, you can add a JavaScript step at the beginning that does this:

Code:
msg = new XML($c('messageObject').getTransformedData());
Attached Files
File Type: xml Example - Stacking Transformers.xml (10.4 KB, 28 views)
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #8  
Old 10-19-2012, 04:58 PM
DeeWerner DeeWerner is offline
Mirth Newb
 
Join Date: Sep 2012
Location: Seattle, WA
Posts: 6
DeeWerner is on a distinguished road
Default

Ah, now that I see it like that, it makes sense. I should be able to implement this just fine now. Thanks so much for your assistance!
Reply With Quote
Reply

Tags
destination, filter, transformer

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 04:20 PM.


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