Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › How to filter A01 message when the room or bed is missing
- This topic has 8 replies, 4 voices, and was last updated 7 years ago by David Barr.
-
CreatorTopic
-
September 7, 2017 at 2:47 pm #55488Amdy DieneParticipant
Hi all, I need a script to filter messages A01, A02, A12, A13, when the room or bed is missing from the message. Thank you
-
CreatorTopic
-
AuthorReplies
-
-
September 8, 2017 at 11:25 am #85536Linus BetschartParticipant
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. 🙂
-
September 8, 2017 at 11:51 am #85537Amdy DieneParticipant
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.
-
September 8, 2017 at 2:00 pm #85538Kevin CristParticipant
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.
Code:######################################################################
# 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 mhset 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
} -
September 8, 2017 at 2:26 pm #85539Amdy DieneParticipant
This is what I was looking for.
Thanks
-
September 11, 2017 at 3:22 pm #85540David BarrParticipant
-
September 11, 2017 at 4:09 pm #85541Kevin CristParticipant
can i get a copy by chance? That looks interesting.
thanks.
-
September 11, 2017 at 5:38 pm #85542Amdy DieneParticipant
Dave, I got your EXPRESSION filter, thank you.
-
September 11, 2017 at 5:49 pm #85543David BarrParticipant
See this thread for more information:
http://clovertech.infor.com/viewtopic.php?t=6666
This also requires that you install the HL7 parser from this thread:
http://clovertech.infor.com/viewtopic.php?t=4886
I normally would call this on the route from your inbound thread to your outbound thread.
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.