TCL PROC NEEDED TO REMOVE OBR WITH NO CORRESPONDING OBX

Homepage Clovertech Forums Cloverleaf TCL PROC NEEDED TO REMOVE OBR WITH NO CORRESPONDING OBX

  • Creator
    Topic
  • #113233
    Omar Ujageer
    Participant

    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

     

     

     

     

Viewing 4 reply threads
  • Author
    Replies
    • #113234
      Diana de Bruin
      Participant

      Why use a TCL proc?

      I’ve had a similar problem and used an xlate with an iterate on the OBR level and inside that iterate I check on the contents (or lack thereof) of the OBX segment and use that info to decide if I need to do a pathcopy of that specific OBR part of the message.

      Diana

      LUMC -Leiden University Medical Centre
      The Netherlands

    • #113237
      Jim Kosloskey
      Participant

      I agree this can easily be accomplished in an Xlate.

      Make sure the OB variant has the OBR as optional however.

      Also I just do a check for the first OBX inside my OBR Group Iterate. This does require Cerner populate a certain field with every OBX (typically the Set ID). So just check to see if the Set ID of the first OBX for the current OBR repetition is eq @null (or ne if that is your preference). If it is null then don’t build that OBR repetition.

      If you will have multiple OBR Groups, then you will need to use your own ITERATE Variable (something like %g99) for the OB Group level repetition since you could be eliminating some Group repetitions.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #113238
      Omar Ujageer
      Participant

      Ok, thanks Jim and Diana ! I have made my Outbound Variant OBR optional. Also, I checked and the Cerner messages all contain Set-ID. There are multiple OBR’s so will need to work on the iterate and the rest . Thanks again for you help.

    • #113261
      Jim Kosloskey
      Participant

      Let us know if you run into issues.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #113318
      Robert Kersemakers
      Participant

      If you are already using an Xlate, then the Xlate is definitely the way to go.

      But imho if no Xlate is used, then why not fix it with a proc. I looked at the code and the thing that caught my eye was the fact that it puts only OBR segments into LocList and then goes looking for an OBX segment. That won’t work.
      Try changing
      set LocList [lsearch -all -regexp $segList {^OBR}]
      into
      set LocList [lsearch -all -regexp $segList {^OBR|^OBX}]

       

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

Viewing 4 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10