tracksolid_timescale_grafan.../grafana/provisioning/dashboards-json/daily_operations_dashboard.json

596 lines
26 KiB
JSON
Raw Normal View History

{
"title": "Daily Operations — Fleet & Dispatch",
"uid": "daily-ops",
"schemaVersion": 39,
"version": 1,
"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 530 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": 115,
"type": "stat",
"title": "In-flight SLA jobs",
"description": "Tickets currently open and dispatched. Empty until ops.tickets flows.",
"gridPos": { "x": 20, "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": { "color": { "mode": "fixed", "fixedColor": "purple" } }
},
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT COUNT(*) AS \"In-flight\" FROM tracksolid.v_sla_inflight WHERE ticket_stage NOT IN ('resolved', 'cancelled');",
"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" }
]
},
{
"id": 160,
"type": "row",
"title": "Row 6 — Efficiency",
"collapsed": false,
"gridPos": { "x": 0, "y": 59, "w": 24, "h": 1 },
"panels": []
},
{
"id": 161,
"type": "stat",
"title": "Idle Cost (month-to-date)",
"description": "Sum of idle hours × 0.8 L/h × 180 KES/L across fleet for this month. Empty until nightly ETL refreshes dwh_gold.",
"gridPos": { "x": 0, "y": 60, "w": 12, "h": 6 },
"datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"options": {
"colorMode": "value", "graphMode": "area", "textMode": "value_and_name",
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }
},
"fieldConfig": {
"defaults": {
"unit": "currencyKES", "decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [
{ "color": "green", "value": null },
{ "color": "yellow", "value": 50000 },
{ "color": "red", "value": 200000 }
] }
}
},
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT ROUND(SUM(total_idle_hours) * 0.8 * 180) AS \"Idle cost KES (MTD)\" FROM tracksolid.v_utilisation_daily WHERE day >= DATE_TRUNC('month', CURRENT_DATE) AND assigned_city ~ '${city:regex}';",
"format": "table", "refId": "A" }
]
},
{
"id": 162,
"type": "heatmap",
"title": "Utilisation Heatmap (30-day)",
"description": "Per-vehicle daily utilisation %. Empty until dwh_gold.fact_daily_fleet_metrics is refreshed by the nightly ETL.",
"gridPos": { "x": 12, "y": 60, "w": 12, "h": 9 },
"datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"options": {
"calculate": false,
"cellGap": 2,
"color": { "mode": "scheme", "scheme": "RdYlGn", "steps": 64 },
"yAxis": { "axisLabel": "Vehicle" }
},
"fieldConfig": { "defaults": { "custom": { "scaleDistribution": { "type": "linear" } } } },
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT day::timestamptz AS time, vehicle_number AS metric, utilisation_pct AS value FROM tracksolid.v_utilisation_daily WHERE day > CURRENT_DATE - INTERVAL '30 days' AND assigned_city ~ '${city:regex}' ORDER BY day;",
"format": "time_series", "refId": "A" }
]
},
{
"id": 170,
"type": "row",
"title": "Row 7 — Field-Service SLAs (data-gated)",
"collapsed": true,
"gridPos": { "x": 0, "y": 69, "w": 24, "h": 1 },
"panels": [
{
"id": 171,
"type": "stat",
"title": "Dispatch SLA (median mins, 24h)",
"gridPos": { "x": 0, "y": 70, "w": 6, "h": 5 },
"datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }
},
"fieldConfig": { "defaults": { "unit": "m", "decimals": 0 } },
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY dispatch_mins) AS \"Dispatch p50 (min)\" FROM tracksolid.v_sla_inflight WHERE created_at > NOW() - INTERVAL '24 hours';",
"format": "table", "refId": "A" }
]
},
{
"id": 172,
"type": "stat",
"title": "En-route SLA (median mins, 24h)",
"gridPos": { "x": 6, "y": 70, "w": 6, "h": 5 },
"datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false } },
"fieldConfig": { "defaults": { "unit": "m", "decimals": 0 } },
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY enroute_mins) AS \"En-route p50 (min)\" FROM tracksolid.v_sla_inflight WHERE created_at > NOW() - INTERVAL '24 hours';",
"format": "table", "refId": "A" }
]
},
{
"id": 173,
"type": "stat",
"title": "On-site SLA (median mins, 24h)",
"gridPos": { "x": 12, "y": 70, "w": 6, "h": 5 },
"datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false } },
"fieldConfig": { "defaults": { "unit": "m", "decimals": 0 } },
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY onsite_mins) AS \"On-site p50 (min)\" FROM tracksolid.v_sla_inflight WHERE created_at > NOW() - INTERVAL '24 hours';",
"format": "table", "refId": "A" }
]
},
{
"id": 174,
"type": "stat",
"title": "Resolution SLA (median mins, 24h)",
"gridPos": { "x": 18, "y": 70, "w": 6, "h": 5 },
"datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false } },
"fieldConfig": { "defaults": { "unit": "m", "decimals": 0 } },
"targets": [
{ "datasource": { "type": "postgres", "uid": "tracksolid_pg" },
"rawSql": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY resolution_mins) AS \"Resolution p50 (min)\" FROM tracksolid.v_sla_inflight WHERE created_at > NOW() - INTERVAL '24 hours';",
"format": "table", "refId": "A" }
]
},
{
"id": 175,
"type": "table",
"title": "At-risk tickets",
"gridPos": { "x": 0, "y": 75, "w": 24, "h": 10 },
"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 ticket_id, customer, priority, ticket_stage, driver_name, created_at, dispatch_mins, enroute_mins, onsite_mins, resolution_mins FROM tracksolid.v_sla_inflight WHERE ticket_stage NOT IN ('resolved', 'cancelled') ORDER BY resolution_mins DESC NULLS LAST LIMIT 50;",
"format": "table", "refId": "A" }
]
}
]
}
]
}