› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › How to filter A01 message when the room or bed is missing
Thank you
if you are doing it with an xlate you can just do a bulk copy, then an IF statement, and within the IF statement (missing bed) you do a suppress action. thats it. 🙂
Thank you Linus, but I was looking for an sample of a script that does that. I am new to using Cloverleaf again after several years since version 3.7.
Hi Andy,
Not sure of your level of tcl but here is one that you should just have to modify a little to hopefully meet your needs or get started at least.
######################################################################
# Name: tpsKillA31WithPV1Empty
#
# Purpose: Kills all A31’s going to CareManager that have no information
# in the PV1 segment..
#
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (”start”, “run” or “time”)
# MSGID message handle
#
# Returns: tps disposition list:
#
# KILL when ADT = A31 and patient has no PV1 information
# CONTINUE all others
#
proc tpsKillA31WithPV1Empty { args } {
keylget args MODE mode ;# Fetch mode
global HciConnName
set procName “tpsKillA31WithPV1Empty”
set dispList {} ;# Nothing to return
set foundA31 {}
set assignedPatientLocation {}
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set msgtext [msgget $mh]
set fieldsep [crange $msgtext 3 3]
set subfieldsep [crange $msgtext 4 4]
set segments [split $msgtext “r”]
foreach seg $segments {
if {[cequal [crange $seg 0 2] “MSH”]} {
# this segment (seg) is MSH
# get the field data
set data [split $seg $fieldsep]
set field [lindex $data 8]
set data [split $field $subfieldsep]
set triggerType [lindex $data 0]
set triggerEvent [lindex $data 1]
# Check for an ADT and A31 trigger Event.
if {[cequal $triggerType “ADT”] && [cequal $triggerEvent “A31″]} then {
set foundA31 “YES”
#echo foundA31: $foundA31
}
} elseif {[cequal [crange $seg 0 2] “PID”]} {
# this segment (seg) is PID
set data [split $seg $fieldsep]
set patientAccount [lindex $data 18]
set patientName [lindex $data 5]
} elseif {[cequal [crange $seg 0 2] “PV1″]} {
# this segment (seg) is PV1
set data [split $seg $fieldsep]
# set patientType [lindex $data 2]
set assignedPatientLocation [lindex $data 2]
# Check for a Assigned Patient Location.
if {[cequal $assignedPatientLocation “”]} then {
set assignedPatientLocation “NO”
}
}
}
#
# If the ADT trigger event is an A31 and the assigned patient location is not loaded then
# kill the message, otherwise continue it.
#
if {[cequal $foundA31 “YES”] && [cequal $assignedPatientLocation “NO”]} {
# puts $msgtext
puts “$HciConnName\$procName – KILLING A31 for patient: $patientName – $patientAccount”
echo
lappend dispList “KILL $mh”
# } else {
# puts $msgtext
# puts “$HciConnName\$procName – CONTINUING ADT for Patient: $patientName – $patientAccount”
# echo
lappend dispList “CONTINUE $mh”
}
return $dispList
}
time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
default {
error “Unknown mode ‘$mode’ in tpsKillA31WithPV1Empty”
}
}
return $dispList
}
This is what I was looking for.
Thanks
can i get a copy by chance? That looks interesting.
thanks.
Dave, I got your EXPRESSION filter, thank you.
See this thread for more information:
https://usspvlclovertch2.infor.com/viewtopic.php?t=6666
This also requires that you install the HL7 parser from this thread:
https://usspvlclovertch2.infor.com/viewtopic.php?t=4886
I normally would call this on the route from your inbound thread to your outbound thread.