copy null to entire field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf copy null to entire field

  • Creator
    Topic
  • #49061
    Todd Lundstedt
    Participant

      Cloverleaf 5.3

      Input is HL7 2.4  Output is 2.3

      PID-3 (00106) is repeatable, and contains subfields on both standards.

      Destination system would rather have one, and only one value in the PID-3 field (the medical record number), although their variant documentation allows for what the standard shows.

      Pathcopy has already been completed to populate all the fields.

      Input field:

      Code:

      M000001234^^^^MR^MGI~123-45-6789^^^^SS^MGI~M9876^^^^PI^MGI~MGIV0003456^^^^HUB^MGI

      Desired output field (the MR number prefixed with a literal ‘MC’):

      Code:

      MCM000001234

      Surely there is a way to null out the entire field (all repeats) with a single command, but I am drawing a blank (pun intended  ðŸ˜† )

      Here’s the iterate I used to get it to work, but I don’t like doing all of those individual copy commands:

      Code:

      { { OP ITERATE }
         { BASIS 0(0).PID.00106 }
         { VAR %f1 }
         { TYPE field }
         { BODY {
             { { OP COMMENT }
                 { COMMENT {PACS system prefers only the MR number in PID-3, nothing else.} }
             }
             { { OP COMMENT }
                 { COMMENT {Parse through PID.106 fields, blank out the previous PATHCOPY’d information.} }
             }
             { { OP COMMENT }
                 { COMMENT {Check input subfield 4, if it is MR, prefix subfield 0 with “MC”, and place in PID-3} }
             }
             { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(%f1).[0]}} }
             }
             { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(%f1).[1]}} }
             }
             { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(%f1).[2]}} }
             }
             { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(%f1).[3]}} }
             }
             { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(%f1).[4]}} }
             }
             { { OP COPY }
                 { ERR 0 }
                 { IN @null }
                 { OUT {{0(0).PID.00106(%f1).[5]}} }
             }
             { { OP IF }
                 { ERR 0 }
                 { COND {0(0).PID.00106(%f1).[0] ne @null && 0(0).PID.00106(%f1).[4] eq @tmpmr} }
                 { THENBODY {
                     { { OP COMMENT }
                         { COMMENT {IF PID3.0 is not blank, and PID3.4 is MR, concat MC and PID3.0} }
                     }
                     { { OP COPY }
                         { ERR 0 }
                         { IN {=MC {0(0).PID.00106(%f1).[0]}} }
                         { OUT {{0(0).PID.00106(0).[0]}} }
                         { COPYSEP {} }
                     }
                 }}
                 { ELSEBODY {
                 }}
             }
         }}
      }


      I have tried copying @null to 0(0).PID.00106 prior to the iterate, but all that seems to null out is the first subfield on the first instance of the fields.  That copy looks like:

      Code:

      input:
      M000001234^^^^MR^MGI~123-45-6789^^^^SS^MGI~M9876^^^^PI^MGI~MGIV0003456^^^^HUB^MGI
      output:
      ^^^^MR^MGI~123-45-6789^^^^SS^MGI~M9876^^^^PI^MGI~MGIV0003456^^^^HUB^MGI


      So.. what’s the right way to do this?

      Thanks

      Todd

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

          Todd,

          I think you can do a PATHCOPY Action with @null as the Source and the field specification (field level) as the Destination.

          That nulls out all of the components of a field.

          However, you would still need to iterate throught the field repetitions.

          Jim Kosloskey

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

        • #60592
          Ed Mastascusa
          Participant

            Todd,

            The IN and OUT parts of the COPY will take lists. If you copy a longer list of @nulls, you’ll blank out more than the first subfield.

          • #60593
            Vince Angulo
            Participant

              Todd,

              I’ve done it both ways described by Jim and Ed.

              In this case I’d iterate a pathcopy @null to all repetitions, then after the iterate a lone copy of the 1st compenent of the 1st iteration: PID.0106(0).[0]=>PID.0106(0).[0]

            • #60594
              Todd Lundstedt
              Participant

                That did it.. but I chose the reverse of the last suggestion.

                pathcopy @null to dest PID-3 is the key..

                then iterate thru source PID-3, find MR in 3.5, and concat “MC” and 3.1 to dest 3.1.

                Thanks gang

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