Categorisation Engine — Typed Results & Evidence
Typed Categorisation Results
The categorisation engine now returns typed results for every decision — never a silent null. Every match includes an evidence object explaining why a rule won, and every non-match includes a typed reason explaining why no rule applied.
- Evidence on every decision — the test panel now shows what matched, which operator was used, the normalised input, and how many rules were evaluated.
- Typed Unknown reasons — when no rule matches, the engine explains why: no rules exist, no rules matched, or multiple rules matched with conflicting accounts (ambiguity detection).
- Ambiguity detection — if two rules at the same priority match a transaction but target different accounts, the engine flags the conflict instead of silently picking one. Shown with amber highlighting in the test panel.
- Normalised input visibility — the test panel shows the normalised form of your input (e.g. “TESCO STORES 4532” → “TESCO STORES”), so you can see exactly what the rules engine is matching against.
This is Phase 1 of the Lattice-Scored Total Matching architecture described in the TMADD. The matching logic is unchanged — the same rules match the same transactions. What’s new is that every decision is now typed, explainable, and never silent.
Bug Fixes
- Fixed keyword extraction during import — when categorising transactions in the import preview, rules were being created from raw descriptions (e.g. a rule for “CARD” from “CARD PAYMENT TO SCREWFIX”). Banking prefixes are now correctly stripped before keyword extraction, producing proper merchant-name rules like “SCREWFIX”, “BRITISH GAS”, “COSTA COFFEE”.
- Fixed “apply to similar” matching — categorising one transaction now correctly applies to other transactions from the same merchant, not all transactions with the same banking prefix.
Technical Detail
The categorisation engine’s return type changed from Account | null to a typed CategorisationResult containing outcome, evidence, and reason fields. All callers (test endpoint, transaction suggestions, and import confirmation) have been updated. This is a non-breaking change — existing integrations continue to work with the addition of new response fields.