how discard OBR when no OBX after

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf how discard OBR when no OBX after

  • Creator
    Topic
  • #55222
    Mahmoud Ihaddadene
    Participant

      Good day,

      We are receiving lab results OUL^R21 (2.4) see example below and send them to another system ORU^R01 (2.3). Some OBR doesn

    Viewing 2 reply threads
    • Author
      Replies
      • #84617
        Jim Kosloskey
        Participant

          Moe,

          If you don’t want OBX segments on the outbound then just don’t build them.

          Unless you are using BULKCOPY – then they have already been built and you need to Null them out by ITERATING over the group appropriately and PATHCOPY @null to the appropriate Group Level.

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

        • #84618
          Charlie Bursell
          Participant

            Jim:

            Senior moment  ðŸ˜€

            I think he wants to ignore OBR segments without following OBX.

            Two ways, Tcl or Xlate

            In Xlate just make the OBR optional and do no copy it if no following OBX.

            In Tcl, something like  ( Gets a bit convoluted to keep track of locations)

            Assumes HL7 has been split already

            # Location of all OBR segments

            set locList [lsearch -all -regexp $segList {^OBR}]

            while {$locList ne “”} {

               set loc [lvarpop locList]   ;# Get OBR location

               set nxt [expr $loc +1]      ;# Location of following segment

               #echo loc [lindex $segList $loc]

               #echo nxt [lindex $segList $nxt]

               # If next segment not OBX

               if {![regexp — {^OBX} [lindex $segList $nxt]]} {

                   lvarpop segList $loc    ;# Remove OBR

                   # Decrement each following OBR location

                   set cnt 0

                   foreach num $locList {

                       incr num -1

                       set locList [lreplace $locList $cnt $cnt $num]

                       incr cnt

                   }

               }

            }

            msgset $mh [join $segList r]

            As I said, a bit convoluted.  Maybe Xlate best option

          • #84619
            Jim Kosloskey
            Participant

              Well that makes more sense.

              Xlate already in place it appears.

              So while Iterating on the OBR Group first check an OBX field (of the first OBX Group repetition) which is always there if the OBX is present (maybe the Set ID?).

              If that is eq @null, then just don’t build the OBR – and as Charlie said make sure the OBR group is optional on the outbound variant.

              If, on the other hand you are using BULKCOPY, then you will need to ITERATE through the OBR group and if the same condition is true, PATHCOPY @null to the OBX group as well as the OBR to remove what has already been built. Luckily the Xlate ‘shrinks’ what is left to cover up any ‘holes’.

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

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.