I am trying to create a billing tool for my company. Basically we'll import usage from CSVs provided by suppliers, and then match/apply that usage to monthly/yearly invoices in our billing system. Right now I am specifically trying to figure out the best way to handle matching rules. 90% of this could be handled by just matching client names, but that last 10% is full of annoying edge cases, so rather than trying to add a bunch of different fields for the usage data, I figured creating some "rules" that will be run to choose the relevant lines is probably better.
The data will all be stored in SQLite DB (possibly moved to another service for deployment, depending on what my company wants). See current table here: https://paste.pythondiscord.com/WC6Q. The "problem" I am running into, is that in its current form, I will have to create TONS of rules to make sure I account for everything, because each rule can only take a single input for each category.
I have a couple of thoughts on solving this, but this is the first time I've ever made something like this, and I'm worried I could be overcomplicating it a ton.
- Create another column for each category that would simply store whether to treat it as MATCH or DONT MATCH (IS, IS NOT). EG: If
source_system_typeis set to MATCH then any items with a matching source system will be include. If it is set to DON'T MATCH, then any items that match will not be included. The idea here would be that you would set each category, and this would allow you to exclude a specific usage item (say an item that a specific client gets for free) - Keep the above idea, but allow categories to be lists of items to look for, instead of just a single item. My worry here is that if I ever move away from Python, I now have some weirdly formatted data I have to work around.
(continued in comment)