~ to ^

  • Creator
    Topic
  • #52735
    Mark Perschbacher
    Participant

      I have a new xlate I’m working on where ICD9 codes are coming into Cloverleaf separated by a ~.  The vendor on the receiving end wants me to parse them into a DG1 segment in the ORU so I’m sending them out of our pathology system into an unused field in the OBR, field 20, and them trying to convert the ~ to a ^ so I can grab as many codes as they sent.  I’ve set this field to be repeating in the variant, and inserted various tcl snipets into the COPY command, but all the xlate grabs is the first code.

      set var $xlateInVals

      regsub -all {~} $var “^” var1

      set xlateOutVals [join $var1 “^”]

      Any suggestions on how to get it to recognize the other ones?

    Viewing 1 reply thread
    • Author
      Replies
      • #75322
        Mark Perschbacher
        Participant

          With Jim K’s help, I was able to get this to work.  I set up a field Interate, and on the source of the CONCAT action, I listed

          1(0).1(0).0(0).OBR(0).#20(%f1).[0]

          ~1(0).0(0).0(0).DG1(0).#3(0).[0]

          with a ^ Separator.  In the Dest.  I put

          1(0).0(0).0(0).DG1(0).#3(0).[0]

          What I get in DG1-3 is a reverse of OBR-20, but it should work.

        • #75323
          Josh Deere
          Participant

            I do something similar on one of my procs.  We have repeating ICD9 codes in an OBR-31 – I split that field by the repetition char into a list (obr31_list) then loop through each element in that list, creating a DG1 segment.

            This is fairly old, so naturally I instantly spotted a few things I could optimize, but this should work for you (there’s some other cruft I do in the loop that I removed due to being specific to this interface):

            Code:


            set dg1_list {}

             for {set i 1} {$i < [llength $obr31_list]} {incr i} {            
               set tseg [regsub {^I9} [lindex $obr31_list $i] ""]
                     
               # break out of this loop if there is no field for seg
               if {[string length $tseg] == 1} { break }

               lappend dg1_list "DG1|[expr $i + 1]|I9|$tseg|||A"
             }

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