Announcement

Collapse
No announcement yet.

Set status to FILTERED when using destination-set filter

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

  • Set status to FILTERED when using destination-set filter

    I searched around quite a bit, but was unable to find the answer.
    I wanted to implement destination-set filtering for all of the obvious benefits; however, the filtered messages status is set to TRANSFORMED not FILTERED.
    Thus my statistics are incorrect.
    I don't even know how these messages get counted.
    It would increment the received counter, but then *poof* it is not filtered, queued, errored or sent, and so, no statistics.
    Is this right?
    I set a 'reason for filtering' variable to help with searching, but I wanted to know if it was possible that, in the destination-set filtering javascript, I could update the message status to FILTERED, and thus have correct channel statistics.
    Please understand that I know I could be wrong about all of these assumptions.
    I welcome ANY help or feedback at all.
    And thank you.

  • #2
    Hello,

    that is strange...normally when the filter is ok and "running" then message is showing as filtered and not transformed.

    Can you post your channel please?

    Best Regards
    Best Regards,
    Alex Neiva

    Comment


    • #3
      When Destination set filter works it will show as 1 recieved and 1 sent. Filtered stats won't be updated. What do you see on dashboard?
      HL7v2.7 Certified Control Specialist!

      Comment


      • #4
        I only have the one destination.
        So it's as if I have it set to remove all destination and hence no filtering.
        I will do some more testing to determine if any stats update.

        Comment


        • #5
          When you remove a destination it does not get included in the stats at all because it never ran.

          If you want the source connector to show filtered, then use a source filter instead of a destinationSet filter. That won't send to any of the destinations either.

          Comment


          • #6
            My issue is that I have to check the data against multiple tables, and filter based on that info.
            Your solution would require me to write all of that logic into a source filter, which might be what I have to do.
            But I would still like to drill into this concept a bit more.
            I think there should be a way to update the STATUS of the message to FILTERED as the destination-set filtered messages 'disappear' as a statistic.
            We have: received, filtered, queued, sent and errored.
            So these filtered by destination-set are marked simply 'received', a statistical black hole.
            Please correct me if I am wrong, and, please, is there a way to set the status of a message from a transformer?
            thanks

            Comment


            • #7
              You can set a destination status in the response transformer, but not to filtered (not relevant for you since your destination connector isn't running at all.)

              I believe the only way to set a source or destination connector to filtered is to actually do it in a filter.

              Altering the destinationSet isn't actually filtering. It's preventing the destination from running completely. That's why there is a performance benefit to doing it that way.

              You can do basically everything in javascript in the source filter that you can do in the source transformer. If you want to avoid looking something up twice, you can always stick it in the connectorMap in the filter and reuse it in the transformer.

              Comment


              • #8
                that was a very clever response!

                Comment


                • #9
                  I was thinking there might be a (unsupported) way to update the statistics directly without having to change the status of the message.

                  Those statistics can be a little misleading anyway. Received only applies to source connectors. Queued and Sent only apply to destination connectors. Filtered and Errored apply to both.

                  If your channel has more than one destination your numbers are not going to balance anyway.

                  Comment


                  • #10
                    Running into an issue with using a function in the source filter.

                    //Code:
                    var msgEvent = msg['MSH']['MSH.9']['MSH.9.2'].toString();
                    adtFilter(msgEvent)

                    //Function:
                    function adtFilter(msgEvent) {

                    if (msgEvent == 'A01' || msgEvent == 'A03' || msgEvent == 'A04' || msgEvent == 'A06' || msgEvent == 'A07' || msgEvent == 'A08' || msgEvent == 'A18' || msgEvent == 'A28' || msgEvent == 'A34' || msgEvent == 'A37' || msgEvent == 'A40') { return true; }
                    else { return false; }

                    }

                    Code works in the source filter but not as a function.
                    Context is set to Source and Destination connector.

                    v3.5.1

                    Any thoughts on what I am missing?

                    Comment


                    • #11
                      The function is returning true/false, but that doesn't return it to the whole script. Try this:
                      Code:
                      var msgEvent = msg['MSH']['MSH.9']['MSH.9.2'].toString();
                      return adtFilter(msgEvent);

                      -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
                      -= [email protected]
                      -= Mirth Connect (Advanced)-certified
                      -= Gold member of HL7.org
                      -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

                      Comment


                      • #12
                        Thank you! That did the trick!

                        Comment

                        Working...
                        X