Drop the dormant ops (workshop / tickets / dispatch / SLA / odometer) and dwh_gold (nightly ETL aggregates) schemas plus their dependents — features never implemented, no live writer or scheduled refresh. - Prod DB (already applied): DROP SCHEMA ops/dwh_gold CASCADE, plus tracksolid.dispatch_log, v_sla_inflight, v_utilisation_daily. - migrations/12_drop_ops.sql + 13_drop_dwh_gold.sql (forward, all IF EXISTS) registered in run_migrations.py for rebuild durability. - grafana: removed 8 now-broken panels (In-flight SLA, Idle Cost, Utilisation Heatmap, Row 7 Field-Service SLAs) from daily_operations; panel count 21 -> 13. - docs: scrubbed CLAUDE.md, PLATFORM_OVERVIEW.html (-19KB), DATA_FLOW.md; pre-drop seed snapshot in docs/reports/260605_ops_purge_backup.md. The separate tracksolid_dwh server (31.97.44.246:5888) is unrelated and untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1082 lines
26 KiB
JSON
1082 lines
26 KiB
JSON
{
|
||
"title": "Daily Operations — Fleet & Dispatch",
|
||
"uid": "daily-ops",
|
||
"schemaVersion": 39,
|
||
"version": 2,
|
||
"refresh": "1m",
|
||
"time": {
|
||
"from": "now/d",
|
||
"to": "now"
|
||
},
|
||
"timezone": "Africa/Nairobi",
|
||
"timepicker": {
|
||
"refresh_intervals": [
|
||
"30s",
|
||
"1m",
|
||
"5m",
|
||
"15m",
|
||
"30m",
|
||
"1h"
|
||
]
|
||
},
|
||
"editable": false,
|
||
"tags": [
|
||
"fleet",
|
||
"daily",
|
||
"dispatch",
|
||
"ops"
|
||
],
|
||
"fiscalYearStartMonth": 0,
|
||
"graphTooltip": 0,
|
||
"templating": {
|
||
"list": [
|
||
{
|
||
"name": "city",
|
||
"label": "City",
|
||
"type": "query",
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"query": "SELECT DISTINCT COALESCE(assigned_city, city, 'unassigned') AS city FROM tracksolid.devices ORDER BY 1",
|
||
"refresh": 1,
|
||
"multi": true,
|
||
"includeAll": true,
|
||
"allValue": ".*",
|
||
"current": {
|
||
"selected": true,
|
||
"text": "All",
|
||
"value": "$__all"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"panels": [
|
||
{
|
||
"id": 100,
|
||
"type": "stat",
|
||
"title": "Last GPS Fix (fleet)",
|
||
"description": "Most recent live position across all devices. Green < 5 min, amber 5–30 min, red > 30 min.",
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 0,
|
||
"w": 24,
|
||
"h": 3
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"colorMode": "background",
|
||
"graphMode": "none",
|
||
"justifyMode": "auto",
|
||
"orientation": "auto",
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
},
|
||
"textMode": "value_and_name"
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "s",
|
||
"color": {
|
||
"mode": "thresholds"
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "yellow",
|
||
"value": 300
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 1800
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT EXTRACT(EPOCH FROM (NOW() - MAX(gps_time)))::int AS \"Seconds since latest fleet fix\" FROM tracksolid.live_positions;",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 101,
|
||
"type": "row",
|
||
"title": "Row 1 — Today at a Glance",
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 3,
|
||
"w": 24,
|
||
"h": 1
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"id": 110,
|
||
"type": "stat",
|
||
"title": "Vehicles reporting today",
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 4,
|
||
"w": 4,
|
||
"h": 4
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"colorMode": "background",
|
||
"graphMode": "none",
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
},
|
||
"textMode": "auto"
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"color": {
|
||
"mode": "thresholds"
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "red",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "green",
|
||
"value": 1
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT COUNT(*) FILTER (WHERE trips_today > 0) AS \"Reporting today\" FROM tracksolid.v_fleet_today WHERE assigned_city ~ '${city:regex}';",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 111,
|
||
"type": "stat",
|
||
"title": "Fleet km today",
|
||
"gridPos": {
|
||
"x": 4,
|
||
"y": 4,
|
||
"w": 4,
|
||
"h": 4
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"colorMode": "value",
|
||
"graphMode": "area",
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "none",
|
||
"decimals": 1,
|
||
"color": {
|
||
"mode": "fixed",
|
||
"fixedColor": "blue"
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT ROUND(SUM(km_today)::numeric, 1) AS \"Fleet km today\" FROM tracksolid.v_fleet_today WHERE assigned_city ~ '${city:regex}';",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 112,
|
||
"type": "stat",
|
||
"title": "Drive hours today",
|
||
"gridPos": {
|
||
"x": 8,
|
||
"y": 4,
|
||
"w": 4,
|
||
"h": 4
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"colorMode": "value",
|
||
"graphMode": "none",
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "none",
|
||
"decimals": 1,
|
||
"color": {
|
||
"mode": "fixed",
|
||
"fixedColor": "green"
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT ROUND(SUM(drive_hours)::numeric, 1) AS \"Drive h\" FROM tracksolid.v_fleet_today WHERE assigned_city ~ '${city:regex}';",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 113,
|
||
"type": "stat",
|
||
"title": "Idle hours today",
|
||
"description": "Ignition on, speed ~0. Fuel burn with no movement.",
|
||
"gridPos": {
|
||
"x": 12,
|
||
"y": 4,
|
||
"w": 4,
|
||
"h": 4
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"colorMode": "value",
|
||
"graphMode": "none",
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "none",
|
||
"decimals": 1,
|
||
"color": {
|
||
"mode": "thresholds"
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "yellow",
|
||
"value": 10
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 30
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT ROUND(SUM(idle_hours)::numeric, 1) AS \"Idle h\" FROM tracksolid.v_fleet_today WHERE assigned_city ~ '${city:regex}';",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 114,
|
||
"type": "stat",
|
||
"title": "Open alarms (24h)",
|
||
"gridPos": {
|
||
"x": 16,
|
||
"y": 4,
|
||
"w": 4,
|
||
"h": 4
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"colorMode": "background",
|
||
"graphMode": "none",
|
||
"reduceOptions": {
|
||
"calcs": [
|
||
"lastNotNull"
|
||
],
|
||
"fields": "",
|
||
"values": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"color": {
|
||
"mode": "thresholds"
|
||
},
|
||
"thresholds": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "yellow",
|
||
"value": 1
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 10
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT COUNT(*) AS \"Alarms 24h\" FROM tracksolid.alarms WHERE alarm_time > NOW() - INTERVAL '24 hours';",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 120,
|
||
"type": "row",
|
||
"title": "Row 2 — Live Dispatch",
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 8,
|
||
"w": 24,
|
||
"h": 1
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"id": 121,
|
||
"type": "geomap",
|
||
"title": "Active Vehicles Map",
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 9,
|
||
"w": 14,
|
||
"h": 14
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"basemap": {
|
||
"config": {
|
||
"theme": "dark"
|
||
},
|
||
"name": "Basemap",
|
||
"type": "carto"
|
||
},
|
||
"controls": {
|
||
"mouseWheelZoom": true,
|
||
"showAttribution": true,
|
||
"showScale": true,
|
||
"showZoom": true
|
||
},
|
||
"layers": [
|
||
{
|
||
"config": {
|
||
"showLegend": true,
|
||
"style": {
|
||
"color": {
|
||
"field": "status",
|
||
"fixed": "green",
|
||
"mode": "field"
|
||
},
|
||
"opacity": 0.9,
|
||
"rotation": {
|
||
"field": "direction",
|
||
"fixed": 0,
|
||
"max": 360,
|
||
"min": -360,
|
||
"mode": "field"
|
||
},
|
||
"size": {
|
||
"fixed": 14,
|
||
"max": 15,
|
||
"min": 2,
|
||
"mode": "fixed"
|
||
},
|
||
"symbol": {
|
||
"fixed": "img/icons/marker/circle.svg",
|
||
"mode": "fixed"
|
||
}
|
||
}
|
||
},
|
||
"filterData": {
|
||
"id": "byRefId",
|
||
"options": "A"
|
||
},
|
||
"location": {
|
||
"latitude": "lat",
|
||
"longitude": "lng",
|
||
"mode": "coords"
|
||
},
|
||
"name": "Vehicles",
|
||
"tooltip": true,
|
||
"type": "markers"
|
||
}
|
||
],
|
||
"tooltip": {
|
||
"mode": "details"
|
||
},
|
||
"view": {
|
||
"allLayers": true,
|
||
"id": "coords",
|
||
"lat": -3.0,
|
||
"lon": 34.5,
|
||
"zoom": 5.5,
|
||
"minZoom": 5.5,
|
||
"maxZoom": 22
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"color": {
|
||
"mode": "palette-classic-by-name"
|
||
}
|
||
},
|
||
"overrides": [
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "status"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "mappings",
|
||
"value": [
|
||
{
|
||
"type": "value",
|
||
"options": {
|
||
"moving": {
|
||
"color": "green",
|
||
"index": 0,
|
||
"text": "Moving"
|
||
},
|
||
"idle_ignition_on": {
|
||
"color": "yellow",
|
||
"index": 1,
|
||
"text": "Idle (engine on)"
|
||
},
|
||
"parked": {
|
||
"color": "blue",
|
||
"index": 2,
|
||
"text": "Parked"
|
||
},
|
||
"stale": {
|
||
"color": "orange",
|
||
"index": 3,
|
||
"text": "Stale > 10m"
|
||
},
|
||
"never_reported": {
|
||
"color": "red",
|
||
"index": 4,
|
||
"text": "Never reported"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT imei, vehicle_number, driver_name, assigned_city, lat, lng, speed, direction, status, last_fix FROM tracksolid.v_active_dispatch_map WHERE lat IS NOT NULL AND lng IS NOT NULL AND assigned_city ~ '${city:regex}';",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 122,
|
||
"type": "table",
|
||
"title": "Currently Idle (engine on, speed < 2)",
|
||
"gridPos": {
|
||
"x": 14,
|
||
"y": 9,
|
||
"w": 10,
|
||
"h": 7
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"cellHeight": "sm",
|
||
"showHeader": true,
|
||
"footer": {
|
||
"show": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"custom": {
|
||
"align": "auto",
|
||
"filterable": true
|
||
}
|
||
},
|
||
"overrides": [
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "idle_seconds"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "unit",
|
||
"value": "s"
|
||
},
|
||
{
|
||
"id": "displayName",
|
||
"value": "Idle for"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT vehicle_number, driver_name, assigned_city, since, idle_seconds FROM tracksolid.v_currently_idle WHERE assigned_city ~ '${city:regex}' ORDER BY idle_seconds DESC;",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 123,
|
||
"type": "table",
|
||
"title": "Vehicles Not Moved Today",
|
||
"gridPos": {
|
||
"x": 14,
|
||
"y": 16,
|
||
"w": 10,
|
||
"h": 7
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"cellHeight": "sm",
|
||
"showHeader": true,
|
||
"footer": {
|
||
"show": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"custom": {
|
||
"align": "auto",
|
||
"filterable": true
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT vehicle_number, driver_name, assigned_city, last_seen FROM tracksolid.v_vehicles_not_moved_today WHERE assigned_city ~ '${city:regex}' ORDER BY last_seen DESC NULLS LAST;",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 130,
|
||
"type": "row",
|
||
"title": "Row 3 — Daily KPI Table",
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 23,
|
||
"w": 24,
|
||
"h": 1
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"id": 131,
|
||
"type": "table",
|
||
"title": "Per-Vehicle Daily Roll-up",
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 24,
|
||
"w": 24,
|
||
"h": 12
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"cellHeight": "sm",
|
||
"showHeader": true,
|
||
"footer": {
|
||
"show": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"custom": {
|
||
"align": "auto",
|
||
"filterable": true
|
||
}
|
||
},
|
||
"overrides": [
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "km_today"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "unit",
|
||
"value": "none"
|
||
},
|
||
{
|
||
"id": "decimals",
|
||
"value": 1
|
||
},
|
||
{
|
||
"id": "displayName",
|
||
"value": "km today"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "drive_hours"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "unit",
|
||
"value": "none"
|
||
},
|
||
{
|
||
"id": "decimals",
|
||
"value": 1
|
||
},
|
||
{
|
||
"id": "displayName",
|
||
"value": "Drive h"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "idle_hours"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "unit",
|
||
"value": "none"
|
||
},
|
||
{
|
||
"id": "decimals",
|
||
"value": 1
|
||
},
|
||
{
|
||
"id": "displayName",
|
||
"value": "Idle h"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "did_not_move"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "custom.cellOptions",
|
||
"value": {
|
||
"type": "color-background"
|
||
}
|
||
},
|
||
{
|
||
"id": "mappings",
|
||
"value": [
|
||
{
|
||
"type": "value",
|
||
"options": {
|
||
"true": {
|
||
"color": "red",
|
||
"index": 0,
|
||
"text": "No"
|
||
},
|
||
"false": {
|
||
"color": "transparent",
|
||
"index": 1,
|
||
"text": "Yes"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": "displayName",
|
||
"value": "Moved?"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT vehicle_number, driver_name, assigned_city, km_today, trips_today, drive_hours, idle_hours, first_departure, last_return, alarms_today, did_not_move FROM tracksolid.v_fleet_today WHERE enabled_flag = 1 AND assigned_city ~ '${city:regex}' ORDER BY km_today DESC NULLS LAST;",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 140,
|
||
"type": "row",
|
||
"title": "Row 4 — Driver Behaviour Leaderboard (30-day)",
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 36,
|
||
"w": 24,
|
||
"h": 1
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"id": 141,
|
||
"type": "table",
|
||
"title": "Driver Leaderboard",
|
||
"description": "Rolling 30-day aggression index. Red/amber/green per BA-file §3.1–§3.2 thresholds.",
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 37,
|
||
"w": 24,
|
||
"h": 12
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"cellHeight": "sm",
|
||
"showHeader": true,
|
||
"footer": {
|
||
"show": false
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"custom": {
|
||
"align": "auto",
|
||
"filterable": true
|
||
}
|
||
},
|
||
"overrides": [
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "km"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "unit",
|
||
"value": "none"
|
||
},
|
||
{
|
||
"id": "decimals",
|
||
"value": 0
|
||
},
|
||
{
|
||
"id": "displayName",
|
||
"value": "km"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "speeding_per_100km"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "custom.cellOptions",
|
||
"value": {
|
||
"type": "color-background"
|
||
}
|
||
},
|
||
{
|
||
"id": "thresholds",
|
||
"value": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "yellow",
|
||
"value": 1
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 5
|
||
}
|
||
]
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"matcher": {
|
||
"id": "byName",
|
||
"options": "harsh_per_100km"
|
||
},
|
||
"properties": [
|
||
{
|
||
"id": "custom.cellOptions",
|
||
"value": {
|
||
"type": "color-background"
|
||
}
|
||
},
|
||
{
|
||
"id": "thresholds",
|
||
"value": {
|
||
"mode": "absolute",
|
||
"steps": [
|
||
{
|
||
"color": "green",
|
||
"value": null
|
||
},
|
||
{
|
||
"color": "yellow",
|
||
"value": 0.5
|
||
},
|
||
{
|
||
"color": "red",
|
||
"value": 2
|
||
}
|
||
]
|
||
}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT driver_name, vehicle_number, assigned_city, SUM(km)::numeric(10,0) AS km, SUM(events_80) AS events_80, SUM(events_100) AS events_100, SUM(events_120) AS events_120, SUM(harsh_events) AS harsh_events, ROUND(SUM(events_80)::numeric / NULLIF(SUM(km), 0) * 100, 2) AS speeding_per_100km, ROUND(SUM(harsh_events)::numeric / NULLIF(SUM(km), 0) * 100, 2) AS harsh_per_100km FROM tracksolid.v_driver_aggregates_daily WHERE day > CURRENT_DATE - INTERVAL '30 days' AND assigned_city ~ '${city:regex}' GROUP BY driver_name, vehicle_number, assigned_city ORDER BY harsh_per_100km DESC NULLS LAST;",
|
||
"format": "table",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 150,
|
||
"type": "row",
|
||
"title": "Row 5 — Trends",
|
||
"collapsed": false,
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 49,
|
||
"w": 24,
|
||
"h": 1
|
||
},
|
||
"panels": []
|
||
},
|
||
{
|
||
"id": 151,
|
||
"type": "timeseries",
|
||
"title": "Fleet Distance — 7-day (by city)",
|
||
"gridPos": {
|
||
"x": 0,
|
||
"y": 50,
|
||
"w": 12,
|
||
"h": 9
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "none",
|
||
"decimals": 1,
|
||
"custom": {
|
||
"drawStyle": "bars",
|
||
"fillOpacity": 60,
|
||
"lineWidth": 1,
|
||
"axisLabel": "km"
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT day::timestamptz AS time, assigned_city AS metric, km AS value FROM tracksolid.v_fleet_km_daily WHERE day > CURRENT_DATE - INTERVAL '7 days' AND assigned_city ~ '${city:regex}' ORDER BY day;",
|
||
"format": "time_series",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"id": 152,
|
||
"type": "timeseries",
|
||
"title": "Alarm Frequency — 30-day (by type)",
|
||
"gridPos": {
|
||
"x": 12,
|
||
"y": 50,
|
||
"w": 12,
|
||
"h": 9
|
||
},
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"options": {
|
||
"legend": {
|
||
"displayMode": "list",
|
||
"placement": "bottom"
|
||
},
|
||
"tooltip": {
|
||
"mode": "multi"
|
||
}
|
||
},
|
||
"fieldConfig": {
|
||
"defaults": {
|
||
"unit": "short",
|
||
"custom": {
|
||
"drawStyle": "bars",
|
||
"fillOpacity": 60,
|
||
"lineWidth": 1,
|
||
"stacking": {
|
||
"mode": "normal",
|
||
"group": "A"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"targets": [
|
||
{
|
||
"datasource": {
|
||
"type": "postgres",
|
||
"uid": "tracksolid_pg"
|
||
},
|
||
"rawSql": "SELECT day::timestamptz AS time, alarm_name AS metric, alarm_count AS value FROM tracksolid.v_alarms_daily WHERE day > CURRENT_DATE - INTERVAL '30 days' ORDER BY day;",
|
||
"format": "time_series",
|
||
"refId": "A"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|