How to filter A01 message when the room or bed is missing

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf How to filter A01 message when the room or bed is missing

  • Creator
    Topic
  • #55488
    Amdy Diene
    Participant

    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

Viewing 7 reply threads
  • Author
    Replies
    • #85536
      Linus Betschart
      Participant

      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.  ðŸ™‚

    • #85537
      Amdy Diene
      Participant

      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.

    • #85538
      Kevin Crist
      Participant

      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 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
      }

    • #85539
      Amdy Diene
      Participant

      This is what I was looking for.

      Thanks

    • #85540
      David Barr
      Participant

      You could use my expression filter proc and call it with these arguments:

      Code:

      { EXPRESSION { (%PV1.3.2% ne ” && %PV1.3.3% ne ”) || [lsearch -exact { A01 A02 A12 A13 } %MSH.9.2%] < 0 } }

    • #85541
      Kevin Crist
      Participant

      can i get a copy by chance? That looks interesting.

      thanks.

    • #85542
      Amdy Diene
      Participant

      Dave, I got your EXPRESSION filter, thank you.

    • #85543
      David Barr
      Participant

      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.

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10