Add rules to predict account based on regex patterns #360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Account Rules Feature
This implementation adds regex-based account prediction rules to Paisa's import system.
Overview
The new feature provides:
/more/account-rulespredictAccountWithRulesfunction for import templatesHow to Use
1. Create Account Rules
AMAZON.*|AMZ.*)Expenses:Shopping:Online)2. Update Import Templates
Replace
predictAccountwithpredictAccountWithRulesin your import templates:Before:
After:
3. How It Works
predictAccountWithRulesfirst tries to match transaction data against your regex rulesprefixparameter if providedExample Rules
E-commerce
AMAZON.*|AMZ.*→ Account:Expenses:Shopping:OnlineFLIPKART|FKRT.*→ Account:Expenses:Shopping:OnlineTransportation
UBER|LYFT|OLA→ Account:Expenses:Transportation:RideshareMETRO|SUBWAY→ Account:Expenses:Transportation:PublicUtilities
ELECTRIC.*|POWER.*→ Account:Expenses:Utilities:ElectricWATER.*|H2O→ Account:Expenses:Utilities:WaterBanking
ATM.*FEE|WITHDRAWAL.*FEE→ Account:Expenses:Banking:FeesINTEREST.*CREDIT→ Account:Income:Interest:BankTechnical Details
Configuration Storage
Rules are stored in the
paisa.yamlconfiguration file underaccount_rules:API Endpoints
GET /api/account-rules- List all rulesPOST /api/account-rules/upsert- Create/update a rulePOST /api/account-rules/delete- Delete a ruleFunction Signature
Same parameters as
predictAccount, with the added regex matching logic.Benefits
predictAccounttemplates continue to work