web stats
What is the use of Filter and Transformer - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-30-2013, 12:02 AM
aashishs aashishs is offline
What's HL7?
 
Join Date: Apr 2013
Location: Pune, India
Posts: 5
aashishs is on a distinguished road
Default What is the use of Filter and Transformer

Hi all,

I am new in Mirth and I want to know, what is the use of Filter and Transformer on either side Source or Destination.

Without adding Filter/Tranformer, I can send message, then what is the use of it.

Please respond me ASAP.
Please share if anybody has some useful link.

Thank you in advance.
Reply With Quote
  #2  
Old 04-30-2013, 07:33 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,116
narupley is on a distinguished road
Default

Messages flow through the channel in the following way:
  1. The source connector's receiver gets a message or stream of messages (in whatever way it's set up to do so, by LLP, or FTP, or HTTP, etc.).

  2. If batching is enabled on the source connector, the separation of a single message/stream into discrete messages happens here. After this point, we're dealing with a single message always.

  3. Now the message passes through the preprocessor. Here the user has the ability to modify the raw string before it moves on. This is usually used to globally replace things like invalid control characters and the like, but you can also perform whatever arbitrary code you want. If a message is passed to a channel from VMRouter (the JavaScript router.routeMessage function) or from manual user intervention (the Send Message dialog), message flow starts here.

  4. The message then goes through the source filter. This determines whether a message proceeds through the channel or not. The inbound message is serialized into XML (msg, an E4X XML object), and the user can easily key off of various fields/parts of the message to do validation, or whatever else. If the final result of the filter is true, then the message is "accepted" and moves on. Otherwise, the message is "filtered" and we skip to Step 9.

  5. At this point, the message goes through the source transformer. Generally, a transformer is active if it has at least one step, if it has an outbound template, or if the inbound or outbound data types aren't set to the default values. Here the user has the ability to modify the message. This could be a small modification, where the overall structure of the message won't change but certain fields here and there are changed. Or, it could be a large modification, where the overall structure of the message changes (and even the inbound/outbound data types may be different). Like the filter, the inbound message is serialized into XML (msg), so it's easy with E4X to make intuitive changes to known fields. You can also place values in one of the variable maps for later use. After the transformer finishes, msg (complete with any changes you might have made to it) is de-serialized into the encoded data (according to whatever the outbound data type is, for example, HL7 v2.x). If you have an outbound template specified, that too is serialized (tmp), and then tmp is de-serialized into the encoded data, rather than msg.

  6. Next, the message flows through each destination connector sequentially, starting with the destination filter. This works exactly like the source filter, except that this is specific to a destination. The inbound (raw) message for the destination filter is the same as the outbound (encoded) data from the source transformer. If the message is filtered here and there are more destination connectors, start at Step 6 again with the next destination. If the message is filtered and there are no more destinations, go to Step 9.

  7. The message flows through the destination transformer at this point, which works the same way as the source transformer. Each destination could be doing different things, so each may have completely different transformers. One may not do anything at all, while another may be converting HL7 v2.x to X12 while manually querying things from some remote database.

  8. After the destination transformer finishes, the destination connector's dispatcher actually sends/writes the message. This is dependent on the specific destination; it could be sending it on via LLP, or updating a database, or writing a file, or whatever. After this is done, if there are more destinations, go back up to Step 6 with the next one.

  9. After all destinations have completed, the postprocessor runs. The user can no longer modify the message at this point, nor would that even make sense; the message has already been modified and sent on to wherever it needed to go. Instead, the postprocessor allows for some arbitrary code to run that isn't necessarily tied to any specific destination. For example a processed flag might be updated in a database. Another common thing that happens here is to utilize the response map. Each destination generates its own response and places it in the response map. In the postprocessor, you can grab the response from any of the destinations and do something with it. You can also create a custom response and place it in the map, which can be useful for the next step...

  10. After the postprocessor runs, the source connector responds to the originating system (if applicable). In the case of LLP, there is an option to auto-generate and return an HL7 ACK, so that the user doesn't have to do anything else. But also, you can choose to respond from something in the response map. This could be a destination's response, or it could be a custom response that you placed in the map. After the source connector has responded to the originating system (or if no such response was applicable/necessary, like in the case of a File Reader), the message is officially done. If the message was just one of many in a batch and more are available, then flow returns to Step 3 with the next message. Otherwise, the channel just idly waits until the source connector receives another message (Step 1).
__________________
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 05-02-2013, 02:18 AM
aashishs aashishs is offline
What's HL7?
 
Join Date: Apr 2013
Location: Pune, India
Posts: 5
aashishs is on a distinguished road
Default

Hello Narupley,

Thank you for your reply in such a easy manner, that any one can understand.

I am using Mirth Connect 2.2.1 tag source code.

I add one combobox in Destinations for all Connector type with values from MessageObject.Status. Now I want to set same destination status for send Message. For this I added some LOC in DefaultMessageObjectController.ProcessMessage, to set Status in Message. But when I check in database, it shows me something else.

Following are my followed step,
I am creating one Channel with File Reader as Source's Connector type and File Writer as Destination's Connector type. Without setting any Filter or Transformer, I saved and deployed this channel. Now from Dashboard, I am trying to "send message", by right click on deployed Channel, then choose one HL7 file and then I "Process Message". Message is saved in configured database.

Kindly let me know, what I miss.
Reply With Quote
  #4  
Old 05-03-2013, 09:29 PM
spencerr spencerr is offline
OBX.1 Kenobi
 
Join Date: Oct 2011
Posts: 29
spencerr is on a distinguished road
Default Thanks Mirth employee for the explanation

Thanks for the clear explanation. I also needed that.
Good work.
Reply With Quote
  #5  
Old 07-25-2013, 05:03 PM
peterholthoffman peterholthoffman is offline
What's HL7?
 
Join Date: Jul 2008
Location: Greenville, SC
Posts: 2
peterholthoffman
Thumbs up Thank you narupley!

I would also like to say "Thank you!" as that's exactly the sort of information I have been looking for that seems to be missing everywhere.
Reply With Quote
  #6  
Old 07-30-2013, 02:24 PM
peterholthoffman peterholthoffman is offline
What's HL7?
 
Join Date: Jul 2008
Location: Greenville, SC
Posts: 2
peterholthoffman
Default

To set up for this question... On the Summary tab there's setting the Data Types. Clicking on that gives an opportunity to set the data type for three items: source connector inbound, source connector outbound, and destination 1 outbound.

Considering the list of steps given by narupley... are the following correct:

The source connector inbound is the point where step #1 starts?
The source connector outbound is the point where step #5 finishes?
The destination outbound is where step #8 finishes?

I am enjoying learning about Mirth but it is really hard going. Thank you to everyone for help!
Reply With Quote
  #7  
Old 09-16-2015, 10:16 AM
stephen.g stephen.g is offline
What's HL7?
 
Join Date: Jul 2014
Posts: 5
stephen.g is on a distinguished road
Default

Quote:
Originally Posted by narupley View Post
Messages flow through the channel in the following way:
  1. The message then goes through the source filter. This determines whether a message proceeds through the channel or not. The inbound message is serialized into XML (msg, an E4X XML object), and the user can easily key off of various fields/parts of the message to do validation, or whatever else. If the final result of the filter is true, then the message is "accepted" and moves on. Otherwise, the message is "filtered" and we skip to Step 9.
I know no one has been in this thread for a while but I really need to know why some of my messages are being filtered. How do I find out what is causing the result in "true" during this part of the process? Or how to see what my filters are set as?

Any help is greatly appreciated.
Reply With Quote
  #8  
Old 09-16-2015, 10:46 AM
eduardoa eduardoa is offline
Mirth Employee
 
Join Date: Mar 2013
Location: Santa Fe Springs, California
Posts: 134
eduardoa is on a distinguished road
Default

In the Edit Channel screen you would need to go to the specific connector that is filtering messages and check out the filter steps. There is an Edit Filter channel task on the left that will take you to your filter steps for that connector.
Reply With Quote
  #9  
Old 09-16-2015, 11:08 AM
stephen.g stephen.g is offline
What's HL7?
 
Join Date: Jul 2014
Posts: 5
stephen.g is on a distinguished road
Default

eduardoa,

Thank you so much! I've been racking my brain for hours over this, and it was so simple.
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 06:08 PM.


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