Brandon Grudt

Forum Replies Created

Viewing 15 replies – 1 through 15 (of 73 total)
  • Author
    Replies
  • in reply to: which is better for database interfaces – tcl or java? #83650
    Brandon Grudt
    Participant

      I’d continue with tcl.  You can look into tclODBC if you don’t have the database solution from Cloverleaf.

      in reply to: Replace MSH:4 with PV1:5 need help to finish it #83587
      Brandon Grudt
      Participant

        It does not look like you are splitting by the subfield separator, so your pid33 variable is not a list.

        in reply to: Best way to pull a list of used ports #83514
        Brandon Grudt
        Participant

          Awesome, all.  I was able to cherry pick some things and fit them into the context of my current code.  I’ve got everything that I need.  A thousand thanks, as usual.

          in reply to: Looking forward to 2016 #83493
          Brandon Grudt
          Participant

            Cheers.  

            Here’s to 2016 being the year that all of our EMR’s actually figure things out.  I’m sure they will start playing nice with each other and they’ll be going out of their way to make interoperability as simple as it should be…

            Right?

            in reply to: Best practice for building/maintaining compendiums #83465
            Brandon Grudt
            Participant

              Here is the script I settled on.  I’ll post it here for posterity.  Any suggestions/critiques?

              Code:


              ######################################################################
              #     Name:     test_lab_251_compendium.tcl
              #
              #   Purpose:  Builds lab compendium for auditing purposes.
              #
              #   Author: Brandon Grudt
              #       Memorial Health
              #       brandon.grudt@memorialohio.com
              #
              #   File History:
              #
              #   1.0 12/21/2015   Brandon Grudt   Initial release
              ######################################################################
              proc test_lab_251_compendium { args } {
                 global HciConnName
                 set dispList {}
                 if ![info exists HciConnName] { set HciConnName UNKNOWN }
                     set module $HciConnName/normalize_hl7
                     keylget args MODE mode
                     keylget args CONTEXT context
                     switch -exact — $mode {
                         start { return “” }
                         run {
                             keylget args MSGID mh
                             set msg [msgget $mh]
                             if ![cequal $context sms_ib_data] {
                                    echo ${module}: Invalid Context. S/B sms_ib_data is $context
                                     echo Continue message – No action
                             }
              ######################################################################
              # SET UP PRELIM VARS
              ######################################################################
                         catch {
                             set sep [csubstr $msg 3 1]    
                             set sub [csubstr $msg 4 1]
                             set rep [csubstr $msg 5 1]        
                             set segments [split $msg r]
              ######################################################################
              # SET REQUIRED VARS AND OPEN SQL
              ######################################################################
                             set date [clock format [clock seconds] -format {%Y-%m-%d %T.000}]
                             set test_loinc [lindex [split [lindex [split [lsearch -inline -all -regexp $segments ^OBR] $sep] 4] $sub] 0]
                             set test_ldesc [lindex [split [lindex [split [lsearch -inline -all -regexp $segments ^OBR] $sep] 4] $sub] 1]
                             set test_code [lindex [split [lindex [split [lsearch -inline -all -regexp $segments ^OBR] $sep] 4] $sub] 3]
                             set test_desc [lindex [split [lindex [split [lsearch -inline -all -regexp $segments ^OBR] $sep] 4] $sub] 4]
                             set test_ty [lindex [split [lsearch -inline -all -regexp $segments ^OBR] $sep] 24]
                             package require tclodbc
                             database connect hits_test hits_test MYUSERNAME MYPASSWORD
              ######################################################################
              # IF THE LAB IS NOT A MICRO
              ######################################################################              
                             if { $test_ty != “MICRO” } {
                                 set test_type LAB
                                 set lab_vals [hits_test “SELECT result_cd FROM I13_lab251_comp WHERE order_cd = ‘$test_code'”]
              # SQL QUERY WAS RETURNING DOUBLE BRACKETS ON NULL VALS SO I HAD TO JOIN ONE SET IN ORDER TO MATCH THE HL7 LIST                  
                                 set lab_cnt 0
                                 foreach value $lab_vals {
                                     set lab_vals [lreplace $lab_vals $lab_cnt $lab_cnt [join $value]]
                                     incr lab_cnt
                                 }
                                 set hl7_vals “”
                                 set hl7_cnt 0
                                 foreach seg [lsearch -inline -all -regexp $segments ^OBX] {
                                     set hl7_vals [lappend hl7_vals [lindex [split [lindex [split $seg $sep] 3] $sub] 3]]
                                     incr hl7_cnt
                                 }
              # IF THE OBX RESULT CODES DO NOT MATCH THE SQL RESULT CODES – DELETE AND INSERT TEST
                                 package require struct::set
                                 set list_comp [struct::set equal $hl7_vals $lab_vals]                  
                                 if { $list_comp < 1 } {
                                     hits_test "DELETE FROM I13_lab251_comp WHERE order_cd = '$test_code'"
                                     foreach seg [lsearch -inline -all -regexp $segments ^OBX] {
                                         set result_loinc [lindex [split [lindex [split $seg $sep] 3] $sub] 0]
                                         set result_ldesc [lindex [split [lindex [split $seg $sep] 3] $sub] 1]
                                         set result_code [lindex [split [lindex [split $seg $sep] 3] $sub] 3]
                                         set result_desc [lindex [split [lindex [split $seg $sep] 3] $sub] 4]
                                         set result_norm [lindex [split $seg $sep] 7]
                                         hits_test "INSERT INTO I13_lab251_comp (post_dt, order_cd, order_desc, order_loinc, order_ldesc, result_cd, result_desc, result_loinc, result_ldesc, result_norm, order_type) VALUES ('$date', '$test_code', '$test_desc', '$test_loinc', '$test_ldesc', '$result_code', '$result_desc', '$result_loinc', '$result_ldesc', '$result_norm', '$test_type')"
                                     }
              # IF THE RESULT CODES MATCH INSERT A NEW DATETIME STAMP                      
                                 } else {
                                     foreach seg [lsearch -inline -all -regexp $segments ^OBX] {
                                         set result_code [lindex [split [lindex [split $seg $sep] 3] $sub] 3]
                                         hits_test "UPDATE I13_lab251_comp SET post_dt='$date' WHERE order_cd='$test_code' AND result_cd='$result_code'"                      
                                     }
                                 }
              ######################################################################
              # IF THE RESULT IS A MICRO
              ######################################################################                    
                             } else {
                                 set test_type MIC
                                 set hl7_cnt 1
                                 set test_nl "TEXTUAL RESULT"
                                 set mic_val [hits_test "SELECT 1 FROM I13_lab251_comp WHERE order_cd = '$test_code' AND order_desc = '$test_desc' AND order_loinc = '$test_loinc'"]
              # IF THE OBX RESULT CODES DO NOT MATCH THE SQL RESULT CODES – DELETE AND INSERT TEST                  
                                 if { $mic_val 1 } { set panel_ind “G” } else { set panel_ind “I” }
                             database connect paragon_test paragon_test MYUSERNAME MYPASSWORD
                             set chg [paragon_test “SELECT charge_code FROM TOM200_ORDER_CODE WHERE order_code_ext_id = ‘$test_code'”]
                             set chg_int [paragon_test “SELECT chg_cod_int_id FROM TOM200_ORDER_CODE WHERE order_code_ext_id = ‘$test_code'”]
                             set cpt [paragon_test “SELECT cpt4_int_id FROM TPB900_CHG_CODE_MST WHERE chg_cod_int_id =  ‘$chg_int'”]
                             set cpt  [string trim [join [join [paragon_test “SELECT cpt4_ext_id FROM TSM911_CPT4_REF WHERE cpt4_int_id = ‘$cpt'”]]]]
                             paragon_test disconnect
                             set main_val [hits_test “SELECT 1 FROM I11_lab_comp WHERE order_cd = ‘$test_code’ AND order_desc = ‘$test_desc’ AND order_loinc = ‘$test_loinc’ AND cpt_cd = ‘$cpt’ AND chg_cd = ‘$chg'”]
              # IF THE OBX RESULT CODES DO NOT MATCH THE SQL RESULT CODES – DELETE AND INSERT TEST                  
                             if { $main_val < 1 } {
                                 hits_test "DELETE FROM I11_lab_comp WHERE order_cd = '$test_code'"
                                 hits_test "INSERT INTO I11_lab_comp (post_dt, order_cd, order_desc, order_loinc, order_ldesc, panel_ind, cpt_cd, chg_cd) VALUES ('$date', '$test_code', '$test_desc', '$test_loinc', '$test_ldesc', '$panel_ind', '$cpt', '$chg')"
              # IF THE RESULT CODES MATCH INSERT A NEW DATETIME STAMP            
                             } else {
                                 hits_test "UPDATE I11_lab_comp SET post_dt='$date' WHERE order_cd='$test_code'"
                             }                
                             hits_test disconnect
                     }  
                     }
                     time {}        
                     shutdown {}      
                     default {}
                 }
                 return "{CONTINUE $mh}"
              }

              in reply to: Best practice for building/maintaining compendiums #83464
              Brandon Grudt
              Participant

                Terry Kellum wrote:

                Expiring old codes will be a problem.

                in reply to: Adding the Batch Seg to a VXU msg #83359
                Brandon Grudt
                Participant

                  So you want to insert a generic batch header and trailer, but you’re going to be sending these messages individually?

                  in reply to: Adding the Batch Seg to a VXU msg #83357
                  Brandon Grudt
                  Participant

                    I guess I can help by defining the things that I see which are immediately wrong.

                    When you set those two variables, the lindex format is way off.

                    in reply to: Adding the Batch Seg to a VXU msg #83356
                    Brandon Grudt
                    Participant

                      There are quite a few issues with that.  What exactly are you trying to do?

                      in reply to: 6.1 Email alerts Not working AIX. #83254
                      Brandon Grudt
                      Participant

                        Thanks for posting the solution.  I was hung up on the same thing.

                        Brandon Grudt
                        Participant

                          set count 0

                          set xlateInVals [split $xlateInVals ;]

                          foreach value $xlateInVals {

                          Brandon Grudt
                          Participant

                            Then you’d use this:

                            set editedvalue [tbllookup -side MY_SIDE MY_TABLENAME $value]

                            (You’d substitute MY_SIDE with either input or output)

                            Brandon Grudt
                            Participant

                              What are you doing to the list items once you split them by a semicolon?

                              Typically you would split the string like you had, and then perform a foreach.

                                set count 0

                              in reply to: making segment as null in tcl #82743
                              Brandon Grudt
                              Participant

                                If your intention is to do this in a tcl script, I’d use lvarpop.

                                in reply to: TCL Syntax error for SQLite query #82624
                                Brandon Grudt
                                Participant

                                  Wouldn’t he then have to prepare the SQL statement by assigning the variable to :variable?  I’m not familiar with SQLite, but I know that is the case with MySQL PDO queries.  Something like this?

                                  $stmt->bindParam(‘:MessageControlID’, ‘$messageControlId’, PDO::PARAM_STR);

                                Viewing 15 replies – 1 through 15 (of 73 total)