Convert OBX to NTE using Xlate

Clovertech Forums Cloverleaf Convert OBX to NTE using Xlate

  • Creator
    Topic
  • #120111
    JD
    Participant

      Hello – I need to convert two OBX segments into multiple NTE segments using an xlate.

      OBX segments to be converted are identified by a value in OBX.3. There should always be 2 OBX segments to convert.

      I can capture the OBX segments to be converted, but need nsight into parsing the OBX.5 values and putting them into their own NTE segment. Sample input and desired output below. Thanks in advance!

      OBX|3|ST|123-1||Orthopedic Institute LLC, CLIA 000000111||||||F||||||||^M

      OBX|4|ST|123-2||122233 Great Canyon Ave, Great City CA 90001, First M Last MD||||||F||||||||

      Output Should be:
      NTE |1|P|Orthopedic Institute LLC
      NTE |2|P|CLIA 000000111
      NTE |3|P|122233 Great Canyon Ave
      NTE |4|P|Great City CA 90001
      NTE |5|P|First M Last MD||

    Viewing 6 reply threads
    • Author
      Replies
      • #120112
        Paul Bishop
        Participant

          So it looks like you will be splitting the source data by the comma?  You should be able to do this fairly simply in a translate with some in-line TCL coding.  You will need to set and increment the NTE segment index within the translate, including any other NTE segments that are copied from the original message.  Pseudo code wise it would look something like this:

          1. Initialize the outbound NTE segment index to zero (copy =0 to $%s91)
          2. Initialize the outbound NTE-1 field to one (copy =1 to @nte_cntr)
          3. start looping over the inbound OBX segments.
          4. For the OBX segment with OBX-3 equal 123-1, copy OBX-5 to @nte_name and @nte_clia using a TCL snippet:

            lassign $xlateInVals in_obx_5
            set out_name [lindex [split $in_obx_5 “,”] 0]
            set out_clia [lindex [split $in_obx_5 “,”] 1]
            set xlateOutVals

            1. copy @nte_cntr to the NTE(%s91)-1 field, “P” to the NTE(%s91)-2 field, and @nte_name to the NTE(%s91)-3 field
            2. increment $nte_cntr and $%s91 by 1
            3. copy @nte_cntr to the NTE(%s91)-1 field, “P” to the NTE(%s91)-2 field, and @nte_clia to the NTE(%s91)-3 field
            4. For the OBX segment with OBX-3 equal 123-2, copy OBX-5 to @nte_addr_1, @nte_addr_2, and @nte_provider using a TCL snippet:

              lassign $xlateInVals in_obx_5
              set out_addr_1 [lindex [split $in_obx_5 “,”] 0]
              set out_addr_2 [lindex [split $in_obx_5 “,”] 1]
              set out_provider [lindex [split $in_obx_5 “,”] 2]
              set xlateOutVals

              1. copy @nte_cntr to the NTE(%s91)-1 field, “P” to the NTE(%s91)-2 field, and @nte_addr_1 to the NTE(%s91)-3 field
              2. increment $nte_cntr and $%s91 by 1
              3. copy @nte_cntr to the NTE(%s91)-1 field, “P” to the NTE(%s91)-2 field, and @nte_addr_2 to the NTE(%s91)-3 field
              4. increment $nte_cntr and $%s91 by 1
              5. copy @nte_cntr to the NTE(%s91)-1 field, “P” to the NTE(%s91)-2 field, and @nte_provider to the NTE(%s91)-3 field

              It’s important to set the xlateOutVals value using the list command so your values are set to the correct variables.

              If you need more information, let me know and I can help you through it over email.

              Paul Bishop
              Carle Foundation Hospital
              Urbana, IL

              • #120114
                JD
                Participant

                  Appreciate the reply and info; frankly at this point I’m tcl challenged and was trying to do this in an xlate.  I need to play around with tcl a lot more.  Thanks again

              • #120113
                Charlie Bursell
                Participant

                  You don’t say, but where in the OB message do the NTE segments go>  Are they the last segments?  Do the OBX segments, and others, remain positionally the same?

                  Any reason not to do this Tcl?  A lot less convoluted and easier to maintain.

                   

                • #120115
                  JD
                  Participant

                    Hello – the obx segments with the -1/-2 will turn into NTE segments.  Just before the OBX segments with the -1/-2 there is an OBX segment that will go with newly created NTE segments.   Trying to do this in an xlate.  Thanks

                    OBX|2|ST|123||See details below||||||F||||||||

                    OBX|3|ST|123-1||Orthopedic Institute LLC, CLIA 000000111||||||F||||||||^M

                    OBX|4|ST|123-2||122233 Great Canyon Ave, Great City CA 90001, First M Last MD||||||F||||||||

                    Output Should be:

                    OBX|2|ST|123||See details below||||||F||||||||
                    NTE |1|P|Orthopedic Institute LLC
                    NTE |2|P|CLIA 000000111
                    NTE |3|P|122233 Great Canyon Ave
                    NTE |4|P|Great City CA 90001
                    NTE |5|P|First M Last MD||

                  • #120116
                    Paul Bishop
                    Participant

                      The TCL portion is written out for you in my first post (starting with the “lassign” line and ending with the “set xlateOutVals” line.

                      As with most things in Cloverleaf, there are multiple ways to get to the end results you want.  With the given information, I would probably do this in a translate as opposed to writing a TCL proc, but that could also change depending on if other parts of the message are being translated as well.

                      Paul Bishop
                      Carle Foundation Hospital
                      Urbana, IL

                    • #120119
                      Charlie Bursell
                      Participant

                        Paul:
                        To each his own 🙂  But your Xlate example does not address the rest of the message, i.e., remove the two OBX segments after processing and making sure the MSH, etc. and other segments are as desired.

                        You know me, I am a Tcl guy and still believe that Tcl, or other languages now,  is one of the main strengths of Cloverleaf.  Much more maintainable, with proper comments, in cases such as this.

                      • #120122
                        Jim Kosloskey
                        Participant

                          If on later release of CL, the STRING Action has a function you can use for the string stuff insteD of Tcl if string Tcl is your only issue.

                          I am willing to help if you like – email me.

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

                        • #120168
                          JD
                          Participant

                            Thank you for all the information – well appreciated!  Have done the mapping  in xlate with a sr. analyst.

                        Viewing 6 reply threads
                        • You must be logged in to reply to this topic.