Removing OBX segment(s)

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Removing OBX segment(s)

  • Creator
    Topic
  • #49911
    Gary Atkinson
    Participant

    Hi, I been given an interesting task.  Our lab system Sunquest currently is suppressing sending certain antibiotics, based on specimen type.  One of the receiving systems wants these suppressed antibiotics and another receiving system does not.  All of the Sunquest results (ORU^R01) come into the engine via one thread.  Sunquest sends OBR and OBX in groups.  The specimen type is in OBR:15 and antibotic in OBX:3.  So, if specimen type is “sputum”, then don’t send antibotic “amikacin”.  Is there a way to remove a OBX segment(s) in the translation?  How anyone tried something like this?

    Code:


    OBR|3|72206001|804100010H59463|MIC^METHOD MIC|||200803132058|||88629^NAME,NAME||||200803132117|SPUTUM^SPUTUM L SIDED THORACENTESIS|2481^NAME^NAME^K||||H59463||||MC^MB|F|RSCU&RESPIRATORY CULTURE^3^ECOL^ESCHERICHIA COLI|^^^^^S||72206001^804100010H59463
    OBX|1|ST|AMK^AMIKACIN|1|SUSCEPTIBLE|||S|||F|||200803161417|MC^MICRO|40803^NAME^NAME OBX|2|ST|AMC^AMOXICILLIN/CLAVULANIC ACID|1|SUSCEPTIBLE|||S|||F|||20|
    |0803161417|MC^MICRO|40803^NAME^NAME OBX|3|ST|AM^AMPICILLIN|1|RESISTANT||
    |||R|||F|||200803161417|MC^MICRO|40803^NAME^NAME OBX|4|ST|AZTR^AZTREONAM|
    ||1|SUSCEPTIBLE|||S|||F|||200803161417|MC^MICRO|40803^NAME^NAME

Viewing 9 reply threads
  • Author
    Replies
    • #64065
      Jim Kosloskey
      Participant

      Gary,

      If NOT using BULKCOPY – just don’t copy the fields in the desired segment or don’t PATHCOPY the segment and the segment won’t be built.

      If BULKCOPY is in the picture, then (I have never done this personally but supposedly it works) PATHCOPY @null to the segment (with proper repetition counter placement in address path).

      Since I rarely use BULKCOPY this is not a big issue for me.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com

    • #64066
      Gary Atkinson
      Participant

      Jim-

      Thanks for the reply.  I do want to send the OBX segment, just not the ones with certain specimen,antibotic groupings.  I’m probably making this more difficult than it is  😆

      Gary

    • #64067
      Jim Kosloskey
      Participant

      Gary,

      Are you using BULKCOPY?

      If not, are you using PATHCOPY?

      If not then as you iterate through the OBX check for the OBX(s) you do want. As long as that condition is true, COPY (or whatever appropriate Actions) to build that repeitition OBX. If the condition is false (means you do not want the OBX, nothing will occur and you will go on to the ext iteration – effectively omitting the unwanted OBX.

      Or you can use the inverse of the logic above checking for the OBX(s) you don’t want.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com

    • #64068
      Gary Atkinson
      Participant

      Sorry, using pathcopy on the OBX’s.  I think I’m following you.  I’ll try the IF statment inside the Iterate.

    • #64069
      Jim Kosloskey
      Participant

      Gary,

      No problem using PATHCOPY.

      Just do the IF logic and place the OBX PATHCOPY(s) appropriately and all should be well.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com

    • #64070
      Robert Milfajt
      Participant

      When you remove a particular OBX segment, is the receiving system of those messages going to require that the OBX.1 field is continuous.  In your example you receive, and Amikacin is in OBX|1.

      Does the receiving system want the first OBX to be OBX|1, or can is it OK for it to be OBX|2.  Furthermore, if Amikacin were in one of the “middle” OBXs, like OBX|3, is the receiving system OK with the break, OBX|1, OBX|2 and OBX|4.  If the system cares about the ordinality in OBX.1, then you need to add additional code in your iterate to keep track of the OBX count for the destination system and plug that number in to OBX.1.

      The following is an example of what I am talking about.  If you simply do not copy the Amikacin segment in your example, you will have a destination message that looks like:

      Code:

      OBR|3|72206001|804100010H59463|MIC^METHOD MIC|||200803132058|||88629^NAME,NAME||||200803132117|SPUTUM^SPUTUM L SIDED THORACENTESIS|2481^NAME^NAME^K||||H59463||||MC^MB|F|RSCU&RESPIRATORY CULTURE^3^ECOL^ESCHERICHIA COLI|^^^^^S||72206001^804100010H59463
      OBX|2|ST|AMC^AMOXICILLIN/CLAVULANIC ACID|1|SUSCEPTIBLE|||S|||F|||20||0803161417|MC^MICRO|40803^NAME^NAME
      OBX|3|ST|AM^AMPICILLIN|1|RESISTANT|||||R|||F|||200803161417|MC^MICRO|40803^NAME^NAME
      OBX|4|ST|AZTR^AZTREONAM|||1|SUSCEPTIBLE|||S|||F|||200803161417|MC^MICRO|40803^NAME^NAME

      If your receiving system cares about the numeric order in the OBX segments, you will need to write code to do the following:

      Code:

      OBR|3|72206001|804100010H59463|MIC^METHOD MIC|||200803132058|||88629^NAME,NAME||||200803132117|SPUTUM^SPUTUM L SIDED THORACENTESIS|2481^NAME^NAME^K||||H59463||||MC^MB|F|RSCU&RESPIRATORY CULTURE^3^ECOL^ESCHERICHIA COLI|^^^^^S||72206001^804100010H59463
      OBX|1|ST|AMC^AMOXICILLIN/CLAVULANIC ACID|1|SUSCEPTIBLE|||S|||F|||20||0803161417|MC^MICRO|40803^NAME^NAME
      OBX|2|ST|AM^AMPICILLIN|1|RESISTANT|||||R|||F|||200803161417|MC^MICRO|40803^NAME^NAME
      OBX|3|ST|AZTR^AZTREONAM|||1|SUSCEPTIBLE|||S|||F|||200803161417|MC^MICRO|40803^NAME^NAME

      I hope this was clear,

      Robert Milfajt
      Northwestern Medicine
      Chicago, IL

    • #64071
      Gary Atkinson
      Participant

      Thanks Robert- I didn’t think about that one.  I guess I could put some sort of counter for OBX:1.  This is going to be a tricky one for me to figure out  😕

    • #64072
      Jim Kosloskey
      Participant

      Gary,

      Check with the receving system – many do not care about the Set ID.

      If the receiving system does not care then I would not change it. For one thing it gives me an indication in the outbound message of what OBX segments have been omitted. If they are renumbered, I have to actually compare inbound to outbound.

      To renumber simply use a temp variable (call it something like @obx_setid).

      I would initialize it to zero at the very start of your Xlate (old programmer trait) with a COPY =0 to @obx_setid).

      Then within the ITERATE and in the IF logic that actually populates the Outbound OBX add a MATH ADD Action with the Source being: =1 @obx_setid and the Destination being: @obx_setid. Then COPY @obx_setid to OBX-1.

      If you have multiple OBR groups each of which will have their own OBX group, remember to zero out the counter (@obx_setid) in the OBR ITERATion.

      But like I say, if the receiving system does not care, I wouldn’t bother.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com

    • #64073
      Robert Milfajt
      Participant

      I agree with Jim 100%, if it ain’t broke…

      Robert Milfajt
      Northwestern Medicine
      Chicago, IL

    • #64074
      Frank Hartmann
      Participant

      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 mode

         set 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 counter

      if {$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
      }

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

Forum Statistics

Registered Users
4,968
Forums
28
Topics
9,109
Replies
33,637
Topic Tags
248