Need TcL Proc to kill message based upon TrxId

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Need TcL Proc to kill message based upon TrxId

  • Creator
    Topic
  • #47664
    Mary McGraw
    Participant

      Dear TcL Coders,

      We recently upgraded our Star HBOC System to version 9.x.  I am now receiving ADT;A16 messages in HBOCHI 2.2b format.  None of my downstream feeds want the A16 so I need a TcL Proc that will effectively ‘kill’ ALL ADT;A16 messages.  Does anyone have one for this TcL library?

      Thanks in advance.

      Mary McGraw

      Munroe Regional Medical Center

      Ocala, Florida

    Viewing 4 reply threads
    • Author
      Replies
      • #56384
        Bill Bertera
        Participant

          You could just route them to a thread that sends them to /dev/null. That way you’ll have the possibilty for engine statistics and smat if you ever need them.

        • #56385
          Jim Kosloskey
          Participant

            Or, route them back to the ib thread and use hcitpsmsgkill to kill them at the pre route.

            That way you don’t need an additional thread.

            Jim Kosloskey

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

          • #56386

            Here is one that we use here at Mt. Sinai.

            Name:         tpsKillA28

            # Purpose:      Kill A28 before gets to threads

            #               added 7/2/03 by gerri jackson along w/other adt a28 suppression

            # UPoC type:    tps

            # Args:         tps keyedlist containing the following keys:

            #               MODE    run mode (“start”, “run” or “time”)

            #               MSGID   message handle

            #               ARGS    user-supplied arguments:

            #                      

            #

            # Returns: tps disposition list:

            #          

            #

            proc tpsKillA28 { args } {

               keylget args MODE mode                      ;# Fetch mode

               set dispList {}                             ;# Nothing to return

               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 inmsg [msgget $mh]

                                           #Check Event

                                           set msgSegments [split $inmsg r]

                                           set mshSeg [lindex $msgSegments 0]

                                           set event [getHL7Field $mshSeg 8] ;# event is th

            e 9th field

                                           if {[cequal $event “ADT^A28”]} {

                           lappend dispList “KILL $mh”

                                           

                                            } else {

                                           lappend dispList “CONTINUE $mh”

                                           } ;# end of if-else

                   }

                   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 tpsKillMsg”

                   }

               }

               return $dispList

            }

            (END)

          • #56387
            Brian Goad
            Participant

              Here is what we use at UT Medical Center.

              The script uses a table to review the event and make a determination. This way if you ever need to add another event just add it to the table and be done with it, no code changes required.

              Brian

              ## Purpose:     kill all messages other than those specfied in the arg list

              ##

              ## UPoC type:   tps

              ## Args:        tps keyedlist containing the following keys:

              ##              MODE    run mode (“start”, “run” or “test”)

              ##              MSGID   message handle

              ##              ARGS    user-supplied arguments:

              ##              DEBUG: determines weather we recieve all of the echo commands.

              ##                      Use this syntax for new echo statemtents: if {[debug == 1]} {

                                                                                    #echo “DEBUG($myprocName) -MESSAGE “}

              ##      

              ##

              ##

              ##

              ##

              ## Returns: tps disposition list:

              ##      

              ##        

              ##Written By: Brian Goad          

              ##Date: 4 August 2003

              ##

              proc event_type_filter { args } {

                 keylget args MODE mode                      ;# Fetch mode

                 #global HciConnName

                 global env HciConnName

                 

                 switch -exact — $mode {

                     start {

                         # Perform special init functions

                         # N.B.: there may or may not be a MSGID key in args

                         #

                         

                         #echo info procs

                     }

                     run {

                        # ‘run’ mode always has a MSGID; fetch and process it

                         keylget args MSGID mh

                       keylget args ARGS.DEBUG debug

                      #process variables

                      #get the proc name from the info array!!!

                      set myprocName [lindex [info level 0] 0]

                     

                      #The following command returns the process name!!!!!

                      #set myprocessName [file tail [pwd]]

                     

                     

                     

                     #set myprocName event_type.tcl

               

                       # get contents of message

                       set msgtext [msgget $mh]

                       # get field delimiter

                       set field_delim [cindex $msgtext 3]

                       set field_sub_delim [cindex $msgtext 4]

                       #get MSH segment and pull out MSH:8.1 (A01, A02, A03, ….)

                       set segments [split $msgtext “r”]

                        set msh [lindex $segments 0]

                       set msh_fields [split $msh $field_delim]

                       set msh_8 [lindex $msh_fields 8]

                       set qid [lindex $msh_fields 9]

                       set msh_field_8 [split $msh_8 $field_sub_delim];

                       set msh_8_1 [lindex $msh_field_8 1]

                       if {$debug == 1} {

                             echo “DEBUG DATA****************************************************”

                             echo “DEBUG($myprocName) – Complete Field: $msh_field_8”

                             echo “DEBUG($myprocName) – SubField: $msh_8_1”

                     }      

                      #echo “msh_field_8 $msh_field_8”

                             #echo “msh_8_1: $msh_8_1”

                       set table_name “events_$HciConnName”

                     # compare MSH(8.1) with each arg list element to determine if we need to forward

                     #echo “table_name: $table_name”

                         set filter_result [tbllookup $table_name $msh_8_1]

                     #echo “filter_result: $filter_result”

                            if {[cequal $filter_result “KILL”] || [cequal $filter_result “”] } {

                             if {$debug == 1} {

                                     echo “DEBUG($myprocName) – Message: $msh”; # Debugging Info

                                     echo “DEBUG($myprocName) – Lookup Table Name: $table_name”; # Debugging Info

                                     echo “DEBUG($myprocName) – Table Result: $filter_result”; # Debugging Info

                                     echo “DEBUG DATA****************************************************”

                             }

                             echo “$myprocName: $msh_8_1 with QID: $qid has been filtered for $HciConnName”

                             return “{KILL $mh}”            

                         } else {

                             #echo “Continue”

                             #echo “MSH_8 Doesn’t meet Kill Criteria: Sending $msh”

                             if {$debug == 1} {

                                     echo “DEBUG($myprocName) – $msh_8_1 with QID: $qid was not filtered for $HciConnName”

                                     echo “DEBUG($myprocName) – Message: $msh”

                                     echo “DEBUG($myprocName) – Lookup Table Name: $table_name”; # Debugging Info

                                     echo “DEBUG($myprocName) – Table Result: $filter_result”; # Debugging Info

                                     echo “DEBUG DATA****************************************************”

                             }

                             

                             return  “{CONTINUE $mh}”

                        }

                     }

                     shutdown {

                         # Doing some clean-up work

                         set datetime [clock format [clock seconds] -format “%d/%m/%Y %H:%M:%S”]

                         echo “Shutdown event_type_filter.tcl at $datetime”

                     }

                     time {

                         # Timer-based processing

                         # N.B.: there may or may not be a MSGID key in args

                     }

                     default {

                         error “Unknown mode ‘$mode’ in event_type_filter.tcl”

                     }

                 }

              }

            • #56388
              Mary McGraw
              Participant

                Just want to thank all of you for your expertise.

                I will be reviewing these options for the best ‘practice’ scenario in our ‘campus’.

                Mary McGraw

                Munroe Regional Medical Center

                Ocala, Fl

                memc@mrhs.org

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