<aside> 🧮
For engineers, analysts, and anyone who needs the exact definition of a metric. This section documents every KPI on the FSP Marketing Dashboard — what it means, the plain-English formula, and the actual SQL/query behind it (source tables, joins, filters, timezone handling, and caching). One page per tab, plus a shared Conventions & Shared Filters page for the rules that apply everywhere.
</aside>
<aside> ⚠️
Keep this in sync with the code. When a query or metric calculation changes in the app (app/services/** calculators/queries, or the app/controllers/api/v1 endpoints), update the matching page here in the same change. Docs that drift from the code are worse than none.
</aside>
Every tab follows the same shape, so read this once and it applies everywhere:
Api::V1::<Tab>Controller whose index action calls a calculator under app/services/<tab>/. A few tabs (Set to Close, Clean Deals) compute inline in the controller.fsp_sql connection) — primarily hubspot_contacts, hubspot_deals, hubspot_form_submissions, ServiceTitan tables (HVAC), NetSuite tables (revenue/costs), and Project Sunrise (Clean Deals). App-owned tables (forecasts, access_grants) live in the primary DB.Rails.cache.fetch(cache_key, expires_in: ...). The Refresh button deletes the key and recomputes. Cache key + expiry are documented per tab.ReportingTimeZone. See the Conventions page.Start with Conventions & Shared Filters (the shared base filters, product scopes, timezone, and caching rules that every other page builds on), then jump to the tab you need.
Funnel — Core Metrics (Solar / Generator)
Funnel — Revenue & Costs + Forecast