Hi All,
We are at the very end of a Microbiology Orders and Results interface project between Cerner and Meditech.
We had a recent encounter last week where Cerner created an ORU result message and the OBR Segment had no corresponding OBX. The message was sent back to Meditech and read in however the actual results did not post into the EMR.
After doing some research and speaking with Cerner, it was decided that the best approach for a solution would be to come from my end of things( Cloverleaf 6.2 – Windows )
After some further digging, I located some code out on this forum( thank you ) but it does not seem to work when I run it through the testing tool. Can anyone see what is wrong ? The code and what is specifically needed is to remove the OBR Segment entirely from the message where there is no corresponding OBX.
Below is the tcl code that I have so far. I am not sure why it does not work. Any ideas ??
proc tpsAddRemoveOBXMICTest { args } {
global HciConnName
if ![info exists HciConnName] { set HciConnName UNKNOWN }
set module “$HciConnName/[lindex [info level 1] 0]”
keylget args MODE mode
keylget args CONTEXT context
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
keylget args MSGID mh ;# Get message handle
set msg [msgget $mh] ;# Get message
# Get the field, sub-field, and repetition separators
set fldSep [string index $msg 3]
set subSep [string index $msg 4]
set repSep [string index $msg 5]
# Get a list of HL7 segments by splitting the message on CR
set segList [split $msg \r]
set newsegList {} ;# Buffer to hold the new outbound message
set LocList [lsearch -all -regexp $segList {^OBR}]
while {$LocList ne “”} {
set loc [lvarpop LocList]
set nxt [expr $loc +1]
if {![regexp — {^OBX} [lindex $segList $nxt]]} {
lvarpop segList $loc
set cnt 0
foreach num $LocList {
incr num -1
set LocList [lreplace $LocList $cnt $cnt $num]
incr cnt
}
}
}
msgset $mh [join $segList \r]
}
}
}
Thanks
Omar