4 Replies Latest reply on Nov 11, 2016 6:16 PM by Shinichiro Murakami

    Create category for visits who fit in multiple categories

    Joshua Taylor

      I work in health care and we need to categorize historical visits into one of a few categories based on the procedure code(s) the invoice contains.

       

      A single visit visit can fall into multiple categories based on the procedure codes associated with the visit. I need the formula to obey the following categorical hierarchy

       

      1.Urgent care

      2.Physicals

      3.Labs and Diagnostics

      4.Injections, Immunizations, and Vaccines

      5.Transactions only

      6.Other

      7.Misplaced

       

      If it falls in 1, it can't show up in 2-7

      I tried using the following:

      ****************************************************************************************************************************

      IF

           CONTAINS([Procedure Code_visit Categories],"UC")=TRUE

      THEN

          "Urgent Care"

      ELSEIF    

         

         CONTAINS([Procedure Code_visit Categories],"UC")=FALSE and

          CONTAINS([Procedure Code_visit Categories],"Physicals")=TRUE

      THEN

          "Physicals" 

      ****************************************************************************************************************************

      I got the same result for Physicals with or without the bolded red portion of the formula.

        • 1. Re: Create category for visits who fit in multiple categories
          Michael Hesser

          Hi Joshua;

          You're getting the same values because you're  restating your primary Boolean check.

          The logic in red is unnecessary because in order to make it to that check, your Procedure Code must not be "UC". Think of it as saying:

          IF it's an APPLE it's an APPLE

          ELSE if it's NOT an APPLE, and it's an ORANGE, it's an ORANGE.

           

          We don't ever need to check if it's "not an APPLE" because it will only make it to that check if its not an APPLE

           

          Set your code up in the hierarchical order you need (check for Urgent Care first, then Physicals, and so on). That should give you the results you need.

           

          Please note:

          • this works with a concatenated string of your procedure categories associated with a visit. You'll need some extra steps if you have a LIST of proc codes and want to ferret just the most relevant out of them.
          • Be cautious with you short names. I looked over your categories and they seems OK, but if "UC" appeared as part of a lower-tiered (like tummy tUCk), you might flag it incorrectly as Urgent Care.
          • 2. Re: Create category for visits who fit in multiple categories
            Joshua Taylor

            In this case

             

            A visit can be urgent care and a physical.

            Visit A

                            Procedure code: UC, Physical, Transaction Only

             

            If that were the case I want it to only be grouped into Urgent care and be excluded from physicals.

             

            That’s why I felt I needed the statement that says if it’s not “UC” and it’s a “Physical” then it’s a physical.

            • 3. Re: Create category for visits who fit in multiple categories
              Michael Hesser

              Hi Joshua;

              If that is the case, the hierarchical nature of the clause will cause it to stop once it's found a match. You don't need to check if it's not something, providing you're groupin them from most to least important.

               

              Think of it as:

              Does it contain UC? If yes, it's "Urgent Care" and STOP

              Otherwise, does it contain "Physical"? If so, it's "Physical" and STOP

              ...and so on...

               

              If the procedure code is "UC, Physical, Transaction Only", the test for "Physical" will never be made because it stops at "Urgent Care."

               

              You can, of course, include it if you want, but do you really want your seventh check to be:

              NOT "Urgent care" AND NOT  "Physicals" AND NOT "Labs and Diagnostics" AND NOT  "Injections, Immunizations, and Vaccines" AND NOT "Transactions only" AND NOT "Other" AND "Misplaced"?

              • 4. Re: Create category for visits who fit in multiple categories
                Shinichiro Murakami

                Same thing.

                 

                As Michael said, once "Urgent Care" is assigned, no more change for that cell.

                "elseif" only applied the cell which was not defined thru the condition above.

                 

                 

                [Category Final]

                if contains([Ctegory],"Urgent Care") then "UC"

                ELSEIF  contains([Ctegory],"Physical") then "Physicals"

                elseif contains([Ctegory],"Labs") then "Labs"

                elseif contains([Ctegory],"Iniject") then "Injections"

                elseif contains([Ctegory],"Transaction") then "Transaction"

                elseif contains([Ctegory],"Misplaced") then "Misplaced"else "Other"

                end

                 

                But in this case, be careful that there are no same "word" in multiple procedure.

                 

                Thanks,

                Shin