TCL Proc to filter messages for two conditions

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf TCL Proc to filter messages for two conditions

  • Creator
    Topic
  • #49747
    Ariba Jones
    Participant

      I need to filter charge messages based on two conditions.  I currently have the kill_msg proc attached to my inbound charge line to kill messages based on one condition.  I have been asked to filter messages on this same charge line, but for a different condition.

      Currently, my kill_msg proc kills messages that are not a particular patient type so that they are not sent to the outbound thread.  I now need to have that same inbound thread (with the kill_msg proc) also kill messages that have ‘NO CHARG’ in the message.  I don’t think I can do this with the kill_msg proc since I already have one condition setup.

      Does anyone have a tcl proc that he/she would like to share that could filter messages based on two different conditions?  Or does anyone know of a way I could do this without a tcl proc?  I am not real familiar with tcl, so, I am not capable of writing a proc myself.

      Thanks in advance.

      Ariba Jones

    Viewing 34 reply threads
    • Author
      Replies
      • #63382
        John Hamilton
        Participant

          I need a little more detail to see if I have a proc. I don’t want to make too many assumptions.

          Are these HL7 messages ?

          If it is HL7, is the field you are filtering a repeating segment, Field, Sub field ?

        • #63383
          Ariba Jones
          Participant

            Sorry about that, John.

            These are HL7 messages.  These are actually DFT^P03 messages.  I am currently using the kill_msg proc to kill any messages that have a certain patient type (LBC) in the FT1-18 field.  I now need to also filter these messages by looking for ‘NO CHARG’ in the FT1-6 field.

            So, if the DFT^P03 message has ‘LBC’ in field FT1-18, I want to kill that message from going to the outbound thread.  I also need to kill the DFT^P03 message if it has ‘NO CHARG’ in the FT1-6 field before the message goes to the outbound thread.

            I don’t know if this is important, but my inbound charge thread sends these DFT^P03 messages to two outbound threads.  The filtering I need to do is for my route to only one of those outbound threads.

            The FT1 segment is a repeating segment.

            Thanks,

            Ariba

          • #63384
            Jim Kosloskey
            Participant

              Ariba,

              Why not stack the proc twice in the route detail.

              Any message which passes through the first  execution of the proc will be interrogated by the second execution.

              If it passes both filters, it is good to go.

              If not, it will be appropriately KILLed.

              Thanks,

              Jim Kosloskey

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #63385
              John Hamilton
              Participant

                Maybe not what you are looking for.

                But maybe you can Iterate in your xlate.

                And do an If in the Iteration, and suppress or xpmerror out the message.

                Would that work for you.

                Or do you really want a TCL to do it.

                I have some generic one you could use but they do not account for repeating segments.

              • #63386
                Jim Kosloskey
                Participant

                  Ariba,

                  I just realized I may have misunderstood what you want.

                  Do you want to KILL the message if FT1-18 is = ‘LBC’ OR FT1-6 = ‘NO CHARG’?

                  OR

                  Do you want to KILL the message if FT1-18 is = ‘LBC’ AND FT1-6 = ‘NO CHARG’?

                  Thanks,

                  Jim Kosloskey

                  email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                • #63387
                  Charlie Bursell
                  Participant

                    Why parse the same message multiple times?  Parse it once into shared varibles in a namespace.  Then you can have separate subroutines for as many filters as you like

                  • #63388
                    Ariba Jones
                    Participant

                      Jim,

                      I need this:

                      KILL the message if FT1-18 is = ‘LBC’ OR FT1-6 = ‘NO CHARG’

                      I need to look for either condition to be true, so, I think that is the OR condition you have asked about.

                      The other thing I have a question about is can I put ‘NO CHARG’ in the args field for this proc?  I think I was getting an error for this part.  I am wondering if the space between the two words is the problem.  This is the way the sending system sends the message though… NO CHARG.  Is there something I can do about this?

                      Thanks,

                      Ariba

                    • #63389
                      Jim Kosloskey
                      Participant

                        Ariba,

                        I am unfamiliar with that proc (we use a different proc which is utilized for virtually ALL of our filtering).

                        However, it may be you need to surround the literal with either double quotes or curly braces for that proc to function.

                        If that proc does not allow specifying more than one field and for whatever reason you do not want to modify the proc or write a new one, an option is to stack the proc twice each invocation having one of the two set of arguments. That should give you the effect of the OR.

                        However, as Charlie points out, that will mean parsing the message twice. That is a performance consideration – but you need to decide where you want to spend your resources.

                        Jim Kosloskey

                        email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                      • #63390
                        Ariba Jones
                        Participant

                          Jim,

                          I actually had not tried putting quotes around the literal in the args of this proc.  I will try that and see what happens.

                          I think the stacking of the proc works…it’s just to get the second proc to recognize the NO CHARG value.  I get an error for the NO CHARG value.  Other than that error, I think the stacking of the proc is working.

                          I will try the quotes around the literal and see what happens.

                          Thanks, Jim.

                          Ariba

                        • #63391
                          Huy Tran
                          Participant

                            Ariba,

                            I worked on a very similar filter just last week based on 2 conditions with repeating segments. I did a quick change to the procs to fit your scenario…

                            Hope this helps.

                          • #63392
                            Ariba Jones
                            Participant

                              Huy,

                              I downloaded your TCL proc.  I have one problem.  I need this to check the PV1-18 (patient type) field and the FT1-6 (transaction type) field.  I am looking for….

                              If PV1-18 = LBC, then kill the message

                              OR

                              If FT1-6 = NO CHARG, then kill the message

                              The PV1 segment does not repeat.  The FT1 segment does repeat.

                              Thanks,

                              Ariba

                            • #63393
                              Tom Rioux
                              Participant

                                I agree with John.  This could be done within an xlate.  Just iterate on the FT1 segment since it is the only one that repeats.  Then inside of the iteration, have your first line be an IF statement that will do the following check:

                                IF  PV1.18 eq LBC  ||  FT1.6 eq “NO CHARG”

                                then SUPPRESS the message

                                You will probably need to set the “LBC” and the “NO CHARG” to temp variables before using them inside the IF statement.  Also, make sure you use your iteration variable (i.e. %s1) when you specify the FT1 field in the IF statement.  

                                This should do the trick for you and you won’t have to worry about using a prexlate or OB TPS proc.

                                Hope this helps…

                                Tom Rioux

                              • #63394
                                Ariba Jones
                                Participant

                                  Ok, Tom.  I will try this and let you know if it works.

                                  Thanks,

                                  Ariba Jones

                                • #63395
                                  Ariba Jones
                                  Participant

                                    Tom,

                                    My xlate isn’t working. I have a couple of questions.  I have a feeling I am not doing something correctly.  The user tested this and the charges with NO CHARG in the message went to the receiving system.  The charges with NO CHARG in FT1-6 were not supposed to go to the receiving system.

                                    I have my xlate on the inbound thread.  That is where it should be, right?

                                    I have not used the SUPPRESS command in an xlate before, should I enter any parameters for this when I choose it in the xlate?  I just selected SUPPRESS, but did not enter any info into the fields for this command.

                                    Here is what my xlate looks like.  Can you tell me what the problem is?  I did not setup the repeating (iterate) portion for this because I realized that even though this is a repeating segment, it will never repeat in a message for me because we only receive one charge per DFT^P03 message.

                                    Thanks,

                                    Ariba

                                  • #63396
                                    Gary Atkinson
                                    Participant

                                      Try iterating over the FT1 segment.  Copy over the field in question.  Check the output of that field and IF it is equal to NO CHARG, then suppress message.

                                    • #63397
                                      Tom Rioux
                                      Participant

                                        You mentioned earlier that the FT1 segment is a repeating segment.  You will definitely need to iterate over the FT1 segment.  However, I do have a question to ask regarding these messeges.  If the sending system is sending multiple FT1 segments in one message, is it sending both chargeable items and non-chargeable items in the same message?  I’ve seen systems that have done this before.  The first FT1 may have a charge type that is a billable charge but the second FT1 may have a charge type that is a “NO CHARG” as you have stated.

                                        If this is the case, then you would not want to suppress the whole message but only that particular FT1 segment.  Let us know if this is the case and there are multiple ways of doing this.

                                        Thanks…

                                        Tom Rioux

                                        Baylor Healthcare Systems

                                      • #63398
                                        Ariba Jones
                                        Participant

                                          Tom,

                                          I only get one FT1 segment per charge (DFT^P03) message.  I never receive a charge (DFT^P03) message with more than one FT1 segment.  It is the way our charge interface was setup.  The sending system knows to only send one FT1 segment per charge message.  So, I will not have an FT1 segment with a chargeable item and another FT1 segment with a non-chargeable item in the same DFT message.  Each item comes in its own (single) charge message.  Although the FT1 segment is a repeating segment, it will (should) never repeat in the charge messages I receive because of the way this is setup.  That is the reason I did not do the ITERATE in my xlate for the FT1 segment once I thought about it.  

                                          Yes, I do want to suppress the whole message that has NO CHARG.  I am just wondering if I am not using the SUPPRESS command correctly in my xlate. (see my attachment)

                                          Are you saying that even though I will not get a repeating FT1 segment in the charge (DFT^P03) message, I should still do the ITERATE in my xlate?

                                          Thanks,

                                          Ariba

                                        • #63399
                                          Tom Rioux
                                          Participant

                                            You shouldn’t need an iterate if you are only getting one FT1 segment per message.  Can you show give us a screen shot of your routing portion of your NetConfig?

                                            This xlate should be working.  If replicated it on my system and it is working correctly.  I would replace the suppress with some entries with echo statements to make sure you are getting the correct information.

                                            Thanks…Tom

                                          • #63400
                                            Ariba Jones
                                            Participant

                                              Tom,

                                              Here is my Netconfig info.

                                              Let me know if you need to see anything else.

                                              Thanks,

                                              Ariba

                                            • #63401
                                              Tom Rioux
                                              Participant

                                                The only thing I can suggest at this point is to take the charge file you are testing with and run it through the route tester and save it to a file.  This will give you two files…one for Star which has the xlate…and one for LPC Outreach which is a raw route.

                                                The file for LPC Outreach will contain the “NO CHARG” messages since it is a raw route.

                                                The file for Star should not contain the “NO CHARG” messages since they are being suppressed in your xlate…provided it is working correctly.

                                                I am assuming here that you are blocking those NO CHARG messages for Star only…is that correct?  Or are you wanting to block them for LPC Outreach as well?  When the “user” said they still see the NO CHARG messages in the system, which system is the user referring to?

                                                Also, provided everything done so far is correct, I have to ask a stupid question…..did you bounce the process after changing the xlate?

                                              • #63402
                                                Michael Hertel
                                                Participant

                                                  Ariba,

                                                  Can you post your kill_msg proc?

                                                  I’ll tweak it for you.

                                                  -mh

                                                • #63403
                                                  Ariba Jones
                                                  Participant

                                                    Tom,

                                                    Here are my responses.

                                                    I am assuming here that you are blocking those NO CHARG messages for Star only…is that correct?  This is correct. I am only blocking the NO CHARG messages for Star.

                                                    Or are you wanting to block them for LPC Outreach as well? No, I do not want to block them for LPC Outreach.

                                                    When the “user” said they still see the NO CHARG messages in the system, which system is the user referring to?   The user is referring to the Star system.  The user still sees the messages with NO CHARG on Star after the interface is run.

                                                    Also, provided everything done so far is correct, I have to ask a stupid question…..did you bounce the process after changing the xlate?  Yes, I did bounce the process after changing the xlate.  I am sure of it….I think.  You have me wondering now. I will go back and bounce it again just to make sure and test this again.

                                                    Thanks,

                                                    Ariba

                                                  • #63404
                                                    Ariba Jones
                                                    Participant

                                                      Michael,

                                                      Here is my kill_msg TCL proc.

                                                      Thanks,

                                                      Ariba

                                                    • #63405
                                                      Michael Hertel
                                                      Participant

                                                        Ariba, I’ve tweaked Huy Tran’s previous proc for you.

                                                      • #63406
                                                        Elizabeth Wilson
                                                        Participant

                                                          Ariba;

                                                          I assume that: you have only one PV1 segment and multiple FT1 segments; you want to stop the msg if either case is true, not both. If it is so, try the following.

                                                          Have the IF PV1.18 equal to @…. SUPRESS statement coded first, separately.

                                                          Then set up ITER on FT1 segment using ‘type: field’, basis: FT1 .6 filed, variable: %f1. Do IF inside the ITER for FT1.6 equal to @…   If it’s true then do SUPRESS.

                                                        • #63407
                                                          Shravan K
                                                          Participant

                                                            Ariba,

                                                                     I think you are wasting your time simply messing with proc and as per your previous messages you are not best with tcl.

                                                                     The simplest thing u need to do is write an if condition to kill the message.Its very simple

                                                              Source                                                           Destination

                                                            1(0).0(0).FT1.00360.[0]                                  @Check_Chrg

                                                            #this statement will store the value present in the FT1.6  to  a variable.

                                                            1(0).0(0).FT1.00148.[0]                                   @Check_Pat_type

                                                            #this statement will store the value present in the FT1.18  to  a variable.

                                                            =NO CHRG                                                      @NoCharge

                                                            =LBC                                                              @Pat_type

                                                            #The above all are Copy statements

                                                            #Now take a if statement,in if

                                                            @Check_Chrg == @NoCharge  || @Check_Pat_type == @Pat_type

                                                            now Suppress the message

                                                            Hope this give you the solution.if you have already done 🙂  

                                                            -Shravan

                                                          • #63408
                                                            Michael Hertel
                                                            Participant

                                                              Shravan, Ariba actually meant PV1-18, not FT1-18.

                                                              Ariba posted the wrong value earlier but corrected it later.

                                                            • #63409
                                                              Shravan K
                                                              Participant

                                                                Michael,

                                                                           Its not much difficult to change it. Replace FT1.18 with PV1.18

                                                                that should work for him.

                                                                -Shravan

                                                              • #63410
                                                                Robert Milfajt
                                                                Participant

                                                                  Ariba,

                                                                  Did you try () in your original Xlate?

                                                                  I think the following might work for you (although I am typing it from a copy of your Xlate, so do not discount the fact I may have introduced human error, the point is the () around each eq condition):

                                                                  ( 0(0).PV1.00148.[0] eq @lbccon ) || ( 0(0).FT1(0).00360.[0] eq @nochg )

                                                                  The Xlate may have been evaluating left to right and the or might have happened before the FT1 eq check.

                                                                  You are right in that you do not need to iterate because you are specifying the first instance.

                                                                  Hope this helps,

                                                                  Robert Milfajt
                                                                  Northwestern Medicine
                                                                  Chicago, IL

                                                                • #63411
                                                                  Ariba Jones
                                                                  Participant

                                                                    No, Robert, I had not tried ().  I am actually waiting for the user to test this again to see if it works.  If not, I will try the parenthesis.  

                                                                    Thanks,

                                                                    Ariba

                                                                  • #63412
                                                                    Femina Jaffer
                                                                    Participant

                                                                      Arriba,

                                                                      Just to understand exactly what you are saying, did you want to check PV1 18 & FT1 18 for “LBC’, and FT1 6 for “No Charge”?

                                                                      Thanks

                                                                      Femina

                                                                    • #63413
                                                                      Ariba Jones
                                                                      Participant

                                                                        No, Femina.  I want to check PV1-18 for ‘LBC’ and FT1-6 for ‘NO CHARGE’.

                                                                        Thanks,

                                                                        Ariba

                                                                      • #63414
                                                                        Ariba Jones
                                                                        Participant

                                                                          Robert,

                                                                          I went back to my original xlate and added the ().  That appears to have worked. I will let the user test again to verify.

                                                                          Thanks for that recommendation.

                                                                          You all are the best!

                                                                          Thanks,

                                                                          Ariba Jones

                                                                        • #63415
                                                                          Tom Rioux
                                                                          Participant

                                                                            What version of Cloverleaf are you on.  You shouldn’t have needed to put the () around each condition to get it to work.  The () in an xlate IF statement means to “evaluate first”, which really doesn’t matter in this case since you want to suppress the message if either of the conditions is met.  It shouldn’t matter which is evaluated first.   We have something similar running on our 5.2 version and it works correctly without them.   The () can be used more appropriately in a situation such as the one below:

                                                                            IF

                                                                             0(0).PV1.00133,[1] eq @null &&

                                                                                       (0(0).EVN.00099 eq =A05 || 0(0).EVN.00099 eq -A08)

                                                                            THEN

                                                                              SUPPRESS

                                                                            It will evaluate the OR condition first, then evaluate the AND condition.  

                                                                            ANYWAY, glad you got it working finally.

                                                                            Tom

                                                                          • #63416
                                                                            Ariba Jones
                                                                            Participant

                                                                              Hi Tom.

                                                                              We are running version 5.2.  

                                                                              Just out of curiosity I took the () off and tested again.  It appears to work.  The user hasn’t tested this all the way through yet, so, I will leave this as is (without the ()) and see if it works.  If not, I will put the () back.

                                                                              Thanks,

                                                                              Ariba Jones

                                                                          Viewing 34 reply threads
                                                                          • The forum ‘Cloverleaf’ is closed to new topics and replies.