Fetch and store actual backend / user categories in config.yaml#14
Merged
Fetch and store actual backend / user categories in config.yaml#14
Conversation
Simplify category system by fetching actual categories from Monarch/YNAB APIs and storing them in config.yaml, eliminating the need for complex category transformation logic. New functions in categories.py: - convert_api_categories_to_groups() - Convert API format to simple dict - save_categories_to_config() - Save fetched categories to config.yaml - Updated get_effective_category_groups() - Load from fetched_categories first Changes to data_manager.py: - fetch_all_data() now saves categories to config.yaml on every startup for Monarch and YNAB backends - Demo and Amazon backends skip saving (use built-in defaults) New category priority order: 1. Monarch/YNAB: Fetch from API → Save to config.yaml → Use on this and future runs 2. Amazon: Use config.yaml if exists (from previous Monarch/YNAB run), else defaults 3. Demo: Always use built-in defaults Benefits: - Categories always match the backend's actual structure - No manual configuration needed - Amazon mode inherits categories from user's finance platform - Simpler, more maintainable code The old merge/transform logic remains for backward compatibility with existing tests but is no longer used in production code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Completely rewrite categories.md to reflect the new simplified category system that automatically fetches from backends. Key changes: - Remove complex manual customization instructions - Explain automatic category fetching from Monarch/YNAB - Document how categories flow to Amazon mode - Simplify troubleshooting section - Move manual customization to "Advanced" section (rarely needed) The documentation now accurately reflects that: - Monarch/YNAB users don't need to configure categories - Categories are automatically synced on every startup - Amazon mode inherits categories from finance platform - Demo mode uses built-in defaults 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add CLI command to audit transaction categories against config.yaml to identify data quality issues and category mismatches. Features: - Compares categories in cached transactions vs config.yaml - Reports categories in data but not in config (unknown) - Reports categories in config but not in data (unused) - Shows transaction counts for each unknown category - Provides actionable recommendations Usage: moneyflow categories audit Output includes: - Summary statistics (total transactions, unique categories) - List of unknown categories with transaction counts - List of unused categories (first 10) - Recommendations for fixing mismatches Requires --cache flag to be used at least once to have data to audit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fix 3 test failures caused by new fetched_categories behavior: Test fixes: - test_categories.py: Update test to use fetched_categories format instead of old merge behavior - conftest.py: Isolate tests with tmp_path config_dir to avoid using ~/.moneyflow/config.yaml during tests - mock_backend.py: Fix group name from "Transportation" to "Auto & Transport" to match built-in defaults - test_amazon_orders_importer.py: Use isolated config directory Code style: - Run ruff format on categories.py, data_manager.py, cli.py - Fix f-string linter warnings in cli.py (removed unnecessary f-strings) All 895 tests now pass ✅ All ruff checks pass ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Deploying moneyflow with
|
| Latest commit: |
1d7b4e0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ada413e1.moneyflow-6wi.pages.dev |
| Branch Preview URL: | https://default-category-configs.moneyflow-6wi.pages.dev |
Owner
Author
|
@blackary if you have a chance to sanity check whether this works properly for YNAB, I would appreciate it! |
Contributor
|
Yup, it works for me! |
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 overhauls the category configuration to sync actual categories from the backend so that changes in Monarch or YNAB will be picked up on application load, and it isn't necessary to manually edit config.yaml. If you use Amazon or Demo mode, it will use the "built-in" (Monarch-aligned) categories just to have something that works out of the box.