Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces merchant normalization and automated categorization functionality to the expense tracker, enabling smarter transaction categorization based on merchant descriptions with fuzzy matching support.
- Adds
MerchantCategoryRepositoryfor persistent storage of merchant-to-category mappings - Implements merchant name normalization and fuzzy matching using
rapidfuzzlibrary - Integrates automatic categorization into transaction editing and bank statement upload workflows
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/test_merchat.py | Comprehensive unit tests for merchant normalization, categorization, and fuzzy lookup functionality |
| tests/core/test_repository.py | Unit tests for MerchantCategoryRepository CRUD operations |
| pyproject.toml | Adds rapidfuzz dependency for fuzzy string matching |
| expense_tracker/utils/merchant.py | New utility module with merchant normalization, categorization logic, and fuzzy matching |
| expense_tracker/gui/main_window.py | Updated to pass both transaction and merchant repositories to dialogs |
| expense_tracker/gui/dialogs/upload.py | Integrates automatic merchant categorization during bank statement uploads |
| expense_tracker/gui/dialogs/edit_expense.py | Adds merchant-category mapping updates when editing transactions |
| expense_tracker/core/repository.py | Implements MerchantCategoryRepository with SQLite storage for merchant-category mappings |
| expense_tracker/core/model.py | Adds MerchantCategory dataclass for merchant-category pairs |
| expense_tracker/app.py | Initializes merchant repository and passes to main window |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces merchant normalization and categorization to the expense tracker, allowing for more accurate and automated assignment of categories to transactions based on merchant descriptions. It adds a new
MerchantCategoryRepositoryfor managing merchant-category mappings in the database, implements normalization and fuzzy matching logic for merchant names, and integrates these features throughout the application, including the transaction editing and bank statement upload workflows. Comprehensive unit tests are also added to ensure correctness of the new logic.Merchant categorization and normalization:
MerchantCategoryRepositorywith methods to set, get, and list merchant-category mappings, and database schema initialization (expense_tracker/core/repository.py).rapidfuzz), and helper functions (expense_tracker/utils/merchant.py).expense_tracker/gui/dialogs/edit_expense.py) [1] [2] [3].expense_tracker/gui/dialogs/upload.py) [1] [2].Application and GUI integration:
expense_tracker/app.py,expense_tracker/gui/main_window.py) [1] [2] [3] [4] [5] [6] [7].Testing and dependencies:
tests/utils/test_merchat.py).MerchantCategoryRepository(tests/core/test_repository.py).rapidfuzzas a dependency for fuzzy matching (pyproject.toml).Data model updates:
MerchantCategorydataclass to represent merchant-category pairs (expense_tracker/core/model.py).These changes together enable smarter, more automated transaction categorization and lay the groundwork for future improvements in merchant management and analytics.