Tracksolid deployment with timescale & grafana with backup
BUG-01 (CRITICAL): dwh_gold.refresh_daily_metrics inserted t.imei (TEXT) into fact_daily_fleet_metrics.vehicle_key (INTEGER REFERENCES dim_vehicles), so the nightly ETL would have raised "invalid input syntax for type integer" on every run. Migration 08 backfills dim_vehicles from tracksolid.devices and rewrites the function to JOIN through dim_vehicles, returning the serial vehicle_key. The function also re-syncs dim_vehicles at the top of each call so newly registered devices appear in the warehouse without manual seeding. BUG-02 (HIGH): sync_driver_audit.py only queried TARGET_ACCOUNT, ignoring the Fireside@HQ and Fireside_MSA sub-accounts. The audit now iterates TARGETS (matching FIX-M19 in ingest_movement_rev.sync_devices), dedupes devices by IMEI, and tolerates per-target failures. BUG-03 (HIGH, diagnostic only): the webhook trip handler stores item["miles"] straight into distance_km. The field name is suspicious and FIX-M16 already proved the polling endpoint mis-documents its units. Added a SQL diagnostic that compares the distribution of stored-km / great-circle-km for push-source vs poll-source trips over 30 days — the ratio test will tell us whether the push value needs a /1.609 (miles), /1000 (metres), or no conversion. The existing calculation is left unchanged until the data confirms the unit; the old FIX-M11 comment is replaced with a BUG-03 pointer to the diagnostic. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| administration | ||
| backup | ||
| db_audit | ||
| docs | ||
| grafana | ||
| n8n-workflows | ||
| tests | ||
| .env | ||
| .gitignore | ||
| .python-version | ||
| 01_BusinessAnalytics.md | ||
| 02_tracksolid_docker_commands.md | ||
| 02_tracksolid_full_schema_rev.sql | ||
| 03_webhook_schema_migration.sql | ||
| 04_bug_fix_migration.sql | ||
| 05_enhancement_migration.sql | ||
| 06_business_analytics_migration.sql | ||
| 07_analytics_views.sql | ||
| 08_fix_etl_vehicle_key.sql | ||
| 260410_baseline_report.md | ||
| 260412_baseline_report.md | ||
| 20260414_FS__Logistics - final_fixed.csv | ||
| CLAUDE.md | ||
| docker-compose.yaml | ||
| Dockerfile | ||
| grafanaDeployment.md | ||
| grafanaOperationalManual.md | ||
| import_drivers_csv.py | ||
| ingest_events_rev.py | ||
| ingest_movement_rev.py | ||
| OPERATIONS_MANUAL.md | ||
| pyproject.toml | ||
| README.md | ||
| run_migrations.py | ||
| run_migrations.sh | ||
| sync_driver_audit.py | ||
| tracksolid_DB_manual.md | ||
| tracksolidApiDocumentation.md | ||
| ts_shared_rev.py | ||
| webhook_receiver_rev.py | ||