› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › TCL Proc to filter messages for two conditions
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
Are these HL7 messages ?
If it is HL7, is the field you are filtering a repeating segment, Field, Sub field ?
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
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.
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.
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.
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
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.
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
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.
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
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
Thanks,
Ariba Jones
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
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
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
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
Here is my Netconfig info.
Let me know if you need to see anything else.
Thanks,
Ariba
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?
Can you post your kill_msg proc?
I’ll tweak it for you.
-mh
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
Here is my kill_msg TCL proc.
Thanks,
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.
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
Ariba posted the wrong value earlier but corrected it later.
Michael,
Its not much difficult to change it. Replace FT1.18 with PV1.18
that should work for him.
-Shravan
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
Thanks,
Ariba
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
Thanks,
Ariba
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
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
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