Category assignment based on rules

I'm trying to design a solution to automatically assign categories to certain groups of foods, based on a huge set of available rules coming from parameters of these "foods".

Potential issues:

  • Food can comply with more than one rule.
  • Since categories will be customized, there is a high possibility of more than one category complying with one food using different rules.
  • My "desired" category is more important than all the possible others that comply with the same food.