Tracksolid deployment with timescale & grafana with backup
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>
|
||
|---|---|---|
| .claude | ||
| .forgejo/workflows | ||
| administration | ||
| backup | ||
| data | ||
| db_audit | ||
| docs | ||
| dwh | ||
| grafana | ||
| legacy | ||
| migrations | ||
| n8n-workflows | ||
| scripts | ||
| tests | ||
| .env | ||
| .gitignore | ||
| .python-version | ||
| 55_ts_coolify_gemini_prod.code-workspace | ||
| audit_device_reconciliation.py | ||
| backfill_trips_enrichment.py | ||
| CLAUDE.md | ||
| dashboard_api_rev.py | ||
| docker-compose.yaml | ||
| Dockerfile | ||
| import_drivers_csv.py | ||
| ingest_events_rev.py | ||
| ingest_movement_rev.py | ||
| pyproject.toml | ||
| README.md | ||
| run_migrations.py | ||
| run_migrations.sh | ||
| shell_stations.csv | ||
| shell_stations.geojson | ||
| sync_driver_audit.py | ||
| ts_shared_rev.py | ||
| webhook_receiver_rev.py | ||