xlate output appending data

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf xlate output appending data

  • Creator
    Topic
  • #51533
    Mark Perschbacher
    Participant

      I have an HL7 to vrl xlate I am working on, and in the Iterate, COPY field, I have this code snippet pulling out a range of data

      set sata $xlateInVals

      set data2 [lindex $sata]

      set data2 [string map {“{” “” “}” “”} $data2]

      append data1 “$data2 “

      set final “SPECIMEN:”

      set elect “CLINICAL HISTORY:”

      set signed [string first $final $data1]

      set last [string first $elect $data1]

      set words [string range $data1 $signed $last]

      set xlateOutVals

        What I am seeing is that the first message comes across fine, the second and third, etc., gets what looks like the xlateInVals data appended for the second message appended on the end of the vrl.  I have a SUPPRESS at the beginning of the xlate, and here is the rest.  Any ideas?

    Viewing 14 reply threads
    • Author
      Replies
      • #70676
        Jim Kosloskey
        Participant

          Mark,

          Should the CONTINUE be inside the ITERATE?

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

        • #70677
          Mark Perschbacher
          Participant

            You’re right.  I moved it down, but still getting the second xlateInVals appended to the second message and so on.

          • #70678
            Robert Milfajt
            Participant

              I am not sure about:

              Code:

              append data1 “$data2 “

              What I am not sure about is keeping the variable data1 around between iterations.

              Is your goal to create a message for each OBX, or one message with diag containing a concatenation of all the OBX’s?

              If the latter, you may want to break your COPY into a COPY and CONCAT.  The first part would get only the part of OBX.5 that you want and set it to a local variable, e.g., @diag, then CONCAT @diag to the VRL diag field.

              Hope this helps,

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #70679
              Jim Kosloskey
              Participant

                Mark,

                What are your ‘Global Options’ for the VRL Configuration?

                email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

              • #70680
                Mark Perschbacher
                Participant

                  Robert, I am trying to execute the later, so I will give your suggestion a try.

                  Jim, the Global Prop are

                  Field Separator  |

                  Def. subfield sep  x20

                  Def. subsubfield sep –

                  Don’t use tagged field

                • #70681
                  Mark Perschbacher
                  Participant

                    Robert, still getting message 2 xlateInVals appended on to message 2, 3, and so on.  It is interesting that I tried changing the last line of the snipet to set xlateOutVals $words, and it stopped appending, but all it sent across was the first word of string $words.

                  • #70682
                    Jim Kosloskey
                    Participant

                      Mark,

                      What is the configuration of the diag field (specifically does it have any subfields configured)?

                      It is not surprising you only got the first element of the list $word with your last change as xlateOutVals is a list and now the Xlate will only take the first element of the list rather than the entire list.

                      Have you tried to use CALL instead of COPY?

                      The COPY is tying to do something with your output field as well as what you ar trying.

                      email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                    • #70683
                      Mark Perschbacher
                      Participant

                        Jim, no diag does not have any subfields configured.  So are you recommending just substituing CALL for COPY as it is?

                      • #70684
                        Jim Kosloskey
                        Participant

                          Mark,

                          I am suggesting to try CALL instead of COPY.

                          All of your Source and Destination information will stay the same. You will have to specify your Tcl in a different location I believe so you might want to copy it before changing from CALL to COPY.

                          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                        • #70685
                          Mark Perschbacher
                          Participant

                            Gotcha, I have not used CALL before, but it sounds like you are suggesting I pull the snipet out of the xlate and move it to a seperate proc.

                          • #70686
                            Jim Kosloskey
                            Participant

                              Mark,

                              No need to get rid of the snippet (I don’t use snippets but that is another matter), you will just need to move the code.

                              Presently in the COPY the snippet code resides in the Pre Proc location. In a CALL the code will exist in the Proc location.

                              email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                            • #70687
                              Mark Perschbacher
                              Participant

                                Jim, I decided to take the path of least resistance.  I have some pre-xlate procs that I am using for other types of specimens, and thought I’d see if I could just run some code within the xlate, but I just modifed one of the pre-xlate procs, and it works fine.  As usual, thanks for your help.

                              • #70688
                                Robert Milfajt
                                Participant

                                  One last idea you can try to keep it in the Xlate…

                                  For your copy statement, change the souce to have two arguments:

                                  Code:

                                  1(0).1(0).1(%g1).OBX(0).#5(0)
                                  ~diag

                                  Your destination stays the same:

                                  Code:

                                  diag

                                  Your TCL inside changes to look like:

                                  Code:

                                  set sata $xlateInVals
                                  set data1 [lindex $sata 1]
                                  set data2 [lindex $sata 0]
                                  set data2 [string map {”{” “” “}” “”} $data2]
                                  set final “SPECIMEN:”
                                  set elect “CLINICAL HISTORY:”
                                  set signed [string first $final $data2]
                                  set last [string first $elect $data2]
                                  set words [string range $data2 $signed $last]
                                  append data1 “$words” ” ”
                                  set xlateOutVals [list $data1]

                                  Robert Milfajt
                                  Northwestern Medicine
                                  Chicago, IL

                                • #70689
                                  Mark Perschbacher
                                  Participant

                                    Robert, I made the changes as you suggested, and I am not getting anything returned.  Save your brain power for my next post, thanks.

                                  • #70690
                                    Bob Richardson
                                    Participant

                                      Mark and company,

                                      With using the append command in an Xlate, I have found that the variable will persist in memory in this TCL interpreter.  This definitely shows up in an inline TCL procedure;  so I just clear the variable before any append operation to avoid its inevitable expansion:

                                      set data1 {}

                                      append data1 “$data2”

                                      Not sure about the TCL fragment (TCLindex based guys) but it doesn’t hurt to clear your variables first before setting them anyway (Old IBM programmer habit – the golden days of Cobol).

                                      Enjoy.

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