refactor(categorisation): flatten the category taxonomy to 27 direction-filtered categories - #37
Merged
Merged
Conversation
…on-filtered categories Replace the 75-category, 16-group hierarchy with 27 user-visible categories under three sections: income, investments and spending. The picker filters by the transaction's direction, so an outgoing transaction offers 20 categories and an incoming one offers 10. Colour and icon move from the group to the category, because three sections would otherwise paint all sixteen spending rows one colour. The spending breakdown and the budget-vs-actual chart re-key from group to category for the same reason. Insurance loses its category and folds into the thing being insured. An internal transfer is no longer a category: Transaction.isInternalTransfer already carries it, so a paired leg keeps its pipeline-resolved category. No migration. LEGACY_CATEGORY_SLUGS decodes the stored and prebuilt-artifact labels on read, and every read path resolves an unknown slug instead of casting it.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…question The direction-filtered picker created an invariant no producer enforced: a category the user cannot select on a row must never be written to it. The MCC branch of the deterministic layer skipped the refund guard its sibling branch ran, the dictionary answered the same category for a refund as for a purchase, and the classifier was offered the whole taxonomy whatever the sign. Jev is now asked one direction-filtered question instead of a group question and a leaf question per group. The cascade existed for 75 categories under 16 groups; 27 do not need it, and greedy two-stage search cannot recover from a wrong group. The acceptance bar moves from a product of two picked probabilities to the answer's own confidence, which is the statistic TypeSafe documents for thresholding and which does not move with the size of the option set. Each option carries a rubric rather than a bare label.
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.
Summary
Replaces the 75-category, 16-group hierarchy with 27 categories under three sections —
income,investments,spending. The picker now filters by the transaction's direction: 20 categories on an outgoing transaction, 10 on an incoming one. Start withpackages/api/src/lib/taxonomy.ts; every other change follows from it. No migration: the decoder reads an old slug on the way out.Motivation
salaryon a card payment was the largest single source of wrong picks; direction is already known from the sign.Drawbacks
flights,accommodationandtaxiall becometransport-travel. A reader who used the fine grain loses it.LEGACY_CATEGORY_SLUGS(70 entries) has to stay until adata-*release is rebuilt from the new taxonomy.0.5joint-probability floor was not retuned for that shape.Prior art
20260831120000_category_hierarchydid the opposite move with a SQL remap; this one relies on the read-path decoder instead, so no downgrade is one-way.categoryColorandcategoryIconunchanged.TAXONOMY_VERSIONalready existed for exactly this case and goes to2, invalidating the classification cache.Notes
lookupUserOverrideno longer castsmerchant_override.category; proved against a seeded stale row, and mutation-checked against the raw cast.deterministic.test.tsgainsreadsAsRefunddirection cases and a rule that no word naming a movement names a category;mcc-categories.test.ts,transaction-category.test.tsandjev.test.tsre-grounded on the new slugs.guides/categories,concepts,integrations/procedures,contributing/categorisation,contributing/data-model, plusdocs/engineering/{api,categorisation,data-pipeline}.mdandpackages/api/data/README.md. The data-model migration table was two rows stale and is corrected.