› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Filtering messages
Does anyone know how to filter specific messages (based on patient type) from a group of messages received on an inbound line and route those messages (the ones with this particular patient type) to a different receiving system?
Thanks,
Ariba
We do a fair bit of this kind of thing and our method may not be applicable to you!
We set the inbound thread routing to FRL and a ‘proc’ and use TCL code to return a route type and go from there.
In the example below (used in a ‘timing’ site and not production), we will be receiving multiple hospital ADT messages on a thread and wish to route them based on information (hospital code) in the MSH segment.
When we use this routing code in production, we ensure that the code returns a ‘bad’ route for any error and route this to a SMAT file, so we can produce a report.
proc tim_code_trx {aMsgId} {
#
# grab the first part of the message, containing the MSH
#
set myMsh [csubstr [msgget $aMsgId] 0 60]
set myFS [csubstr $myMsh 3 1]
#
# split the segment into the fields and return the third field
# should be PJ@
#
set myTrxId [lindex [split $myMsh $myFS] 2 ]
return “$myTrxId”
}
This is a Unit Test script for routing code and may make testing easier.
#!/usr/bin/ksh
# this line to escape the next line from the tcl interpreter
exec hcitcl “$0” “$@”
global HciConnName
set HciConnName gen_smat_ai_gen_rcv
proc msgget {aId {aAction NONE}} {
global gMsg
if {$aAction == “S”} {
set gMsg $aId
return
}
return $gMsg
}
set myMsg {MSH|^~&|HL7LAB||CLOVERLEAF|qdxi01p|200510131611||ORU^R01|4139137|D|2.1|||||^MPID|||A9994292||A^A||19850108|M|||A^^F|||||||||||^MPV1||O|INFD||||||||||||||||$myAcct||||||||||||||||||||||||||
|||||^MOBR|1||11|MSYPH^SYPHILUS^L||200510181408|200510181359|||||||200510181408||034020CW^M&L|||$myReq@OBR19|FTH^|112703C|200510131611||$myPerf@OBR24|F|||||||||||^MOBX|1|FT|Y29JSY^^L|| TEST RESULTS|||
|||F|||||^M}
foreach myAcct {FH@123456789012 F123 AA@123456789012 {} } {
foreach myReq {FH AA XX X {}} {
foreach myPerf {FH AA XX X {}} {
echo “Acct >$myAcct<" echo “Req >$myReq<" echo “Perf >$myPerf<" msgget “[subst -nobackslashes -nocommands $myMsg]” S echo “tReturn [ris_code_trx_id 1]” } } } exit
Since my inbound thread will receive all types of charges (lab, radiology, outreach, etc.), how would this work?
I need to route the charges to two different outbound threads. One outbound thread will get all of the charges (i.e. lab, radiology, respiratory, etc.), except outreach charges. The other outbound thread will get the outreach charges ONLY.
If I put this proc on the inbound thread, how will all the other charges go to the other outbound thread? Maybe I am not understanding this.
Also, the arguments you indicate in your response, should mine look exactly like this? Or should I replace these with some other values?
{PASSCOND pttype} {SEGNAME FT1} {FIELDNUM 18} {SUBFIELDNUM 0}
Thanks,
Ariba
If that’s true, then here’s how you can route your messages to the desired outbound thread:
In the GUI, go into thread configuration. Right click on your inbound thread, and select thread properties. Click on the route messages tab. Highlight the route to the OB thread that will get all but the outreach patient type charges, and click on properties, which will bring up a raw route details dialog window. (My routes are almost all “raw” routes…) For the “Procs:” field, hit the Edit button, click ADD, and select the kill_msg proc from the drop down menu. Type your arguments in the arguments window, using ~pttype in the PASSCOND argument. Remember that you have to use the actual code, so what you type will look something like this, if ORPT is your code for outreach patient type:
{PASSCOND ~ORPT} {SEGNAME FT1} {FIELDNUM 18} {SUBFIELDNUM 0}.
Repeat all of the above steps to route charge messages to the OB thread for outreach patient type, except don’t use the ~ in your PASSCOND argument. (And, remember that you’ll be adding the kill_msg proc to a different route – the one going to the appropriate OB thread).
Clear as mud? It’s really very simple – the kill_msg proc can be very versatile…
Thanks for your help!
Ariba
I am having an issue with this.
Here is what I have done…..
In Network Configurator, I have gone to the inbound thread, right-clicked, and selected Thread Properties. Clicked on Route Messages tab. Highlighted the OB thread that will get all BUT the outreach charges and clicked Properties, which is a xlate route details dialog window for me (I have to make some field changes for these messages, so, I used an xlate). For “Pre Procs:” field, I hit the Edit button, clicked Add, and selected hcitpsmsgkill proc from the drop down menu. I don’t have a msg_kill proc in this list. I figured the tpsmsgkill was the same thing. Is that a good assumption? I typed my arguments in the ARGS window (this is for the thread that will get all BUT outreach charges):
{PASSCOND ~LBC} {SEGNAME PV1} {FIELDNUM 18} {SUBFIELDNUM 0}.
I repeated the above steps for the ob thread that will receive only the outreach charges. This is what my ARGS look like for this:
{PASSCOND LBC} {SEGNAME PV1} {FIELDNUM 18} {SUBFIELDNUM 0}
When I try to resend some messages through the interface from SMAT, I don’t get any errors in the error database (I was before) and the messages are not going out.
Any idea what is going on here?
Thanks,
Ariba
The proc you want is kill_msg – and it should be there. Let me know if it’s not, and I’ll send it to you.
Feel free to email me directly…
Thanks,
Ariba