Skip to main content

Analytics & Report Formulas

The API computes on-the-fly analytical rollups without storing pre-computed duplicate summaries, ensuring data never falls out of sync.

Analytical Endpoints​

  1. GET /v1/finances/reports/evolution
  2. GET /v1/finances/reports/categories
  3. GET /v1/finances/reports/summary
  4. GET /v1/finances/reports/cashflow

Key Formulas & Semantics​

1. Incurred vs Adjusted Expense​

  • Gross Incurred Minor:
    Gross Incurred = SUM(confirmed expenses amount_minor)
  • Adjusted Original Minor:
    Adjusted Original = MAX(0, Gross Incurred - SUM(allocated confirmed refunds))
    When a refund is recorded in November for a purchase made in October, the adjusted report allocates the refund to October so historical comparisons reflect true net consumption.

2. Net Cashflow​

Tracks real money flow during the selected window:

Net Cashflow = (Incomes + Refunds Collected) - Total Cash Outflows

3. Hierarchical Category Roll-Up​

Categories support self-referential hierarchies (parent_id).

  • When querying GET /v1/finances/reports/categories, parent groups like Auto roll up all child spending (Combustible, Peajes, Seguro) plus any direct expenses assigned directly to Auto:
    Total Auto = Direct Auto + SUM(Child Categories Spent)
  • Child categories maintain their own direct_spent_minor without double counting.

4. Credit Card Settlement vs Incurred Expenses​

  • Purchasing a $300,000 television in 3 installments records one confirmed expense of $300,000 on purchase date.
  • The 3 future installments ($100,000 each) are projected in GET /v1/finances/installments and settled in GET /v1/finances/reports/cashflow on payment due dates.
  • Paying the credit card bill (kind: card_payment) transfers liquidity between accounts and never counts as a second expense.