Pennywise

1 min read

Add category-group spending comparison

Summary

Added a category-group comparison flow with 3/6/12-month history, period averages, previous-month changes, transaction statistics, monthly-cost share, sortable category contributions, direct group switching, and month-specific transaction drill-downs. Added a snapshot-consistent history API, zero-filled month buckets, current mapping visibility, responsive comparison layouts, documentation, and regression coverage.

Decisions

  • Calculate the period average from exactly the displayed 3, 6, or 12 calendar months, including zero-spend months
  • Apply current category mappings to historical group totals and preserve unrestricted section and transaction-kind matching
  • Use expense cash and credit transactions, excluding income and settlements, as the monthly-cost share denominator
  • Build each history response inside a read-only repeatable-read PostgreSQL transaction so totals, mappings, contributions, and monthly costs share one snapshot
  • Keep comparison on a dedicated page with direct group switching, and open older chart months as transaction drill-downs rather than re-anchoring analytics

Learnings

  • A visible-range period average matched the intended product behavior better than a separate trailing average for every chart month
  • Showing current mappings alongside historical results makes retroactive mapping behavior understandable without versioning category mappings