Weird looking message

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Weird looking message

  • Creator
    Topic
  • #51364
    Kevin Crist
    Participant

    I am working on a tclproc and somehow when i run the testing tool i get a very weird looking message. Can someone point me in the right direction, this one is new to me. Thanks.

    value = 2005

    CONTINUE: ‘MSH|^~&|REG|GSH||GSH|20091118083304||ADT^A01|411773|D|2.3

    EVN|A01|20091118083304|||JKC^CRIST^KEVIN|20091118083304

    PID|||002001|21783|LIGHT^COORS||19900404|M||WHIT|444

    ROCKY

    MTN

    DRIVE^^BICKNELL^IN^47512|KNOX||||D||9000001552|303-21-4521

    PD1||||2005^YANG^RONG^^^MD||||||||N

    PV1||I|3E^324^2|9|||0839^BRIDGES^JANE^M^^MD||1539^BEAR^JOHNNY^^^MD|MED||||9|||0686^CARANDANG^REYNALDO^^^MD|MED|2242|600|||||||||N||||||||||||A|||20091118083140

    PV2||S|THE

    MOST

    AWESOME

    BEER

    EVER|||||||||||||||||||||A||20091112

    GT1|1||LIGHT^COORS||444

    ROCKY

    MTN

    DRIVE^^BICKNELL^IN^47512|||19900404|M||P|303-21-4521|||1|||||||||||||||D

    IN1|1||803|SAGAMORE

    HEALTH

    NETWORK|PO

    BOX

    6051^^INDIANAPOLIS^IN^46206|||||||||||LIGHT^COORS|18|19900404|444

    ROCKY

    MTN

    DRIVE^^BICKNELL^IN^47512||||||||||||||||||||||||M

    IN2||303-21-4521||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||18

    IN1|2||100|SELF

    PAY||||||||||||LIGHT^COORS|18|19900404|||||||||||||||||||||||||M

    IN2||303-21-4521||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||18

    ZAD|NO

    Below is my proc so far…

    #########################################################################################

    #########################################################################################

    #########################################################################################

    ######################################################################

    # Name: tpsKill_EHR_AllsDr

    # Purpose: This tps tclproc will check the Alls_EHR_Dr.tbl for dr codes. If the code is

    # in the table the pass the message on to the EHR application or KILL the message

    # PD1-4: Primary Care

    # PV1-7: Attending

    # PV1-8: Reffering

    # PV1-9: Consulting

    # PV1-17: Admitting

    # ORC-12: Ordering

    # OBR-16: Ordering

    #

    # 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:

    #          Continues the modified messages

    # OR

    # Continues un-modified message if the segment is missing

    #

    # Created: Kevin Crist 11/23/2009

    #

    #

    #########################################################################################

    #########################################################################################

    #########################################################################################

    proc tpsKill_EHR_AllsDr { args } {

     

    #########################################################################################

    # Initialize Variables Used

    #########################################################################################

    set dispList { }  ;# Disposition List Returned to Engine

    set fldSep “” ;# Field Seperator – get from MSH

    set subSep “” ;# SubField Seperator – get from MSH

    set repSep “” ;# Repeating Field Seperator – get from MSH

    set segList

  • ;# Message Segments in List Form

    set fldList

  • ;# Fields of a segment in List Form

    set repList

  • ;# The Repitions of the Field in List Form

    set subfldList

  • ;# Sub-Fields of a Field in List Form

    set PD1pos -1 ;# Position of PD1 Segment in msg

    set PV1pos -1 ;# Position of PV1 Segment in msg

    set ORCpos -1 ;# Position of ORC Segment in msg

    set OBRpos -1 ;# Position of OBR Segment in msg

    set PrimaryPos 4 ;# Position of Primary Dr

    set AttendPos 7 ;# Position of Attending Dr

    set RefferPos 8 ;# Position of Reffering Dr

    set ConsultPos 9 ;# Position of Consulting Dr

    set AdmitPos 17 ;# Posiiton of Admitting Dr

    set ORCOrderPos 12 ;# Position of Ordering Dr in ORC seg

    set OBROrderPos 16 ;# Position of Ordering Dr in OBR seg

    set PosList

  • ;# List of Position of Segments in msg  

     

     set table “Alls_EHR_Dr” ;# Table with the Dr. Number in it

     

    #########################################################################################

    # Switch based on what mode the engine was in when it called the procedure

    #########################################################################################  

     

     

       keylget args MODE mode              

     

    #   set dispList {} ;# Nothing to return

       switch -exact — $mode {

           start { }

               

           run {

     

               set mh [keylget args MSGID] ;# Get message handle from args

               set msg [msgget $mh] ;# Get a copy of the message

               

               set fldSep [string index $msg 3] ;# Field Seperator

          set subSep [string index $msg 4] ;# SubField Seperator

          set repSep [string index $msg 5] ;# Repeating Field Seperator

         

          set segList [split $msgr] ;# Split message into segList

         

          set disp “KILL” ;# Default disposition to KILL

         

    #########################################################################################

    # Find Position of Segements that contain Dr ID Numbers

    #########################################################################################

    lappend PosList [lsearch -regexp $segList {^PD1}]

    lappend PosList [lsearch -regexp $segList {^PV1}]

    lappend PosList [lsearch -regexp $segList {^ORC}]

    lappend PosList [lsearch -regexp $segList {^OBR}]

         

    #########################################################################################

    # Process Each Segement that might contain a Dr ID Number

    #########################################################################################      

         

          foreach segPos $PosList { ;# For each Seg in List

          if { $segPos > 0 } { ;# If the segment was found

          ;# Split Seg into List of Fields

          set fldList [split [lindex $segList $segPos] $fldSep]

         

    #########################################################################################

    # For each of the possible Dr Fields do the same thing

    # If the field exist

    # 1) Every Dr Field can have repitions

    # Split the field into a list of each repition

    # 2) Call the subroutine that checks the Dr ID number, in each repition,

    #

    #

    #########################################################################################      

     

      switch -exact [lindex $fldList 0] {

      PD1 {

    if { [llength $fldList] >= [expr $PrimaryPos + 1] } {

    set repList [split [lindex $fldList $PrimaryPos] $repSep]

    foreach rep $repList {

    set val_1st [split $rep $subSep]

    set value [lindex $val_1st 0]

    echo “value = $value”

    set PrimaryPosVal [tbllookup $table $value]

    if { $PrimaryPosVal eq “CONTINUE” } {

      set disp “CONTINUE”

    }

    }

    }

    }

     

     

     

     

      }

     

      }

     

    }

      msgset $mh [join $segList r]

     

      lappend dispList “$disp $mh”

     

      }

     

           time {

               # Timer-based processing

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

           }

           

           shutdown {

       # Doing some clean-up work

    }

       }

     

       return $dispList

    }

Viewing 1 reply thread
  • Author
    Replies
    • #69893
      Tom Rioux
      Participant

      Kevin,

      I’m not sure if it will make a difference, but the only thing I see is this:

      set segList [split $msgr] ;# Split message into segList

      It doesn’t appear you have a space between $msg and “r”.   Try putting a space between there and see if it makes a difference.   Maybe its just because it is getting close to quitting time but I don’t see right off hand anything else that may be causing it.

      Hope this helps…

      Tom Rioux

    • #69894
      Kevin Crist
      Participant

      That was it and i agree, too late on a monday too see it straight.

      Thank you very much, looks good now.

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

Forums

Forum Statistics

Registered Users
5,042
Forums
28
Topics
9,200
Replies
34,023
Topic Tags
267