{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 136,
  "links": [
    {
      "asDropdown": true,
      "icon": "external link",
      "includeVars": false,
      "keepTime": false,
      "tags": [
        "athena"
      ],
      "targetBlank": false,
      "title": "dashboards",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "super-light-green",
                "value": null
              },
              {
                "color": "orange",
                "value": 50
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 13,
          "refId": "A"
        }
      ],
      "title": "Clusters",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "cluster_count"
              ]
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "Microsoft SQL Server"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "light-blue",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 2,
        "y": 0
      },
      "id": 13,
      "options": {
        "colorMode": "background_solid",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "distinctCount"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "dataset": "playgrounddb2",
          "datasource": {
            "type": "mssql",
            "uid": "Microsoft SQL Server"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\r\n   count(distinct cluster) as cluster_count,\r\n   count(distinct deviceid) as deviceid_count, \r\n   count(distinct tripid) as trip_count,\r\n   max(duration) as duration_max, \r\n   min(duration) as duration_min,\r\n   avg(duration) as duration_avg\r\nFROM\r\n     OPENROWSET(\r\n        BULK 'aggregations/tripsummary/*/*/*/*',\r\n        DATA_SOURCE = 'ParquetDataLake',\r\n        FORMAT = 'PARQUET'\r\n    ) AS r\r\nWHERE\r\nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n    and \r\n    $__timeFilter(tripstart)\r\n    and\r\n    cluster in  (${cluster:singlequote})\r\n    and\r\n    deviceid in (${device:singlequote})",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Devices",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "deviceid_count"
              ]
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "light-blue",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 4,
        "y": 0
      },
      "id": 14,
      "options": {
        "colorMode": "background_solid",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "distinctCount"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 13,
          "refId": "A"
        }
      ],
      "title": "Trips",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "trip_count"
              ]
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "#818181",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 6,
        "y": 0
      },
      "id": 22,
      "options": {
        "colorMode": "background_solid",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "distinctCount"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 13,
          "refId": "A"
        }
      ],
      "title": "Trip (MIN)",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "duration_min"
              ]
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "#818181",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 8,
        "y": 0
      },
      "id": 16,
      "options": {
        "colorMode": "background_solid",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "distinctCount"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 13,
          "refId": "A"
        }
      ],
      "title": "Trip (AVG)",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "duration_avg"
              ]
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "#818181",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 10,
        "y": 0
      },
      "id": 20,
      "options": {
        "colorMode": "background_solid",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "distinctCount"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 13,
          "refId": "A"
        }
      ],
      "title": "Trip (MAX)",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "duration_max"
              ]
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "Microsoft SQL Server"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "#818181",
            "mode": "shades"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 2,
        "x": 12,
        "y": 0
      },
      "id": 21,
      "options": {
        "colorMode": "background_solid",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "distinctCount"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "dataset": "playgrounddb2",
          "datasource": {
            "type": "mssql",
            "uid": "Microsoft SQL Server"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\r\n    deviceid,\r\n    SUM(distinct_duration) as duration_total_sum\r\nFROM\r\n    (SELECT \r\n        deviceid, \r\n        MAX(duration) as distinct_duration\r\n     FROM \r\n     OPENROWSET(\r\n        BULK 'aggregations/tripsummary/*/*/*/*',\r\n        DATA_SOURCE = 'ParquetDataLake',\r\n        FORMAT = 'PARQUET'\r\n    ) AS r\r\n     WHERE \r\nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n        AND $__timeFilter(tripstart)\r\n        AND cluster IN (${cluster:singlequote})\r\n        AND deviceid IN (${device:singlequote})\r\n     GROUP BY \r\n        deviceid, tripid\r\n    ) AS distinct_trip_durations\r\nGROUP BY\r\n    deviceid\r\nORDER BY\r\n    duration_total_sum DESC",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Trip (SUM)",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "duration_total_sum"
              ]
            }
          }
        },
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "sum"
            ]
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "Microsoft SQL Server"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "shades"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [
            {
              "options": {
                "18D508A1": {
                  "color": "#3d85c6",
                  "index": 1
                },
                "2A896980": {
                  "color": "#04b393",
                  "index": 0
                },
                "2F6913DB": {
                  "color": "#ff9900",
                  "index": 2
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 10,
        "x": 14,
        "y": 0
      },
      "id": 3,
      "options": {
        "basemap": {
          "config": {},
          "name": "Layer 0",
          "opacity": 0.8,
          "type": "osm-standard"
        },
        "controls": {
          "mouseWheelZoom": true,
          "showAttribution": true,
          "showDebug": false,
          "showMeasure": false,
          "showScale": false,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "showLegend": false,
              "style": {
                "color": {
                  "field": "deviceid",
                  "fixed": "dark-green"
                },
                "opacity": 0.7,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "text": {
                  "field": "tripstart",
                  "fixed": "",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "filterData": {
              "id": "byRefId",
              "options": "A"
            },
            "location": {
              "latitude": "Latitude",
              "longitude": "Longitude",
              "mode": "coords"
            },
            "name": "Layer 1",
            "tooltip": true,
            "type": "markers"
          }
        ],
        "tooltip": {
          "mode": "details"
        },
        "view": {
          "allLayers": true,
          "id": "fit",
          "lastOnly": false,
          "lat": 0,
          "layer": "Layer 1",
          "lon": 0,
          "padding": 30,
          "zoom": 15
        }
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "dataset": "playgrounddb2",
          "datasource": {
            "type": "mssql",
            "uid": "Microsoft SQL Server"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\r\n    tripstart,\r\n    MAX(CASE WHEN Signal = 'Latitude' THEN signalvalue END) as Latitude,\r\n    MAX(CASE WHEN Signal = 'Longitude' THEN signalvalue END) as Longitude,\r\n    deviceid,\r\n    tripid\r\nFROM\r\n         OPENROWSET(\r\n        BULK 'aggregations/tripsummary/*/*/*/*',\r\n        DATA_SOURCE = 'ParquetDataLake',\r\n        FORMAT = 'PARQUET'\r\n    ) AS r\r\nWHERE\r\nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n    AND $__timeFilter(tripstart)\r\n    AND signal IN ('Latitude', 'Longitude')\r\n    and\r\n    cluster in  (${cluster:singlequote})\r\n    and\r\n    deviceid in (${device_focus:singlequote})\r\nGROUP BY\r\n    tripstart,\r\n    deviceid,\r\n    tripid\r\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "TripStart Positions",
      "transformations": [],
      "type": "geomap"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "shades"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "unit": "s"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "2F6913DB"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#ff9900",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "18D508A1"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#3d85c6",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "2A896980"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#04b393",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 0,
        "y": 3
      },
      "id": 7,
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "limit": 10,
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 21,
          "refId": "A"
        }
      ],
      "title": "Trip Duration",
      "transformations": [
        {
          "id": "partitionByValues",
          "options": {
            "fields": [
              "deviceid"
            ]
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/duration_total_sum\\s/",
            "renamePattern": ""
          }
        }
      ],
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "Microsoft SQL Server"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "semi-dark-blue",
            "mode": "fixed"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 6,
        "y": 3
      },
      "id": 8,
      "options": {
        "displayMode": "basic",
        "minVizHeight": 8,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "limit": 10,
          "values": true
        },
        "showUnfilled": true,
        "text": {
          "valueSize": 10
        },
        "valueMode": "text"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "dataset": "playgrounddb2",
          "datasource": {
            "type": "mssql",
            "uid": "Microsoft SQL Server"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT tripid, signalvalue\r\nFROM\r\n(\r\n  SELECT TOP 10 tripid, signalvalue\r\n  FROM\r\n  (\r\n    SELECT tripid, signalvalue\r\n    FROM OPENROWSET(\r\n      BULK 'aggregations/tripsummary/*/*/*/*',\r\n      DATA_SOURCE = 'ParquetDataLake',\r\n      FORMAT = 'PARQUET'\r\n    ) AS r\r\n    WHERE\r\n      CONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n      AND $__timeFilter(tripstart)\r\n      AND cluster IN (${cluster:singlequote})\r\n      AND deviceid IN (${device:singlequote})\r\n      AND signal = '${signal:csv}'\r\n  ) AS sub\r\n  ORDER BY signalvalue DESC\r\n) AS top10\r\n\r\nUNION ALL\r\n\r\nSELECT tripid, signalvalue\r\nFROM\r\n(\r\n  SELECT TOP 10 tripid, signalvalue\r\n  FROM\r\n  (\r\n    SELECT tripid, signalvalue\r\n    FROM OPENROWSET(\r\n      BULK 'aggregations/tripsummary/*/*/*/*',\r\n      DATA_SOURCE = 'ParquetDataLake',\r\n      FORMAT = 'PARQUET'\r\n    ) AS r\r\n    WHERE\r\n      CONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n      AND $__timeFilter(tripstart)\r\n      AND cluster IN (${cluster:singlequote})\r\n      AND deviceid IN (${device:singlequote})\r\n      AND signal = '${signal:csv}'\r\n  ) AS sub\r\n  ORDER BY signalvalue ASC\r\n) AS bottom10\r\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Top 10: ${signal:csv} | ${aggregation:csv}",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "signalvalue"
              }
            ]
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "orange",
            "mode": "fixed"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 10,
        "y": 3
      },
      "id": 19,
      "options": {
        "displayMode": "basic",
        "minVizHeight": 8,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "limit": 10,
          "values": true
        },
        "showUnfilled": true,
        "text": {
          "valueSize": 10
        },
        "valueMode": "text"
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 8,
          "refId": "A"
        }
      ],
      "title": "Bottom 10: ${signal:csv} | ${aggregation:csv}",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "field": "signalvalue"
              }
            ]
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "Microsoft SQL Server"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 3,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "18D508A1"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#3d85c6",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "2F6913DB"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#ff9900",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "2A896980"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "#04b393",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 10,
        "x": 14,
        "y": 9
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "dataset": "playgrounddb2",
          "datasource": {
            "type": "mssql",
            "uid": "Microsoft SQL Server"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\r\n    tripstart,\r\n    signalvalue as val,\r\n    deviceid\r\nFROM\r\n         OPENROWSET(\r\n        BULK 'aggregations/tripsummary/*/*/*/*',\r\n        DATA_SOURCE = 'ParquetDataLake',\r\n        FORMAT = 'PARQUET'\r\n    ) AS r\r\nWHERE\r\nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n  and \r\n  $__timeFilter(tripstart)\r\n  and\r\n  cluster in  (${cluster:singlequote})\r\n  and\r\n  deviceid in (${device_focus:singlequote})\r\n  AND  \r\n  message in (${message:singlequote})\r\n  AND\r\n  signal = ${signal:singlequote}\r\n  and \r\n  aggregation = ${aggregation:singlequote}\r\nORDER BY tripstart\r\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "${signal:csv} | ${aggregation:csv}",
      "transformations": [
        {
          "id": "partitionByValues",
          "options": {
            "fields": [
              "deviceid"
            ]
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "/val\\s/",
            "renamePattern": ""
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "Microsoft SQL Server"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true,
            "inspect": false
          },
          "mappings": [],
          "min": -1,
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 40
              },
              {
                "color": "orange",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "DashboardLink (last)"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "",
                    "url": "${__value.raw}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "TripID"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 222
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Duration (last)"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 223
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge"
                }
              },
              {
                "id": "unit",
                "value": "s"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 14,
        "x": 0,
        "y": 10
      },
      "id": 6,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "duration (last)"
          }
        ]
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "dataset": "playgrounddb2",
          "datasource": {
            "type": "mssql",
            "uid": "Microsoft SQL Server"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\r\n    *,\r\n    'd/uds-ev6/uds-ev6/?var-device=' + LOWER(DeviceId) + \r\n  '&from=' + CAST(CAST(DATEDIFF(SECOND, '1970-01-01', TripStart) AS BIGINT) * 1000 AS VARCHAR(20)) +\r\n    '&to=' + CAST(CAST(DATEDIFF(SECOND, '1970-01-01', TripEnd) AS BIGINT) * 1000 AS VARCHAR(20)) AS DashboardLink\r\nFROM\r\n     OPENROWSET(\r\n        BULK 'aggregations/tripsummary/*/*/*/*',\r\n        DATA_SOURCE = 'ParquetDataLake',\r\n        FORMAT = 'PARQUET'\r\n    ) AS r\r\nWHERE\r\nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\r\n    and \r\n    $__timeFilter(tripstart)\r\n    and\r\n    deviceid in (${device_focus:singlequote})\r\n    AND \r\n    tripid in (${trip:singlequote})\r\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Trip Links",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "DeviceID",
                "Message",
                "Signal",
                "Aggregation",
                "SignalValue",
                "Duration",
                "TripStart",
                "TripEnd",
                "TripID",
                "DashboardLink"
              ]
            }
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "DashboardLink": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Duration": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "TripID": {
                "aggregations": [],
                "operation": "groupby"
              },
              "deviceid": {
                "aggregations": []
              },
              "duration": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "duration_min": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "tripid": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true,
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "DashboardLink"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "",
                    "url": "${__value.raw}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "18D508A1_2022-05-30 05:27:49.416300"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 318
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "tripid\\signal"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 251
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 16
      },
      "id": 4,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "tripid\\signal"
          }
        ]
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 6,
          "refId": "A"
        }
      ],
      "title": "Signal Values by Trip",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "alias": "duration_min",
            "binary": {
              "left": "duration",
              "operator": "/",
              "reducer": "sum",
              "right": "60"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "DeviceID",
                "Message",
                "Signal",
                "Aggregation",
                "SignalValue",
                "TripStart",
                "TripEnd",
                "TripID",
                "DashboardLink"
              ]
            }
          }
        },
        {
          "id": "groupingToMatrix",
          "options": {
            "columnField": "Signal",
            "rowField": "TripID",
            "valueField": "SignalValue"
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true,
            "inspect": false
          },
          "mappings": [
            {
              "options": {
                "2A896980": {
                  "color": "green",
                  "index": 0
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "super-light-green",
                "value": null
              },
              {
                "color": "orange",
                "value": 50
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "duration"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 23
      },
      "id": 23,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "tripid"
          }
        ]
      },
      "pluginVersion": "10.1.5",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 6,
          "refId": "A",
          "withTransforms": false
        }
      ],
      "title": "Trip Summary",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "DashboardLink",
                "DeviceID",
                "Message",
                "Signal",
                "Aggregation",
                "SignalValue",
                "Duration",
                "TripStart",
                "TripEnd",
                "TripID"
              ]
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 38,
  "style": "dark",
  "tags": [
    "synapse"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT\n    CONCAT('(','''',cluster, '|', deviceid, '''',')') AS combined_signal\nFROM\n    OPENROWSET(\n        BULK 'aggregations/tripsummary/*/*/*/*',\n        DATA_SOURCE = 'ParquetDataLake',\n        FORMAT = 'PARQUET'\n    ) AS r\nWHERE \nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\n\nGROUP BY\n    cluster, deviceid",
        "hide": 2,
        "includeAll": true,
        "multi": true,
        "name": "cluster_device",
        "options": [],
        "query": "SELECT\n    CONCAT('(','''',cluster, '|', deviceid, '''',')') AS combined_signal\nFROM\n    OPENROWSET(\n        BULK 'aggregations/tripsummary/*/*/*/*',\n        DATA_SOURCE = 'ParquetDataLake',\n        FORMAT = 'PARQUET'\n    ) AS r\nWHERE \nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\n\nGROUP BY\n    cluster, deviceid",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT * FROM (VALUES ${cluster_device:csv})  AS t(col1);",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "cluster",
        "options": [],
        "query": "SELECT * FROM (VALUES ${cluster_device:csv})  AS t(col1);",
        "refresh": 2,
        "regex": "/^([^|]+)/",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT * FROM (VALUES ${cluster_device:csv})  AS t(col1);",
        "description": "",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "device",
        "options": [],
        "query": "SELECT * FROM (VALUES ${cluster_device:csv})  AS t(col1);",
        "refresh": 2,
        "regex": "/^(?:${cluster:pipe})\\|([^|]+)/",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT\n    CONCAT('(','''',message, '|', signal, '|', aggregation, '''',')') AS combined_signal\nFROM\n      OPENROWSET(\n        BULK 'aggregations/tripsummary/*/*/*/*',\n        DATA_SOURCE = 'ParquetDataLake',\n        FORMAT = 'PARQUET'\n    ) AS r\nWHERE \nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\nGROUP BY\n    message, signal, aggregation\n",
        "hide": 2,
        "includeAll": true,
        "multi": true,
        "name": "message_signal_aggregation",
        "options": [],
        "query": "SELECT\n    CONCAT('(','''',message, '|', signal, '|', aggregation, '''',')') AS combined_signal\nFROM\n      OPENROWSET(\n        BULK 'aggregations/tripsummary/*/*/*/*',\n        DATA_SOURCE = 'ParquetDataLake',\n        FORMAT = 'PARQUET'\n    ) AS r\nWHERE \nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\nGROUP BY\n    message, signal, aggregation\n",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": true
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT * FROM (VALUES ${message_signal_aggregation:csv}) as t(col1);",
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "message",
        "options": [],
        "query": "SELECT * FROM (VALUES ${message_signal_aggregation:csv}) as t(col1);",
        "refresh": 2,
        "regex": "/^([^|]+)/",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": false
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT * FROM (VALUES ${message_signal_aggregation:csv}) as t(col1);",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "signal",
        "options": [],
        "query": "SELECT * FROM (VALUES ${message_signal_aggregation:csv}) as t(col1);",
        "refresh": 2,
        "regex": "/^(?:${message:pipe})\\|([^|]+)/",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": false
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT * FROM (VALUES ${message_signal_aggregation:csv}) as t(col1);",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "aggregation",
        "options": [],
        "query": "SELECT * FROM (VALUES ${message_signal_aggregation:csv}) as t(col1);",
        "refresh": 2,
        "regex": "/^(?:${message:pipe})\\|(?:${signal:pipe})\\|([^|]+)/",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": true
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT * FROM (VALUES (${device:singlequote})) AS t(col1)",
        "description": "",
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "device_focus",
        "options": [],
        "query": "SELECT * FROM (VALUES (${device:singlequote})) AS t(col1)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": false
        },
        "datasource": {
          "type": "mssql",
          "uid": "Microsoft SQL Server"
        },
        "definition": "SELECT TOP 100 tripid\nFROM (\n\nSELECT\n    distinct tripid\nFROM\n     OPENROWSET(\n        BULK 'aggregations/tripsummary/*/*/*/*',\n        DATA_SOURCE = 'ParquetDataLake',\n        FORMAT = 'PARQUET'\n    ) AS r\nWHERE \nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\nand \n    cluster in  (${cluster:singlequote})\n    and\n    deviceid in (${device_focus:singlequote})\n    AND  \n    message in (${message:singlequote})\n    )\nAS distinct_trips;",
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "trip",
        "options": [],
        "query": "SELECT TOP 100 tripid\nFROM (\n\nSELECT\n    distinct tripid\nFROM\n     OPENROWSET(\n        BULK 'aggregations/tripsummary/*/*/*/*',\n        DATA_SOURCE = 'ParquetDataLake',\n        FORMAT = 'PARQUET'\n    ) AS r\nWHERE \nCONCAT(r.filepath(1), '-', r.filepath(2), '-', r.filepath(3)) BETWEEN CONVERT(date, $__timeFrom()) AND CONVERT(date, $__timeTo())\nand \n    cluster in  (${cluster:singlequote})\n    and\n    deviceid in (${device_focus:singlequote})\n    AND  \n    message in (${message:singlequote})\n    )\nAS distinct_trips;",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-90d",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "trip-summary-synapse",
  "uid": "trip-summary-synapse",
  "version": 8,
  "weekStart": ""
}