Announcement

Collapse
No announcement yet.

Do destinations inherit transformers from preceding destinations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.

    Comment


    • #3
      Interesting... I'll give that a go. Thanks!

      Cheers!
      D

      Comment


      • #4
        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!

        Comment


        • #5
          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.

          Comment


          • #6
            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).

            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

            Comment


            • #7
              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
              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.

              Comment


              • #8
                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!

                Comment

                Working...
                X