Copy OBXs into every OBR set

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Copy OBXs into every OBR set

  • Creator
    Topic
  • #51871
    Huy Tran
    Participant

    I have a message with multiple OBR. First OBR doesn’t have any OBXs. I’d like to copy all OBXs into the OBR that doesn’t have any OBXs. I played with creating new message per OBR but OBXs didn’t get carried over.

    Thanks for your help. Please see sample message below:

    MSH|^~&|HNAM|HNAM|IDX|IDX|20100715090910||ORU^R03|Q530665134T450110524||2.3

    PID|1|5000104355^^^LHS MRN^TYPE MRN ENC^CD:184918017|5000104355^^^LHS MRN^TYPE MRN^CD:184918017~4104896^^^SMPI^TYPE SMPI^CD:184918017||CHILDINTERFACE^TEST^^^^^NAME||20000407|F||W|ADDR1^ADDR2^PORTLAND^OR^97217^USA^HOME ADDR^^MUL|MUL|(555)555-5555^HO||EN|S||380133201^^^LHS ACCT^TYPE FIN NBR^CD:184918017|999999999|||N|||0

    PV1|1|I|5BSC^526B^01^LSC^^BED^LSC|3|||1010^Test^Md^^^^^^^PRSNL|1010^Test^Md^^^^^^^PRSNL||MED||||2|||1010^Test^Md^^^^^^^PRSNL|II|||||||||||||||||||||LSC||ACTIVE|||20100604100900

    ORC|CN|||||||||||1010^TEST^MD|||||PowerChart

    OBR|1|400271469^HNAM_ORDERID|185905^EChart Ordif|X HIP 1V L^RA Hip 1 View Left|||20100715090502||||||||CD:801&Rad Type|1010^TEST^MD^^^^^^^PRSNL||||00000RA20100002425^HNA_ACCN~18781153^HNA_ACCNID~07418865^HNA_PACSID||20100715090843||RAD|F||1^^^201007150903|||A|^testing linked exams|&GOEDKEN&AARON&M&&&&&&&|||AGOEDKEN&GOEDKEN&AARON&M&&&&&&&

    ORC|RE|||||||||||1010^TEST^MD

    OBR|2|400271476^HNAM_ORDERID|185906^EChart Ordif|X HIP 1V R^RA Hip 1 View Right|||20100715090502||||||||CD:801&Rad Type|1010^TEST^MD^^^^^^^PRSNL||||00000RA20100002426^HNA_ACCN~18781154^HNA_ACCNID~07418866^HNA_PACSID||20100715090843||RAD|F||1^^^201007150903|||A|^testing linked exams|&GOEDKEN&AARON&M&&&&&&&|||AGOEDKEN&GOEDKEN&AARON&M&&&&&&&

    OBX|1|TX|RADREPORT^RADRPT^^X HIP 1V L^RA Hip 1 View Left||||||||F|||20100715090843

    OBX|2|TX|RADREPORT^RADRPT^^X HIP 1V L^RA Hip 1 View Left|| CHILDINTERFACE, TEST                   DOB:  4/7/00||||||F|||20100715090843

    OBX|3|TX|RADREPORT^RADRPT^^X HIP 1V L^RA Hip 1 View Left||||||||F|||20100715090843

    OBX|4|TX|RADREPORT^RADRPT^^X HIP 1V L^RA Hip 1 View Left||||||||F|||20100715090843

    OBX|5|TX|RADREPORT^RADRPT^^X HIP 1V L^RA Hip 1 View Left||                  D I A G N O S T I C   R A D I O L O G Y||||||F|||20100715090843[/b]

Viewing 7 reply threads
  • Author
    Replies
    • #72080
      Robert Milfajt
      Participant

      Should be easy with an Xlate.  I have some questions:

      1.  Can there be more than two OBR segments?  If so, do you want to copy OBXs from all other OBR segments to the first OBR?

      2.  Will the first OBR segment always not have OBX segments?  If not, do you want to append the other OBX segmetns to the end of the ones already there?

      Basically you can iterate through the group of OBR/OBX segments and when you are on the second (and subsequent) OBR groups copy them back to the first one.  If you answer YES to both parts of question #1, you will need to set up a variable to keep track of the last OBX segment in the first OBR group.

      Hope this helps,

      Robert Milfajt
      Northwestern Medicine
      Chicago, IL

    • #72081
      Huy Tran
      Participant

      Yes, there could be more than 2 OBR. The last OBR always have OBXs, and these OBXs need to be copied to all OBR. Could you provide example how to setup a variable to keep track of last OBXs?

      Thanks.

    • #72082
      Jim Kosloskey
      Participant

      Huy,

      Iteration Counters (variables) have to have the format %xn (where x= g for Group, s for Segment, f for Field, or l for List and n is some number).

      Iteration counters are most typically defined in the ITERATE Action.

      However, you can have your own counters as long as you follow the format %xn. For example if you want your own Group counter you could use %g99 (I usually use numbers in the 90’s starting with 99 and working backwards – that then becomes a visual reminder to me that I have a counter I am managing). The I would do a COPY =0 -> $%g99.

      Note the $ in the COPY Action defined above. Here is a general rule: If you are going to use a counter to reference a data item then no $ in front of the counter (for example 0(0).1(%g99).whatever…); if you are going to reference the counter (such as with a MATH Action or a COPY Action, or an IF Action, etc.) then you need to place a $ in front of the counter ($%g99 for example) thai allows the Xlate to recognize the counter as a variable it can use.

      The key here, I believe is that you will need your own Group counter for the OBX group outbound as you will be building that (OBX Group) in the  first OBR Group outbound that is not related to the first OBR Group inbound.

      This is rather easy to do in an Xlate but it is an advanced topic and is based on an understaning of how Iterations work. How comfortable are you with Iterations, understanding Groups vs Segments, and the setting of basis?

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

    • #72083
      Charlie Bursell
      Participant

      Not so much a requirement as a convention Jim.

      You can call your counters whatever.  It is just by convention and better documentation we use the %g1, %s1, etc

    • #72084
      Sam Craig
      Participant

      Hate to argue with THE Cloverleaf guru…. 🙂

      But, I have tried to use a counter without a %g, %s, %f, or %l and the xlate won’t compile.

      Like this simple action:

      COPY       =1 -> {$%d98}

      COPY       {$%d98} -> 0(0).OBX(0).#1

      Produces this error in XLT testing tool:

      [0:TEST] Unrecognized field name ‘Invalid interpolation variable  %d98’

      [0:TEST] Unable to compile OUT list ‘{$%d98}’

      [0:TEST] Unable to compile statement ‘

      { OP COPY }

         { ERR 0 }

         { IN =1 }

         { OUT {{$%d98}} }

      [0:TEST] Unrecognized field name ‘Invalid interpolation variable  %d98’

      [0:TEST] Unable to compile IN list ‘{$%d98}’

      [0:TEST] Unable to compile statement ‘

      { OP COPY }

         { ERR 0 }

         { IN {{$%d98}} }

         { OUT 0(0).OBX(0).#1 }

      [0:TEST] Unable to compile XLT ‘Midas_MDM_to_HPF_play.xlt’.

      Is there a way to use the %d98 as a counter in an Xlate?

    • #72085
      Charlie Bursell
      Participant

      Maybe we are talking Apples an Oranges here

      I meant as the counter when you set up an iteration.  For example, by convention, if iterating over a group we would normally set the counter as %g1.  However you could set it as %x1 and it should work.  However I have not tried it in a long time since I think you should stick to the convention for better documentation

      I don’t think  the below will work since it is not a counter.  Remove the $ and it will work

      COPY       =1 -> {$%d98}

    • #72086
      Tom Rioux
      Participant

      Huy,

      I was able to get it working without using counters.

    • #72087
      Huy Tran
      Participant

      Thank You all for replying to the post. I was able to get it working using my old buddy Tom R. solution.

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10