Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created February 13, 2017 22:55
Show Gist options
  • Save pimeys/e3a99763aea756f8712abd5dbe19ebdf to your computer and use it in GitHub Desktop.
Save pimeys/e3a99763aea756f8712abd5dbe19ebdf to your computer and use it in GitHub Desktop.
a diabetes dashboard for grafana+xdrip plus
{
"__inputs": [
{
"name": "DS_DIABETES",
"label": "Diabetes",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.1.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "mtanda-histogram-panel",
"name": "Histogram",
"version": "0.1.6"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 2,
"hideControls": false,
"id": null,
"links": [],
"refresh": "1m",
"rows": [
{
"collapse": false,
"height": "400px",
"panels": [
{
"alert": {
"conditions": [
{
"evaluator": {
"params": [
4,
10
],
"type": "outside_range"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 2,
"model": {
"alias": "mmo/l",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"interval": "1m",
"measurement": "glucose",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_mmol"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
"params": [
"A",
"30m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "keep_state",
"frequency": "30m",
"handler": 1,
"message": "Dangerous sugar level!",
"name": "Glucose alert",
"noDataState": "keep_state",
"notifications": []
},
"aliasColors": {
"glucose.mean": "#EAB839",
"mmo/l": "#F4D598",
"xdrip.mean": "#6ED0E0"
},
"bars": false,
"datasource": "${DS_DIABETES}",
"decimals": 1,
"fill": 2,
"height": "",
"id": 1,
"interval": "1m",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"minSpan": null,
"nullPointMode": "connected",
"percentage": false,
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "measurements",
"yaxis": 1
},
{
"alias": "glucose.mean",
"yaxis": 1
}
],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "mmo/l",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"interval": "1m",
"measurement": "glucose",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_mmol"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "lt",
"value": 4
},
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 10
}
],
"timeFrom": null,
"timeShift": null,
"title": "Glucose",
"tooltip": {
"shared": false,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": [
"total"
]
},
"yaxes": [
{
"format": "none",
"label": "",
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": 250,
"panels": [
{
"alert": {
"conditions": [
{
"evaluator": {
"params": [
-0.8,
0.8
],
"type": "outside_range"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 2,
"model": {
"alias": "Δ mmol/l",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"interval": "1m",
"measurement": "glucose",
"policy": "default",
"query": "SELECT derivative(mean(\"value_mmol\"), 5m) FROM \"glucose\" WHERE $timeFilter GROUP BY time($interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_mmol"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"5m"
],
"type": "derivative"
}
]
],
"tags": []
},
"params": [
"A",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "keep_state",
"frequency": "5m",
"handler": 1,
"name": "Delta alert",
"noDataState": "keep_state",
"notifications": []
},
"aliasColors": {
"glucose delta": "#BA43A9",
"Δ mmol/l": "#BA43A9"
},
"bars": false,
"datasource": "${DS_DIABETES}",
"decimals": 2,
"fill": 2,
"id": 2,
"interval": "1m",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [],
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "Δ mmol/l",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"interval": "1m",
"measurement": "glucose",
"policy": "default",
"query": "SELECT derivative(mean(\"value_mmol\"), 5m) FROM \"glucose\" WHERE $timeFilter GROUP BY time($interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_mmol"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"5m"
],
"type": "derivative"
}
]
],
"tags": []
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "lt",
"value": -0.8
},
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 0.8
}
],
"timeFrom": null,
"timeShift": null,
"title": "Delta",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {
"glucose": "#E5A8E2",
"glucose.mean": "#C15C17"
},
"bars": false,
"bucketMode": "size",
"bucketSize": "1",
"datasource": "${DS_DIABETES}",
"decimals": 1,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 3,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": false,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"maxValue": "",
"minValue": "",
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "glucose",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "glucose",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_mmol"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Histogram",
"tooltip": {
"msResolution": false,
"ordering": "alphabetical",
"shared": true,
"value_type": "cumulative"
},
"type": "mtanda-histogram-panel",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(36, 176, 40, 0.89)",
"rgb(174, 149, 38)",
"rgba(240, 71, 71, 0.86)"
],
"datasource": "${DS_DIABETES}",
"decimals": 1,
"format": "none",
"gauge": {
"maxValue": 10,
"minValue": 0,
"show": true,
"thresholdLabels": true,
"thresholdMarkers": true
},
"id": 4,
"interval": "120d",
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "%",
"postfixFontSize": "30%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 4,
"sparkline": {
"fillColor": "rgba(230, 0, 255, 0.39)",
"full": false,
"lineColor": "rgb(193, 31, 177)",
"show": false
},
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "glucose",
"policy": "default",
"query": "SELECT ((2.59 + mean(\"value_mmol\")) / 1.59) FROM \"glucose\" WHERE time <= now() group by time($interval)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_mmol"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 1.59"
],
"type": "math"
}
]
],
"tags": []
}
],
"thresholds": "7,8.5,10",
"title": "HbA1c",
"type": "singlestat",
"valueFontSize": "50%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-12h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "browser",
"title": "Diabetes",
"version": 52
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment