Add a Field Seperator

Clovertech Forums Cloverleaf Add a Field Seperator

  • Creator
    Topic
  • #118989
    Collin Praster
    Participant

      Hello, I might be overthinking this.

      My Practice Management is sending over a first and last name no seperators.

      My EHR wants it LastName^FirstName

      How can I accomplish this in an xlate?

    Viewing 7 reply threads
    • Author
      Replies
      • #118990
        Paul Bishop
        Participant

          I would do it using a tcl code snippit on a copy command.  Source would be your field that has the full name, destination would be the name sub-fields (PID-5.0 and PID-5.1).

          lassign $xlateInvals in_name
          # assuming “<firstname> <lastname>”
          # pull out last name
          set out_pid_5_0 [lindex $in_name end]
          # pull out first name – everything except last position
          set out_pid_5_1 [lrange $in_name 0 end-1]
          set xlateOutVals

            you could get more fancy by checking the list length and pulling out the middle name separately.  Of course, the ideal fix would be to have the source send it to you properly but we all know that isn’t always feasible.

            for some reason the last line isn’t displaying correctly.  you set “xlateOutVals” to a list of both out variables in the order they are in the Destination field.

            • This reply was modified 3 years, 6 months ago by Paul Bishop. Reason: trying to get last line of snippit to display correct.y
            • This reply was modified 3 years, 6 months ago by Paul Bishop.

            Paul Bishop
            Carle Foundation Hospital
            Urbana, IL

          1. #118993
            Anonymous

              in its simplest form, I would probably add a Pre Proc something like this:

              lassign $xlateInVals name_first name_last
              set xlateOutVals [ list $name_last $name_first ]

              …where the Destination fields are PID:5.1, PID:5.2

              of coarse, if they send name_first name_mi name_last on occasion, it will get a little more complicated.

              • #119016
                Collin Praster
                Participant

                  Hi Paul

                  I am still using cloverleaf 5.8, those tcl commands dont work, is there something similar in an older version of TCL?

              • #118995
                Charlie Bursell
                Participant

                  What separates last name from first name?

                  • #118996
                    Collin Praster
                    Participant

                      Its just a free text field so there is no separators

                  • #118998
                    Jim Kosloskey
                    Participant

                      Therein lies a big problem. There is probably a space between first and last name so you could split on space but what if the last name was something like ‘De Jesus’?

                      A name like ‘Ronaldo De Jesus’ would produce 3 elements from a split and you may only be planning for 2 so you would get First = Ronaldo, Last = De.

                      While it may be an issue for the sending system to place the name components properly in the HL/7 field, it may be easier if you ask them to separate the names with a comma then you split on comma.

                      Then something like ‘Ronaldo, De Jesus’ could be split on comma and result in what you want (you might have a leading or trailing space in one of the fields depending on formatting). That should work fine with non-prefixed last names as well.

                      If there can be middle names or initials, using a comma and insisting it be present even for a missing middle will also work.

                      In that case it may be likely the STRING Action Split function will be all you need.

                       

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

                    • #119001
                      Charlie Bursell
                      Participant

                        Post examples of IB field

                      • #119009
                        Charlie Bursell
                        Participant

                          Is there always a space between last first?  Even with that, as Jim said, what if space in last name?  Tell your vendor sending the data that you must have a method to parse the name.  Point out to them they are in line with the HL7 spec which defines last, first, middle in separate subfields.

                        • #119023
                          Charlie Bursell
                          Participant

                            Did you resolve this?

                          • #119073
                            Collin Praster
                            Participant

                              Sorry For the late response yes I have resolved this.

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