tracksolid_timescale_grafan.../docs
david kiania 6cf0905b31 feat(dashboard_api): FleetOps analytics endpoints + fuel view (Phase 3)
Adds the read-only /analytics/* surface the FleetOps SPA will consume, plus
the migration that backs the fuel roll-up. All endpoints SELECT the indexed
reporting.* / tracksolid.v_* views and never write, so the forthcoming staging
instance can serve them against the prod DB as grafana_ro.

dashboard_api_rev.py:
  - GET /analytics/fleet-summary     per-vehicle + per-cost-centre roll-up
  - GET /analytics/utilisation       per-vehicle utilisation + daily fleet trend
  - GET /analytics/driver-behaviour  per-driver speeding / harsh index
  - GET /analytics/fuel              actual vs estimated litres (data-gated flags)
  - GET /analytics/filters           dropdown options (alias of GET /webhook/fleet-dashboard)
  - responses run through jsonable_encoder (Decimal->float, date->ISO)
  - VTRIPS_REFRESH_INTERVAL_S<=0 now DISABLES the v_trips refresher, so a
    read-only staging instance never attempts REFRESH (prod still owns it).

migrations/17_fleetops_fuel_view.sql:
  - reporting.v_fuel_daily encapsulates the v_trips->devices join (so the
    read-only role needs SELECT only on the view) and grants it to grafana_ro.

Registered 17 in run_migrations.py. Note: live migration head is 16, not 13
as CLAUDE.md implies. Endpoints are unit-compilable but untested live until
the staging bridge (Phase 1) exists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 12:12:00 +03:00
..
briefings docs: add FleetNow stakeholder briefings (directors + heads of department) 2026-06-08 15:42:37 +03:00
manuals chore(repo): reorganize tree into migrations/ data/ legacy/ docs/ 2026-06-01 02:27:30 +03:00
reference chore(repo): reorganize tree into migrations/ data/ legacy/ docs/ 2026-06-01 02:27:30 +03:00
reports docs+tooling: OSM POI export workflow + Shell stations data; graded DQ report 2026-06-08 22:04:49 +03:00
superpowers feat(dwh): bronze pipeline migrations, runbook, and execution manual 2026-04-25 01:07:53 +03:00
CONNECTIONS.md Add CLAUDE.md and project docs for structured Claude project 2026-04-12 20:59:15 +03:00
DATA_FLOW.md chore(db): purge unused ops + dwh_gold schemas 2026-06-05 18:11:03 +03:00
DWH_PIPELINE.md feat(dwh): bronze pipeline migrations, runbook, and execution manual 2026-04-25 01:07:53 +03:00
KPI_FRAMEWORK.md Add CLAUDE.md and project docs for structured Claude project 2026-04-12 20:59:15 +03:00
OSM_POI_EXPORT.md docs+tooling: OSM POI export workflow + Shell stations data; graded DQ report 2026-06-08 22:04:49 +03:00
PLATFORM_OVERVIEW.html chore(db): purge unused ops + dwh_gold schemas 2026-06-05 18:11:03 +03:00
PROJECT_CONTEXT.md Add CLAUDE.md and project docs for structured Claude project 2026-04-12 20:59:15 +03:00
STAGING_FLEETOPS_ARCHITECTURE.md feat(dashboard_api): FleetOps analytics endpoints + fuel view (Phase 3) 2026-06-10 12:12:00 +03:00