Forum Replies Created
-
AuthorReplies
-
Hi folks, I know this thread is a bit old but I just stumbled upon it. I have had to make similar accommodations for our Sunquest system regarding OBX results that were to be suppressed while leaving others intact so I wrote a tps proc at the time to remove any HL7 segment that contained a specified value in a specified field. In my case I was looking for SUPPRESSED in OBX/13 but you can use it for any segment, field, subfield and value you specify in the parameters. Call it using the following parameters:
SEG = The segment type you are wanting to remove
FLD = The field you are examining
CMP = Optional parameter in case you are looking for a subfield
VAL = The value you are looking for. If found, the segment will be removed from the message. Use BLANK as a parameter to check for empty fields.
example: {SEG OBX} {FLD 13} {VAL SUPPRESSED}
Note: OBX IDs are not renumbered so if your destination system needs that to happen you could add that to this code too.
Thanks to Charlie Bursell whose tpsHL7KillSegment proc I used as a base to start my proc from.
Code:proc tpsHL7KillSegmentByField { args } {
keylget args MODE mode ;# Fetch modeset dispList {} ;# Nothing to return
set SEG [keylget args ARGS.SEG]
if {[catch {set FLD [keylget args ARGS.FLD]} cerr]} {
set FLD “”
}if {[catch {set CMP [keylget args ARGS.CMP]} cerr]} {
set CMP “”
}if {[catch {set VAL [keylget args ARGS.VAL]} cerr]} {
set VAL “”
}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 msg [msgget $mh] ;# Get message data
set sep [csubstr $msg 3 1] ;# Get HL7 field separator
set cmpsep [csubstr $msg 4 1] ;# Get HL7 component separator
set segments [split $msg r] ;# Split by segments
set ctr 0 ;# Initialize segment counterif {$FLD != “”} {
foreach segment $segments {
#echo $segment
if {[cequal $segment “”]} { continue } ;# Check just in case
set segtype [csubstr $segment 0 3] ;# Get segment name
if { [cequal $segtype $SEG] } { ;# Check for desired segment
set seglist [split $segment $sep] ;# If found split into a list
set fld_value [lindex $seglist $FLD] ;# Retrieve the desired field
#echo “Found field with value of $fld_value”if {$CMP != “”} {
set fieldlist [split $fld_value $cmpsep]
set fld_value [lindex $fieldlist $CMP]
}if {$VAL == “BLANK” } {
set VAL {}
}if { [cequal $VAL $fld_value] } {
lvarpop segments $ctr ; # Kill the segment
incr ctr -1 ;# Decrement the counter since we popped a segment
}
}incr ctr
#echo “Counter incremented to $ctr”
}
}msgset $mh [join $segments r]
lappend dispList “CONTINUE $mh”
}time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}shutdown {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}default {
error “Unknown mode ‘$mode’ in tpsHL7KillSegmentByField”
}
}return $dispList
}Amit, We ran into a similar situation a couple months ago. It turned out that our database was the culprit as it was using all of our swap space because we weren’t correctly shrinking the database back down and recovering the space during our monthly maintenance. Once we got back to recovering that memory from the database it hasn’t happened again.
-
AuthorReplies