i have a question about an error. The below tclproc has been running since last thursday. This morning i had one error, 'unable to convert date-time string "20100428 0035"'. The following messages seemed to have worked so i am not real sure why this one errored.
Here is the segment and field i am working with: Is there something in my code i need to change so this doesnt happen again? Or can someone explain why this errored. Thanks for any info.
OBR|1||201004280035-70^RI|ABS^CLIN ABSTRACT PDF^INPC||201004280035|
OBX|1|ED|ABS^CLIN ABSTRACT PDF^INPC||INPCDOC^application^^BASE64^JVBERi0xLjQKJ
######################################################################
# Name: tpsBDI_OBX
# Purpose: This tclproc is for the INPC Clinical Abstact. It fixes the
# OBX-5 issue.
#
# 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 messages
# or
# Errors message if OBR, ORC is missing
#
# Created: Kevin Crist, John Zalesak 05/27/2009
#
#
#########################################################################################
#########################################################################################
#########################################################################################
proc tpsBDI_OBX { args } {
#########################################################################################
# Get the Connection/Proc Name for Error/Debug Messages
#########################################################################################
global HciConnName
set myname "$HciConnName/[lindex [info level 1] 0]"
set nowis [clock format [clock scan now] -format "%D - %T"]
#########################################################################################
# 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 OBRpos -1 ;# Position of OBR Segment in msg
set OBRList
- ;# OBR Segment Fields in List Form
set OBXpos -1 ;# Position of OBX Segment in msg
set OBXList
- ;# OBX Segment Fields in List Form
set OBXPDF 5 ;# Field in the OBX that the PDF encoding is in
set OBRDateTime 6 ;# Field in the OBR that the date/time is in
set OBRTestCode 4 ;# Field in the OBR that the test code is in
#########################################################################################
# Switch based on what mode the engine was in when it called the procedure
#########################################################################################
keylget args MODE mode ;# The mode the engine called from
switch -exact -- $mode {
start { }
run {
set mh [keylget args MSGID] ;# Get message handle from args
set dispList
;# Initialize to good message set msg [msgget $mh] ;# Get a copy of the message set fldSep [string index $msg 3] ;# Field Seperator set subSep [string index $msg 4] ;# Sub-Field Seperator set repSep [string index $msg 5] ;# Repeating Field Seperatorset segList [split $msg r] ;# Split message into segList########################################################################################## Find Position of Segements - If missing -> Error out Message and Return#########################################################################################set OBRpos [lsearch -regexp $segList {^OBR}] set OBXpos [lsearch -regexp $segList {^OBX}] if {$OBXpos < 0} { msgmetaset $mh USERDATA "Required Segment OBX Missing!" echo n n n echo ":WARN - $OBXpos Segment Missing !" echo ":WARN - Sending Message to error db." echo ":WARN - Here Is: $myname" echo ":WARN - Now Is: $nowis" echo $msg echo n n n set dispList
return $dispList} ########################################################################################## Split out the OBR and get the OBR-7 date/time so that it can be reformatted#########################################################################################set OBRList [split [lindex $segList $OBRpos] $fldSep]#echo OBRList: $OBRList set datetime [lindex $OBRList $OBRDateTime] #The below regsub formats the date so that the following clock scan can be performed. regsub -- {(d{8})(d+)} $datetime {1 2} datetime set datetime [clock format [clock scan $datetime] -format "%m/%d/%Y %H:%M"]#echo datetime: $datetime # set newdatetime [string map {{ {}} $datetime]#echo newdatetime: $newdatetime ########################################################################################## Get the OBR-4 so that we can append that date and time to it.######################################################################################### set testcode [lindex [split [lindex $OBRList $OBRTestCode] $subSep] 0]#echo testcode: $testcode lappend newtestcode $testcode $datetime#echo newtestcode: $newtestcode set newtestcode [string map {{ {} } {}} $newtestcode]set OBRList [lreplace $OBRList 4 4 $newtestcode] ########################################################################################## Split out the OBX and get the OBX-5 and fill in the field with the .######################################################################################### set OBXList [split [lindex $segList $OBXpos] $fldSep] set pdfcode [lindex [split [lindex $OBXList $OBXPDF] $subSep] 4]########################################################################################## Replacing the OBR DXCode code in the OBR-19######################################################################################### set OBXList [lreplace $OBXList 5 5 $pdfcode]########################################################################################## Putting the OBR segment back together with the DXCode code in the OBR-19######################################################################################### lset segList $OBRpos [join $OBRList $fldSep] lset segList $OBXpos [join $OBXList $fldSep] msgset $mh [join $segList r] ########################################################################################## Rebuild msg and store at mh for engine#########################################################################################} time { } shutdown { }} ;# End Switchreturn $dispList} ;# End Proc