looking through OBX

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf looking through OBX

  • Creator
    Topic
  • #54895
    Kevin Crist
    Participant

      I need to look through the OBX segments of a rad report and i need to put &GDT in every OBX.3 until i get to the OBX segment  that has IMPRESSION in the OBX.5 and then it needs to be &IMP from then on. How can i accomplish this? Has me stumped. I am using a standard 2.3 ORU variant.

      Basis: 1(0).1(0).1

      Variable: %g1

      Before

      OBX|1|FT|DIG_SCRN_COMBO||REASON:  Screening.

      OBX|2|FT|DIG_SCRN_COMBO|| ||||||F

      OBX|3|FT|DIG_SCRN_COMBO||COMPARISON:||||||F|||20151130081821||119

      OBX|4|FT|DIG_SCRN_COMBO||The present exam

      OBX|29|FT|DIG_SCRN_COMBO||IMPRESSION:|||

      After:

      OBX|1|FT|&GDT||REASON:  Screening.

      OBX|2|FT|&GDT|| ||||||F

      OBX|3|FT|&GDT||COMPARISON:||||||F|||20151130081821||119

      OBX|4|FT|&GDT||The present exam

      OBX|29|FT|&IMP||IMPRESSION:|||

      OBX|30|FT|&IMP||THERE IS NO

      Thanks for any help.

    Viewing 6 reply threads
    • Author
      Replies
      • #83333
        Charlie Bursell
        Participant

          set flag 0

          set fld3 {&GDT}

          foreach loc [lsearch -all $msgs {^OBX}]  {

            set obx [split [lindex $msgs $loc] $fldSep]

            If {!$flag} {

                  if {[regexp {IMPRESSION} [lindex $obx 5]] {

                        incr flag

                        set fld3  {&IMP}

                   }

            }

            set obx [lreplace $obx 3 3 $fld3]

            set msgs [lreplace $msgs $loc $loc [join $obx $fldSep]]

          }

          I assume you know how to do the rest

          I did not run so I may have fat fingered something

        • #83334
          Jim Kosloskey
          Participant

            Without Tcl:

            ITERATE over the OBX Group.

            Inside the ITERATE:

               Use IF to see if OBX-5 (current repetition) contains =IMPRESSION (assumes EVERY time OBX-5 contains IMPRESSION you want to do this)

               COPY IMP to OBX-3.[0].[0] <– subcomponent notation

            ELSE

               COPY GDT to OBX-3.[0].[0] <– subcomponent notation

            COPY other fields for OBX…

            If it needs to be the first 10 characters of OBX-5 = IMPRESSION, use some tcl to grab the first 10 characters and put in a temp variable then do your IF eq against the temp variable ( so some tcl here). We have a proc which picks out characters starting at a user specified position for a user specified length and that is what I would use if we needed the first 10 characters checked.

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

          • #83335
            Charlie Bursell
            Participant

              I thought it was without Tcl   😀  ðŸ˜€

            • #83336
              Kevin Crist
              Participant

                doing this in an xlate at the moment. IMPRESSION is only in one OBX segment which is usually in the middle of the report so every OBX.3 after that has to have &IMP from what i understand. this is for our Epic implementation.

              • #83337
                Robert Kersemakers
                Participant

                  I think you want to always start with GDT, until you find ‘IMPRESSION’ and then use IMP all the time. I would do something like this.

                  Code:

                  COPY =GDT -> @var
                  ITERATE over OBX
                     IF OBX-5 eq =IMPRESSION
                         COPY =IMP -> @var
                     COPY @var -> OBX-3.[0].[0]

                  Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                • #83338
                  Kevin Crist
                  Participant

                    Thanks Robert. I can make what you have work but i want everything after the IMPRESSION to be &IMP and everything before to be &GDT.

                    thanks.

                  • #83339
                    Keith McLeod
                    Participant

                      Robert’s code should work.  The IF statement changes the value of the variable once IMPRESSION is found.  Make sure the variable is set prior to the iterate so that it is not reset for every OBX.  And then it is only changed once inside the OBX to IMP in which it should stay for the duration of the iterate.

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