######################################################################
# Name: tps_fixexertime
# Purpose: to change the total exercise time from seconds to minutes and seconds
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
# no args.
#
#
proc tps_fixexertime { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
}
run {
keylget args MSGID mh
set msg [msgget $mh] ;# get message
set msgList [split $msg r]
set nlist $msgList
set mshseg [lindex $msgList 0]
set field_sep [cindex $mshseg 3]
set sub_sep [cindex $mshseg 4]
set rep_char [cindex $mshseg 5]
set segctr 0
foreach seg $msgList { ;# start loop through segments
set segtype [csubstr $seg 0 3]
incr segctr 1
if [cequal $segtype OBX] { ;# check for OBX seg
set obxfields [split $seg $field_sep]
set obx3 [lindex $obxfields 3]
if [cequal $obx3 STRESSMEASANDDIAG] { ;# check for stressmeasanddiag
set newctr $segctr
incr newctr -1
set obx5 [lindex $obxfields 5]
set fields [split $obx5 $rep_char]
set totalextime [lindex $fields 1]
set len [string length $totalextime]
set unitpos [expr $len – 4]
set pos [expr $unitpos – 1]
set units [string range $totalextime $unitpos $len]
if [cequal $units secs] {
set secs [string range $totalextime 21 $pos]
set minutes [expr $secs / 60]
set remainder [fmod $secs 60]
set seconds [string trim $remainder .0]
set newtotextim “Total Exercise Time: $minutes Minutes $seconds seconds”
set newfields [lreplace $fields 1 1 $newtotextim]
set newobx5 [join $newfields $rep_char]
set newobx [lreplace $obxfields 4 4 $newobx5]
set newobxseg [join $newobx $field_sep]
set newmsg [lreplace $nlist $newctr $newctr $newobxseg]
} ;# end if units = secs
} ;# end stressanddiag
} ;# end OBX seg
} ;# end for each
set new [join $newmsg r]
echo “new: ” $new
keylget args MSGID mh
lappend dispList “CONTINUE $mh”
msgset $mh [join $newmsg r]
}
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
}
here is the test file i am using in the testing tool in QDX 5.3.1
MSH|^~&|Stress Result|HL7 Result|quovadx Result|QDX|20070702183245||ORU^R01|20070702183245|P|2.4
PID|1|123456789|||PATIENT^TEST||19490728|M||C|^^^^^|||||||1111111111|
PV1|1||(213)^^^SITE0001^^^^213^||||^^^^^^^^^^^|^HOMBURG^NANCY^^^^^^^^^|^^^^^^^^^^^||||||||^^^^^^^^^^^|||||||||||||||||||||||||||||||||
OBR|1|123456789||^^^^Stress Test||20070702183245|200707033083637||||||^|||^GELLER^KENNETH^^^^^^^^481^||||26||20070702183245|||C||||||FU HTN FAM HX|^MuseAdmin^MuseAdmin^^^^^^^^20001^|^^^^^^^^^^^|^BARANY^JANE^^^^^^^^^^235^||^MuseAdmin^MuseAdmin^^^^^^^^^^20001^|||
DG1|1|||
DG1|2||
DG1|3||
NTE|1||
ZEX|1|^^^|^^^|^^^|
OBX|1|FT|STRESSMEASANDDIAG||Acquisition Time: 2001-07-23 08:36:37~Total Exercise Time: 630 secs~Test Indications: FU HTN FAM HX~Medications:~Protocol: BRUCE ~Max HR: 129 BPM 76% of Pred: 169 BPM~Max BP: 204/088 mmHG~Max Work Load: 12.5 METS~~NORMAL STRESS TEST BUT TO LESS THAN MAXIMAL PREDICTED HEART RATE SECONDARY TO~ ATENOLOL~NO SYMPTOMS AND NO ISCHEMIA WITH WELL PRESERVED EXERCISE CAPACITY~~Referred By: NANCY HOMBURG Overread By: MuseAdmin MuseAdmin||||||D|
I am getting very weird results, in the testing tool i seem to get the right values in the obx segment when viewing in the testiing tool using the echo cmd, however it will not allow me to get the right values out in the message. I do get some mixed results in the testing tool, they are listed below
Please Wait ……
Command Issued: hcitpstest -r run -a -f eof -c sms_ib_data -e “broadcaster ” c:/gehc-it/ccg/quovadx/qdx5.3/integrator/muse_prod/stress1.txt “tps_fixexertime”Command output:
new: MSH|^~&|Stress Result|HL7 Result|quovadx Result|QDX|20070702183245||ORU^R01|20070702183245|P|2.4PID|1|123456789|||PATIENT^TEST||19490728|M||C|^^^^^|||||||1111111111|PV1|1||(213)^^^SITE0001^^^^213^||||^^^^^^^^^^^|^HOMBURG^NANCY^^^^^^^^^|^^^^^^^^^^^||||||||^^^^^^^^^^^|||||||||||||||||||||||||||||||||OBR|1|123456789||^^^^Stress Test||20070702183245|200707033083637||||||^|||^GELLER^KENNETH^^^^^^^^481^||||26||20070702183245|||C||||||FU HTN FAM HX|^MuseAdmin^MuseAdmin^^^^^^^^20001^|^^^^^^^^^^^|^BARANY^JANE^^^^^^^^^^235^||^MuseAdmin^MuseAdmin^^^^^^^^^^20001^|||DG1|1|||DG1|2||DG1|3||NTE|1||ZEX|1|^^^|^^^|^^^|OBX|1|FT|STRESSMEASANDDIAG|Acquisition Time: 2001-07-23 08:36:37~Total Exercise Time: 10 Minutes 3 seconds~Test Indications: FU HTN FAM HX~Medications:~Protocol: BRUCE ~Max HR: 129 BPM 76% of Pred: 169 BPM~Max BP: 204/088 mmHG~Max Work Load: 12.5 METS~~NORMAL STRESS TEST BUT TO LESS THAN MAXIMAL PREDICTED HEART RATE SECONDARY TO~ ATENOLOL~NO SYMPTOMS AND NO ISCHEMIA WITH WELL PRESERVED EXERCISE CAPACITY~~Referred By: NANCY HOMBURG Overread By: MuseAdmin MuseAdmin|Acquisition Time: 2001-07-23 08:36:37~Total Exercise Time: 630 secs~Test Indications: FU HTN FAM HX~Medications:~Protocol: BRUCE ~Max HR: 129 BPM 76% of Pred: 169 BPM~Max BP: 204/088 mmHG~Max Work Load: 12.5 METS~~NORMAL STRESS TEST BUT TO LESS THAN MAXIMAL PREDICTED HEART RATE SECONDARY TO~ ATENOLOL~NO SYMPTOMS AND NO ISCHEMIA WITH WELL PRESERVED EXERCISE CAPACITY~~Referred By: NANCY HOMBURG Overread By: MuseAdmin MuseAdmin||||||D| can’t read “mode”: no such variable while executing”switch -exact — $mode { start { # Perform special init functions # N.B.: there may or may not be a MSGID key in args } run { # ‘run’ mo…” (procedure “broadcaster” line
and sometimes i get this by re-running the same process.. I am very confused on why this is not fucntioning properly.
Please Wait ……
Command Issued: hcitpstest -r run -a -f eof -c sms_ib_data -e “broadcaster ” c:/gehc-it/ccg/quovadx/qdx5.3/integrator/muse_prod/stress1.txt “tps_fixexertime”Command output:
can’t read “mode”: no such variable while executing”switch -exact — $mode { start { # Perform special init functions # N.B.: there may or may not be a MSGID key in args } run { # ‘run’ mo…” (procedure “broadcaster” line