Is it even possible to remove backslashes in an HL7 xlate?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Is it even possible to remove backslashes in an HL7 xlate?

  • Creator
    Topic
  • #51687
    Vince Angulo
    Participant

      We are CIS 5.7R1 on AIX.

      I’m probably just making this too hard.  Trying to copy the free-text Chief Complaint from the appropriate DG1 component to PV2-3 where Cerner likes to see it as the Reason For Visit and remove a creative user’s backslash…

      xlateInVals = SOME PHRASE LIKE THIS

      using the COPY pre-proc of

      regsub -all {\} $xlateInVals {} xlateOutVals

      xlateOutVals = SOME

      Okay, I’ve commited the cardinal Cloverleaf sin of not treating xlateInVals as a list…so I change to

      regsub -all {\}

        {} xlateOutVals

        xlateOutVals = SOME PHRASE LIKE THIS

        Ta-da!  Well, not quite mon hombre…When testing

        xlateInVals = SOME PHRASE LIKE THIS or,

        xlateInVals = SOME PHRASE LIKE THIS

        without the backslash or with it elsewhere than the end, I get

        xlateOutVals = {SOME PHRASE LIKE THIS}

        with those pesky curly braces.  I tried using string map and got strange  results too:

        set xlateOutVals [string map {{\} {}}

        ]

        SOME PHRASE LIKE THIS => {SOME PHRASE LIKE THIS}

        SOME PHRASE LIKE THIS => {SOME PHRASE LIKE THIS}

        and my favorite, the original culprit:

        SOME PHRASE LIKE THIS => SOME PHRASE LIKE THIS

        All this was done in the Xlate Testing Tool.

        Any assistance would be much appreciated.

    Viewing 5 reply threads
    • Author
      Replies
      • #71287
        Tom Rioux
        Participant

          Hi Vince,

          Don’t forget to treat your xlateOutVals as a list as well.  That should get rid of those pesky braces.   Try this.  I like the two line method for better readability:

          set obx5 [lindex $xlateInVals 0]

          set xlateOutVals

            ]

            Hope this helps…

            Tom Rioux

          1. #71288
            Vince Angulo
            Participant

              Thanks Tom, but I didn’t have much success with that approach — got even more braces than expected in the XLT Testing Tool:

              Code in my Pre Proc COPY statement:

              set mReason

                set xlateOutVals

                  ]

                  Results as follows:

                  Message 1

                  L INFLAMTION BEHIND => {{L INFLAMTION BEHIND}}

                  Message 2

                  L INFLAMTION BEHIND => {{L INFLAMTION BEHIND}}

                  Message 3

                  LEFT PERIORBITAL CELLULITIS => {LEFT PERIORBITAL CELLULITIS}

                  I didn’t do the lindex per your example, because I need the entire phrase, otherwise I expect I implemented it correctly.  Or, did I?

              • #71289
                Michael Hertel
                Participant

                  How about:

                  set mReason [join [split [lindex $xlateInVals 0] \] {}]

                  set xlateOutVals

                • #71290
                  Vince Angulo
                  Participant

                    Apologies to Tom and thanks to both Tom and Mike.

                    It turns out both solutions work against my test data.

                    I just haven’t figured out how the manages to return the whole phrase, when I was only expecting that lindex to only return the first word?  Because it’s not a nested list?

                    I am humbled and not worthy…

                  • #71291
                    Michael Hertel
                    Participant

                      When all else fails:

                      echo >$xlateInVals<

                    • #71292
                      Chris Williams
                      Participant

                        Vince,

                        In response to your last question, $xlateInVals is a list of ALL the items on the source side of the copy. [lindex $xlateInVals 0] is the FIRST of those items, which may itself contain a list. If you only wanted the first word of that first item, you would use [lindex [lindex $xlateInVals 0] 0].

                        “In Tcl, everything is a list,” even if there is only one element in the list.

                        Cheers.

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