Editing a Free Text Field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Editing a Free Text Field

  • Creator
    Topic
  • #54586
    Jared Miller
    Participant

      Hello Clovertechers,

      I am looking for a little help here in editing a free text field. Below is a sample OBR segment with OBR-13 (in red) being field I’m working with. What I am trying to do is remove everything prior to the semi-colon and pass everything after the semi colon on to the receiving system. So I’m trying to turn “Jump up and down ; Cysto-Grafin, 25 ml” into “Cysto-Grafin, 25 ml”

      OBR|1|806963201^HNAM_ORDERID||7000010^CT Abdomen w Cont 74160|CT||20150220140122|20150220140131|||||Jump up and down ; Cysto-Grafin, 25 ml||&Rad Type|RADDOC^Raddoc^Test^A^^Test Radiologist||||CT15000013||20150220140137||CT|||1^^0^20150220135700^^N^Jump up and down||||

      I am using an Xlate for this interface and have tried a few things myself from researching other threads but can’t quite get the result I’m needing.

      Thanks for any assistance you can provide!

    Viewing 3 reply threads
    • Author
      Replies
      • #82105
        Kevin Crist
        Participant

          can you split the field on the ;

          something like below

          lassign $xlateInVals  obr_13

          set field [lindex [split $obr_13 “;”] 1]

          set xlateOutVals $field

          warning: i am no tcl expert and going off a similar example that we have.

        • #82106
          Charlie Bursell
          Participant

            Please don’t do “set xlateOutVals $field

            ”  Since there are spaces in the data you will get undesired results.  Instead use:  “set xlateOutVals

              You may also be able to do something like:

              # Assume you pass OBR.13

              set inp [lindex $xlateInVals 0]

              set outp “”

              regexp — {^.*?s*?;s*(.*$)} $inp {} outp

              set xlateOutsVals

          • #82107
            Mark Thompson
            Participant

              Jared,

              Regular expressions are a worthwhile learning experience.  If you prefer to delay that joy, you could try something like:

              lassign $xlateInVals inp

              lassign [split $inp ;] discard outp

              set oupt [string trim $outp]

              set xlateOutVals

                The important thing to remember is that xlateInVals and xlateOutVals are lists not strings.  Often that doesn’t matter until you hit a test case (or production data) containing a space character.

              - Mark Thompson
              HealthPartners

            • #82108
              Jared Miller
              Participant

                Thanks guys! I had gotten to the point of Kevin’s suggestion (so clearly I’m no tcl expert either) prior to coming for help. I am getting the result I’m looking for now after reviewing Charlie and Mark’s posts.

                Before I was only getting “Cysto-Grafin,” so the 25 ml was getting cut off. Now I’m getting all the data needed, “Cysto-Grafin, 25 ml”

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