Using an Xlate to split an A17 into two A02s

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Using an Xlate to split an A17 into two A02s

  • Creator
    Topic
  • #55336
    Jon Blanchard
    Participant

      Cloverleaf 6.1.2 on AIX

      I am attempting to create a generic Xlate for chaining, which will convert a single A17 message into two A02s and my only real problem is using the SEND action to generate and send the two A02 messages.

      Would somone be willing to assist me?  There is nothing special being done, except for trying to SEND tne A02 within an iteration.

      Here is the Xlate:

      Code:

      prologue
         xlt_infile: hl7 2.5.1 Epic_AIP_711700_IB ADT_A17
         who: jblanchar01
         date: March 14, 2017 3:11:11 PM CDT
         xlt_outfile: hl7 2.5.1 Epic_AIP_711700_IB ADT_A02
         type: xlt
         version: 7.0
      end_prologue

      { { OP IF }
         { ERR 0 }
         { COND { 0(0).MSH(0).#9(0).[1] eq =A17} }
         { THENBODY {
             { { OP SUPPRESS }
                 { REM 1 }
             }
             { { OP COPY }
                 { ERR 2 }
                 { IN =1 }
                 { OUT @msgCounter }
             }
             { { OP ITERATE }
                 { BASIS 1(%g1) }
                 { VAR %g1 }
                 { TYPE group }
                 { BODY {
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 0(0).MSH(0) }
                         { OUT 0(0).MSH(0) }
                     }
                     { { OP COPY }
                         { ERR 2 }
                         { IN =A02 }
                         { OUT {{0(0).MSH(0).#9(0).[1]}} }
                     }
                     { { OP COPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT {{0(0).MSH(0).#9(0).[2]}} }
                     }
                     { { OP COPY }
                         { ERR 2 }
                         { IN {{0(0).MSH(0).#10(0).[0]} =. @msgCounter} }
                         { OUT {{0(0).MSH(0).#10(0).[0]}} }
                         { COPYSEP {} }
                     }
                     { { OP PATHCOPY }
                         { ERR 0 }
                         { IN 0(0).EVN(0) }
                         { OUT 0(0).EVN(0) }
                     }
                     { { OP COPY }
                         { ERR 0 }
                         { IN =A02 }
                         { OUT 0(0).EVN(0).#1(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 1(%g1).0(0).PID(0) }
                         { OUT 1(%g1).0(0).PID(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 1(%g1).0(0).ZPD(0) }
                         { OUT 1(%g1).0(0).ZPD(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 1(%g1).0(0).PD1(0) }
                         { OUT 1(%g1).0(0).PD1(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 1(%g1).0(0).PV1(0) }
                         { OUT 1(%g1).0(0).PV1(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 1(%g1).0(0).PV2(0) }
                         { OUT 1(%g1).0(0).PV2(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN 1(%g1).0(0).ZPV(0) }
                         { OUT 1(%g1).0(0).ZPV(0) }
                     }
                     { { OP SEND } }
                     { { OP ADD }
                         { ERR 2 }
                         { IN {@msgCounter =1} }
                         { OUT @msgCounter }
                         { FUNCTION ADD }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT 1(0).0(0).PID(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT 1(0).0(0).ZPD(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT 1(0).0(0).PD1(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT 1(0).0(0).PV1(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT 1(0).0(0).PV2(0) }
                     }
                     { { OP PATHCOPY }
                         { ERR 2 }
                         { IN @null }
                         { OUT 1(0).0(0).ZPV(0) }
                     }
                 }}
             }
             { { OP SUPPRESS } }
         }}
         { ELSEBODY {
         }}
      }

      Code:


      MESSAGE 1
      0(0).MSH(0)  :  >|^~&|EPIC||||20170302082554|OLIVERMA|ADT^A02|77964.1|T|2.5.1< 0(0).EVN(0)  :  >|A02|20170302082554||ADT_EVENT|OLIVERMA^OLIVER^MARK^^^^^^ABQ^^^^^1LRH|20170302072551|1LRH^1LRH^FAC< 1(0).0(0).PID(0)  :  >|1|205819^^^AHS^MR|0000000821^^^1ABQH^MR||NAVICARE^ONE^^^^^D||19820223|F||White|777 MULBERRY, #77^^LAS VEGAS^NM^87701^US^L^^SAN MIGUEL|SAN |(888)555-3465^P^H^^^888^5553465~^NET^Internet^test@test.org||ENG|MARRIED||1000100061445|555-55-3579|||NOT HISPANIC||||||||N< 1(0).0(0).ZPD(0)  :  >||||||ABQ SERVICE AREA^^10|N||N< 1(0).0(0).PD1(0)  :  >|||ROSWELL REGIONAL HOSPITAL^^101004|1054^CHAMPION^PHYSICIAN^^^^^^PROVID^^^^PROVID~1105499994^CHAMPION^PHYSICIAN^^^^^^NPI^^^^NPI< 1(0).0(0).PV1(0)  :  >|1|I|1LRH22RS^201^201-1^1LRH^EVS ASSIGNED^^^^^^DEPID|EL||1LRH22RS^206^206-1^1LRH^D^^^^^^DEPID|1111^LEAN^PHYSICIAN^^^^^^PROVID^^^^PROVID~1111199992^LEAN^PHYSICIAN^^^^^^NPI^^^^NPI|||MED||||Phys/Clinic|||1111^LEAN^PHYSICIAN^^^^^^PROVID^^^^PROVID~1111199992^LEAN^PHYSICIAN^^^^^^NPI^^^^NPI|INP|1000100061445||||||||||||||||||||||Ad|||20170302072400< 1(0).0(0).PV2(0)  :  >||Semi-Private||||||20170302072400||||Hospital Encounter|||||||||n|N< 1(0).0(0).ZPV(0)  :  >|||||||||||20170302072400< 0(0).MSH(0)  :  >|^~&|EPIC||||20170302082554|OLIVERMA|ADT^A02|77964.2|T|2.5.1< 0(0).EVN(0)  :  >|A02|20170302082554||ADT_EVENT|OLIVERMA^OLIVER^MARK^^^^^^ABQ^^^^^1LRH|20170302072551|1LRH^1LRH^FAC< 1(0).0(0).PID(0)  :  >< 1(0).0(0).PV1(0)  :  >< 1(1).0(0).PID(0)  :  >|2|205830^^^AHS^MR|0000000833^^^1ABQH^MR||NAVICARE^TWO^^^^^D||19770223|M|NAVICARE^THREE|White|888 PINE, # 88^^LAS VEGAS^NM^87701^US^L^^SAN MIGUEL|SAN |(888)555-4645^P^H^^^888^5554645~^NET^Internet^test@test.gov||ENG|MARRIED||1000100061441|555-55-4678|||NOT HISPANIC||||||||N< 1(1).0(0).ZPD(0)  :  >||||||ABQ SERVICE AREA^^10|N||N< 1(1).0(0).PD1(0)  :  >|||LOVELACE MEDICAL CENTER^^101002|1054^CHAMPION^PHYSICIAN^^^^^^PROVID^^^^PROVID~1105499994^CHAMPION^PHYSICIAN^^^^^^NPI^^^^NPI< 1(1).0(0).PV1(0)  :  >|2|I|1LRH22RS^206^206-1^1LRH^D^^^^^^DEPID|EL||1LRH22RS^201^201-1^1LRH^EVS ASSIGNED^^^^^^DEPID|1000^FAMILY MEDICINE^PHYSICIAN^^^^^^PROVID^^^^PROVID~1100099997^FAMILY MEDICINE^PHYSICIAN^^^^^^NPI^^^^NPI|||MED||||Phys/Clinic|||1111^LEAN^PHYSICIAN^^^^^^PROVID^^^^PROVID~1111199992^LEAN^PHYSICIAN^^^^^^NPI^^^^NPI|INP|1000100061441||||||||||||||||||||||Ad|||20170302071100< 1(1).0(0).PV2(0)  :  >||Semi-Private||||||20170302071100||||Hospital Encounter|||||||||n|N< 1(1).0(0).ZPV(0)  :  >|||||||||||20170302071100<

      Migration Consultant
      Coffee Regional Medical Center
      Eastern Time Zone

    Viewing 3 reply threads
    • Author
      Replies
      • #85004
        Jim Kosloskey
        Participant

          Jon,

          Use CONTINUE rather than SEND that should do the trick.

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

        • #85005
          Robert Kersemakers
          Participant

            I’m trying to read your code, but have some problems.

            There is a SUPPRESS at the beginning and the end of the IF statement; only one is enough to stop the Xlate from sending out a message at the end of the Xlate.

            Your iteration has basis ‘1(%g1)’, with variable ‘%g1’. This can’t work: your basis should be ‘1’.

            In the first part inside your iteration, your are copying the %g1 segments to the corresponding %g1 in the outbound message. I think you want to copy to the ‘0’ segment, just like you do in the second part of the iterate where you are erasing all ‘0’ segments.

            Have never used an ADT-A17 (bed swap) message, but if you want to translate it into two ADT-A02 messages, you don’t need an iteration:

            * SUPPRESS

            * Fill all ‘0’ outbound segments from the ‘0’ inbound segments.

            * CONTINUE (SEND will skip any following post-xlate tcl)

            * Clear all ‘0’ outbound segments, just to make sure that no data is left from the first message.

            * Fill all ‘0’ outbound segments from the ‘1’ inbound segments.

            * CONTINUE

            Not sure if in the PV1 segment of both patients the ‘previous location’ is filled, or if you need to deduce these from the current location of the other patient.

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

          • #85006
            Jon Blanchard
            Participant

              1. Using 1(%g1) in the basis has never generated a compile error, nor has it generated any erroneous outcome in actual use.  I contend that there is no difference between 1 and 1(%g1) as a basis, as long as the variable is correct.

              2. The sending system does populate the Prior Patient Location field

              3. I tried your suggestion about excluding the iteration action and performing a straight-line set of actions.  At this writing, I was attempting the same [suppress, iterate {populate, continue} on 1(%g1)] in another xlate on our 5.8 engine, then removed the iterate action and performed a straight line suppress-populate-continue-null out-populate-continue set of actions and the outcome was the same.  I even saved my changes, recompiled the xlate and opened a new testing page, just to be sure that I was testing the most current revision.  The outcome was the same on both 5.8 and 6.1.

              Here is the xlate:

              Code:

              prologue
                 xlt_infile: hl7 2.2 HBOCHI_22B ADT_A17
                 who:        jblanchard
                 date:       July 18, 2017 5:08:52 PM CDT
                 xlt_outfile:        hl7 2.3  ADT_A08
                 type:       xlt
                 version:    7.0
              end_prologue

              { { OP COMMENT }
                 { COMMENT {File: abq_star_to_slink_a17.xlt (”slink” = Nuance ShadowLink)} }
              }
              { { OP COMMENT }
                 { COMMENT {Author: Unknown creator and creation date} }
              }
              { { OP COMMENT }
                 { COMMENT Revisions: }
              }
              { { OP COMMENT }
                 { COMMENT {2017 07 18 jeb: Added actions to convert an A17 to two A08s, for the ShadowLink server} }
              }
              { { OP SUPPRESS } }
              { { OP DATECOPYOPT }
                 { ADDPREC 0 }
                 { FABRICATE 1 }
                 { USECURTM 1 }
                 { RANGE {49 20 19} }
                 { TMDEFS {01 01 00 00 00 0000 +0000} }
                 { DELIMIT {/ :} }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 0(0).MSH }
                 { OUT 0(0).MSH }
              }
              { { OP COPY }
                 { ERR 2 }
                 { IN =ADT^A08 }
                 { OUT {{0(0).MSH(0).#9(0).[0]}} }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 0(0).EVN }
                 { OUT 0(0).EVN }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 1(0).PID }
                 { OUT 0(0).PID }
              }
              { { OP COPY }
                 { REM 1 }
                 { ERR 0 }
                 { IN {{1(0).PID.00106(0).[0]} 0(0).MSH.00004(0)} }
                 { OUT {{0(0).PID.00106(0).[0]}} }
                 { COPYSEP {} }
              }
              { { OP COPY }
                 { REM 1 }
                 { ERR 0 }
                 { IN {{1(0).PID.00121.[0]} 0(0).MSH.00004(0)} }
                 { OUT {{0(0).PID.00121.[0]}} }
                 { COPYSEP {} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(0).[3]}} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(0).[4]}} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00121.[3]}} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00121.[4]}} }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 1(0).PV1 }
                 { OUT 0(0).PV1 }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 1(0).PD1 }
                 { OUT 0(0).PD1 }
              }
              { { OP CONTINUE } }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT 0(0).PID }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT 0(0).PD1 }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT 0(0).PV1 }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 1(1).PID }
                 { OUT 0(0).PID }
              }
              { { OP COPY }
                 { REM 1 }
                 { ERR 0 }
                 { IN {{1(1).PID.00106(0).[0]} 0(0).MSH.00004(0)} }
                 { OUT {{0(0).PID.00106(0).[0]}} }
                 { COPYSEP {} }
              }
              { { OP COPY }
                 { REM 1 }
                 { ERR 0 }
                 { IN {{1(1).PID.00121.[0]} 0(0).MSH.00004(0)} }
                 { OUT {{0(0).PID.00121.[0]}} }
                 { COPYSEP {} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(0).[3]}} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(0).[4]}} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00121.[3]}} }
              }
              { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00121.[4]}} }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 1(1).PV1 }
                 { OUT 0(0).PV1 }
              }
              { { OP PATHCOPY }
                 { ERR 0 }
                 { IN 1(1).PD1 }
                 { OUT 0(0).PD1 }
              }
              { { OP CONTINUE } }

              And here is the outcome:

              Code:

              0(0).MSH(0)  :  >|^~&|ST01|M|PHS|M|20170716120701||ADT^A08|33539542|P|2.2|33539542||AL|A17|20170716120701|||as8987|1||0010635930M~0010635930^^^ST01P^M~00538647^^^ST01^PI||^^^””|””||||3|^^^^^””^P^NM001^NM001||^PRN^PH^^^^^^^^^5~””^ORN^PH^^^””^””^^^^^””~””^ORN^CP^^^””^””^^^^^””~^NET^X.400^|””^WPN^PH^^^””^””^^^^^””|E^ENGLISH^HL70296^E^ENGLISH^99CLAN|||1719300800M||||2^N|””|””|””||N|””|””|N||””||9384^RODRIGUEZ LUGO^MIRTA^M^^^MD^HL70010|1|I|2WM^207^01^M^OCC|1||2WM^209^01^M^^””^””|1303^PEREA^JOSEPH^R^^^MD^HL70010|1303^PEREA^JOSEPH^R^^^MD^HL70010|8473^HERNANDEZ^CAMILLE^””^^^NP^HL70010~12576^TOLIN^KIMBERLY^LYNN^^^CNP^HL70010|MD|||N|7||””|1303^PEREA^JOSEPH^R^^^MD^HL70010|IP||R||||||||||||||||””|||M|O|0|””||201707130127|””|| 20720.00|||””|^~&|ST01|M|PHS|M|20170716120701||ADT^A08|33539542|P|2.2|33539542||AL|A17|20170716120701|||as8987|2|HNE1769756948^^^NE^P|0015038291M~0015038291^^^ST01Q^M~0015038291^^^ST01P^M~00920079^^^ST01^PI||^^””^””|””||||3|^””^^^^USA^P^NM001^NM001||^PRN^PH^^^^^^^^^5~””^ORN^PH^^^””^””^^^^^””~””^ORN^CP^^^””^””^^^^^””~^NET^X.400^|””^WPN^PH^^^””^””^^^^^””|E^ENGLISH^HL70296^E^ENGLISH^99CLAN|||1719600347M||||2^N|””|””|””||N|””|””|N||””||12000^AYALA^SANTIAGO^””^^^MD^HL70010|2|I|2WM^209^01^M^OCC|1||2WM^207^01^M^^””^””|1303^PEREA^JOSEPH^R^^^MD^HL70010|88888^SELF^REFERRED^””^^^MD^HL70010|12576^TOLIN^KIMBERLY^LYNN^^^CNP^HL70010|MD|||N|7||””|1303^PEREA^JOSEPH^R^^^MD^HL70010|IP||R||||||||||||||||””|||M|O|0|””||201707160330|””|| 20720.00|||””<

              Migration Consultant
              Coffee Regional Medical Center
              Eastern Time Zone

            • #85007
              Jon Blanchard
              Participant

                Resolved!

                My thanks to Jim and Robert for their great advice.  There was no problem with either version of my xlate; the Testing Engine simply doesn’t identify the two output messages as Message 1 and Message 2.  If you output the Testing Engine results to a file, they will be two separate and readable messages that can be read into a thread and processed.

                The Infor development lead needs to read The Cat In The Hat…Thing 1 and Thing 2 were uniquely identified in the story, but they weren’t joined at the hip… 😕  

                Time for an Enhancement Request…

                Migration Consultant
                Coffee Regional Medical Center
                Eastern Time Zone

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