Combine strings with redundant information without losing business logic in Python
I have a business entity called “Groups”. This groups are linked to a PQL-like string called “rule”. This rules are evaluated to check which products from an ecommerce match with the rule, then get added to this group. For example: