Replacing .BR to ~ and split to multiple OBX

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Replacing .BR to ~ and split to multiple OBX

  • Creator
    Topic
  • #53128
    Henry Tsou
    Participant

      Hi

      Does anyone have done this before?  I like to split a single OBX segment with .br in between texts to multiple OBXs.  What I have done so far:  I can replace .br to ~.  But with in the same xlate, the texts between ~ are not list so the iterate can’t loop through.  Is there anyway that I can do this within xlate?  if I have to do before TPS, how do I do it and anyone has example?

      thanks!

      Here is the example I am trying to work on:

      MSH|^~&|KinetDx|Ann Arbor Lab|Broker|ConnectivityLab|20030305105716||ORU^R01|00002455|P|2.2||||||ISO_IR 100

      PID|||M555||SUMNER^ALEX^WILLIAM||19680212|M|

      OBR|1||275|^Adult Heart|||20030305120744|||||||||||||||20030305162300|||F|||||||Welby^Marcus^T

      OBX|1|CE|275&IMP||^Acute MI unspecified site, initial episode of care-410.91||||||F

      OBX|2|FT|275&GDT||Ann Arbor Medical Center.brEchocardiography Laboratory.brTelephone:(734)-555-1234 Fax: (734)-555-1235.br\.brECHO REPORT.brPatient Name: ALEX WILLIAMSUMNER Patient ID: M555.brExam Date: March 5, 2003 Patient DOB: February 12,1968.brDate of Report: March 5, 2003 Height: .brReferring Phys. YEVES ANDREW. TIESSENWeight: .brReferring Diag. Acute MI unspecified site, initial episode of care-410.91.brResting BP: / .brIndication: Kinet, Acute MI anterolateral, subsequent episode ofcare-410.02.br\.brM-mode Data.brLVDD: AO: .brLVSD: EPSS: .brFract. Shortn: PW:.brRVDD: EDV Teichholz: .brIVSTD: ESV Teichholz: .brIVSTS: SV: .brFract. Change:EF: .brLAD: .br\.br2D Study.brThere is mild left atrial enlargement. .brThere isapical akinesis with wall thinning compatible with scar. The.brdistribution suggests adistal left anterior descending coronary artery.brdistribution..br\.br\.br\.brDoppler.brThere is trivial aortic regurgitation present..br\.br\.br\.br\.br______________________________.brMarcus TWelby.br\.br||||||F

    Viewing 8 reply threads
    • Author
      Replies
      • #76662
        Robert Milfajt
        Participant

          Depending on what you feel most comfortable doing, TPS or Xlate, there are several ways to try to tackle this.

          1.  Change .br to ~ in a TPS before message hits Xlate.  Then in Xlate, iterate over the repeats, keeping a second counter for your outbound message OBX segments, and copy each repeat iteration to its own OBX outbound.

          2.  Do it all in a TPS, break it down, into a list, foreach over the elments and lappend the each item to its own OBX in outbound message segment list.

          3.  I did it all in an Xlate, by first using TCL within Xlate COPY to [string map \.br\ ~], split the result on ~, passed resulting list back to @nte_list with @num_vals as the [llength $nte_list].  Then set up clever iteration over the list using BASIS 0 1 (someone put this up in another post and if someone could post a reference to it; AWESOME), to put each list element in its own OBX segment (I had to take NTE and convert to OBX, one line per .br..

          Probably more ways to do it too.

          Hope this helps,

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #76663
          Henry Tsou
          Participant

            Thanks Robert.   I like your #3 option if I can find out how to setup the clever iteration..  

            thx!

          • #76664
            Jim Kosloskey
            Participant

              Henry,

              Make the Iteration a List Iteration. Key in the basis as 0 space 1 (0 1). Let’s say you use $l1 as your counter.

              Inside the Iterate as long as you want to keep iterating (you have not exhausted your list yet) COPY =0 –> $%l1 (the $ is important here).

              ITERATE will then see its counter is not yet greater that the basis count (which is 2) and ITERATE again – this can keep on forever unless you take action to end the loop.

              You typically do that with an IF that indicates you have exhausted building your OBXs. In that case you COPY =2 –> $%l1 (again the $ is important).

              You will need your own counter for the OBX field OBX-5 (I use somethting like %f99 as it is a field repetition). You will need to increment and manage that counter with MATH Actions, etc. and it is the %f99 counter you will use in the appropriate position of the address path for the OBX-5 field.

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

            • #76665
              Henry Tsou
              Participant

                Thank you Jim and Robert.  I got it to work!!!

              • #76666
                Robert Milfajt
                Participant

                  😀

                  Robert Milfajt
                  Northwestern Medicine
                  Chicago, IL

                • #76667
                  Jill Marcotte
                  Participant

                    This post was a timely post for an issue that I am working on.  I’ve concatenated all of my OBX 5 segments into one OBX 5 using the following logic:

                    COPY 3(0).0(%g1).OBX(%s1).#5(0) -> 3(0).0(0).OBX(0).#5(%s1)

                    Produces this output:

                    …result on our patients.~This patient gets used for lots of radiology result testing.~When this patient goes out at night…

                    I’m working on a tcl to use in the copy to replace the ~ with /.br/.  Below is the statement that I use in the above copy statement(that doesn’t work)

                    set xlateOutVals

                      } [lindex $xlateInVals 0]]]

                      Any help is appreciated with this issue.

                      Kindest regards,

                      Jill Marcotte

                    1. #76668
                      Jim Kosloskey
                      Participant

                        Jill,

                        Give this a try:

                        inside your ITERATE use a CONCAT to CONCAT the OBX-5 segments into a single OBX-5.

                        The Sourcxe would have the outbound OBX-5 (no repetition) – it should have a tilde (~) in front. Just select from the outbound and tell it to use as Source (one of the buttons below the field selected)

                        The second source wilbe your repearting OBX-5 from your inbound message.

                        in the CONCAT separator use .br

                        For the destination point to your outbound OBX-5 (no repetition).

                        You should not need any Tcl.

                        If you have questions, email me

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

                      • #76669
                        Jill Marcotte
                        Participant

                          Thank you – that worked like a charm.  Could you provide me with explanation as to why to pull in the outbound into the source?

                          Regards,

                          Jill

                        • #76670
                          Jim Kosloskey
                          Participant

                            Jill,

                            You ned to add each OBX-5 inbound to one OBX-5 outbound.

                            So if you did not use the outbound field as part of the Source for the CONCAT within the ITERATE you would end up with the last OBX-5 plus .br – you want them all

                            First iterate…

                              inbound has abc

                              outbound has nothing

                              after CONCAT

                               outbound has .brabc

                            Second iterate…

                              inbound has 123

                              outbound has .brabc

                              if we use the outbound then we will concat

                                 .brabc with .br and 123 giving us .brabc.br123

                            and so on

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

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