Commit Graph

14 Commits

Author SHA1 Message Date
Kavi dd8931c04c Side exercise: DTE factura <-> payment reconciliation view
- scripts/build_reconciliation.py: normalizes the existing SII-RCV cross-
  reference CSV (Muralla/Murallita, 519 DTEs) into web/reconciliation.json
  with per-status / per-company / per-payer summaries.
- web/reconciliation.html: standalone reconciliation view in the money-trace
  aesthetic — KPIs (facturado, asignado, pendiente, IVA), breakdown bars,
  and a searchable/sortable table of every factura with its linked payment,
  who paid, source of funds, and confidence. Reuses logos.js for providers.
- dashboard.html: header link to the reconciliation view.

State: $15.6M facturado · 168 asignado ($6.1M) · 315 pendiente ($9.2M).
2026-06-02 18:08:24 -04:00
Kavi 1c693581ae Add Month / Year / 5-Year granularity toggle to time-series views
- charts.js: monthlyBars + lineChart take an optional labelFn so axis and
  tooltip labels can render period (year / 5-year) keys instead of months.
- dashboard.js: period helpers (periodKey/periodKeys/sumByPeriod) bucket the
  Overview (income vs spending bars + cumulative net line), Spending, and
  Income time-series by the selected granularity. Calendar 5-year buckets
  (2015-2019, 2020-2024, 2025-2029). Choice persists in localStorage.
- dashboard.html: Month/Year/5-Year segmented control in the header.

With 7+ years of backfill, monthly bars hit 108 columns; Year collapses to
9 and 5-Year to 3 readable buckets.
2026-06-02 16:47:37 -04:00
Kavi e4e8f20555 Twemoji category icons as logo fallback
For transactions with no brand match, show the spending category emoji
(Twitter Twemoji SVG via jsDelivr) instead of a bare initial:
  Groceries 🛒  Food 🍔  Fuel   Health 💊  Subscriptions 💻
  Shopping 🛍  Utilities 💡  Cash 🏧  Debt 💳  Wallets 📱  Fees 🏦
Income/transfer rows use flow-type icons (💰 income, 🔁 self-transfer).
Resolution chain: Brandfetch brand logo -> category Twemoji -> coloured
initial. Brand logo onerror also falls back to the category emoji.
Call sites pass {category} (merchants/breakdown) or {flowType} (ledger).
2026-06-02 14:44:20 -04:00
Kavi e0f2252124 Add Brandfetch merchant logos to dashboard
- web/logos.js: high-precision alias map (description regex -> brand domain)
  feeding the Brandfetch logo CDN; only attaches a logo when a merchant
  confidently maps to a known brand, else a coloured-initial fallback.
- Logos rendered in: top-merchants list, category breakdown rows, ledger.
- scripts/resolve-logos.mjs: offline resolver (alias + Brandfetch search) that
  measures coverage and writes merchant-logos.json. Current: 33 brands cover
  ~35% of expense txns (Uber, MercadoPago, Apple, Rappi, Santa Isabel, Copec,
  etc.); the long tail is local businesses with no brand -> fallback.
- Client ID is public (CDN); no secret key in the repo.
2026-06-02 14:41:09 -04:00
Kavi e1eed9e5b4 Fix BancoEstado parser for wrapped-header CuentaRUT layout
The 2024-era CuentaRUT cartola wraps the ABONOS O DEPOSITOS header across
three lines and splits each transaction (docno / description / amount+date)
across multiple lines, so the old same-line header+row detection found 0
transactions. Rewrote row assembly as docno-delimited blocks with tolerant
column detection (ABONOS position recovered from neighbouring lines).

Recovers 12 transactions from the backfill statement; all 2025 statements
parse identically (36/5/36/12/36/29/2/5 unchanged). Backfill now 2375 txns.
2026-06-02 14:23:44 -04:00
Kavi bdda30afa1 Add 2019-2024 backfill ledger (separate) + ?ledger= dashboard param
- parsers/parse_backfill.py: decrypts staging tree, parses Santander /
  Banco de Chile / Tenpo / BancoEstado / CopecPay into a SEPARATE
  web/ledger-backfill.json (2363 txns, 2018-01 to 2024-12, 480 statements)
- web/engine.js: dashboard now honors ?ledger=<file>.json so the backfill
  can be reviewed via dashboard.html?ledger=ledger-backfill.json without
  touching the live ledger.json
- .gitignore: exclude documents/ (decrypted bank PDFs must never be committed)
2026-06-02 07:32:21 -04:00
Kavi 6d09b0673d Show raw descriptions everywhere (match PDF exactly)
Remove cleanDesc() stripping in breakdown accordion, top merchants,
tooltip rows, and Ledger table — descriptions now show verbatim as they
appear in the source PDF so any transaction can be cross-referenced.
2026-06-02 04:31:42 -04:00
Kavi b266542591 Reclassify self-named transactions (VICENTETIRAD) as self_transfer 2026-06-02 04:28:09 -04:00
Kavi fae5af446f Reclassify debt transfers and MACH/Servipag card payments as internal
Debt repayments (TRASPASO A/DE DEUDA, TRASPASO POR CIERRE DE CUENTA) are
payments against an international credit card — the purchases already
happened on that card, only fees/interest are new costs. Reclassify from
expense → card_payment (internal) so they show in Cycles, not Spending.

Same for MACH Comercios→Servipag and PAGO EN SERVIPAG.COM* which are
Rappi card payments routed through Servipag, not utility bills.
2026-06-02 04:23:43 -04:00
Kavi 948736c79a Add category/merchant breakdown accordion to Spending tab 2026-06-02 04:15:18 -04:00
Kavi a2cb7d3700 Import Claude Design dashboard: 12-tab finance terminal
Full handoff from claude.ai/design bundle (4ESEfttPcJJzpoqjJxZozQ):
- dashboard.html: 12-tab shell (Overview, Spending, Income, People,
  Cards, Cycles, Balances, Rhythm, Platforms, Banks, Ledger, Quality)
- engine.js: data normalisation, categorisation, Sankey graph builder
- charts.js: reusable SVG primitives (bars, donuts, heatmaps, multiline)
- dashboard.js + dashboard2.js: all tab renderers
- styles.css + dashboard.css: Space Grotesk / IBM Plex Mono dark terminal
- sankey-view.js + orbit-view.js: Sankey and radial cycle views
- money-trace.html: Sankey / Orbit visualisation shell
- tweaks-panel.jsx: React palette/glow tweaks panel
2026-06-02 03:39:20 -04:00
Kavi 97ca5d6c10 Redesign dashboard: sidebar nav, donut chart, card feed layout 2026-06-02 02:12:34 -04:00
Kavi 822a9b5907 Add dashboard.html and static file serving to server
- web/dashboard.html: overview dashboard with KPI cards, type breakdown
  bars, entity list with accounts, movements table with filters, and a
  slide-in origin/destination tree panel for any movement
- src/server.js: serve web/ as static files (GET /), add CORS headers
  so the dashboard works from file:// too; default route is dashboard.html
2026-06-01 22:38:51 -04:00
Kavi cd5b02a4e3 chore: restore kua-money-trace from Bruno (source was on Bruno, Gal copy was lost) 2026-05-01 03:00:31 -04:00