From 0a3bf8b862688fc2ce5fdb072f867e8cf4f835e6 Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 30 Oct 2021 11:04:56 -0700 Subject: [PATCH] add 2020 state color tag --- COVID-19 | 2 +- dashboard.json | 1501 ++++++++++++++++++++++++++++++++++++++++-------- ingest3.py | 80 ++- 3 files changed, 1343 insertions(+), 240 deletions(-) diff --git a/COVID-19 b/COVID-19 index 35d7831..012deac 160000 --- a/COVID-19 +++ b/COVID-19 @@ -1 +1 @@ -Subproject commit 35d7831a80508b329a0dc03bac3365ea88db8fbb +Subproject commit 012deac216900dd9c73c133b55e57e79a4617f2d diff --git a/dashboard.json b/dashboard.json index 132d2d1..e77b491 100644 --- a/dashboard.json +++ b/dashboard.json @@ -8,6 +8,12 @@ "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, "type": "dashboard" } ] @@ -15,8 +21,8 @@ "editable": true, "gnetId": null, "graphTooltip": 0, - "id": 2, - "iteration": 1607285795203, + "id": 1, + "iteration": 1635616524374, "links": [], "panels": [ { @@ -27,7 +33,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -35,7 +40,7 @@ "fill": 1, "fillGradient": 0, "gridPos": { - "h": 20, + "h": 10, "w": 12, "x": 0, "y": 0 @@ -58,7 +63,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -132,7 +137,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Cases by State Color", + "title": "Cases by State Color (2016)", "tooltip": { "shared": true, "sort": 0, @@ -177,7 +182,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -208,7 +212,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -327,7 +331,155 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 10 + }, + "hiddenSeries": false, + "id": 25, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color_2020" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Confirmed" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Cases by State Color (2020)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { "links": [] }, "overrides": [] @@ -358,7 +510,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -432,7 +584,156 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Deaths by State Color", + "title": "Deaths by State Color (2016)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 11, + "x": 12, + "y": 20 + }, + "hiddenSeries": false, + "id": 23, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color_2020" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Deaths" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Deaths by State Color (2020)", "tooltip": { "shared": true, "sort": 0, @@ -477,7 +778,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -487,8 +787,8 @@ "gridPos": { "h": 9, "w": 12, - "x": 12, - "y": 20 + "x": 0, + "y": 29 }, "hiddenSeries": false, "id": 7, @@ -508,7 +808,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -582,7 +882,156 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Recovered by State Color", + "title": "Recovered by State Color (2016)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 29 + }, + "hiddenSeries": false, + "id": 24, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color_2020" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Recovered" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Recovered by State Color (2020)", "tooltip": { "shared": true, "sort": 0, @@ -627,7 +1076,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -638,7 +1086,7 @@ "h": 12, "w": 12, "x": 0, - "y": 29 + "y": 38 }, "hiddenSeries": false, "id": 8, @@ -658,7 +1106,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -777,7 +1225,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -788,7 +1235,7 @@ "h": 12, "w": 12, "x": 12, - "y": 29 + "y": 38 }, "hiddenSeries": false, "id": 9, @@ -808,7 +1255,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -927,7 +1374,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -938,7 +1384,7 @@ "h": 18, "w": 24, "x": 0, - "y": 41 + "y": 50 }, "hiddenSeries": false, "id": 5, @@ -959,7 +1405,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1082,7 +1528,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -1093,7 +1538,7 @@ "h": 18, "w": 24, "x": 0, - "y": 59 + "y": 68 }, "hiddenSeries": false, "id": 15, @@ -1114,7 +1559,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1237,7 +1682,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -1248,7 +1692,7 @@ "h": 18, "w": 24, "x": 0, - "y": 77 + "y": 86 }, "hiddenSeries": false, "id": 16, @@ -1269,7 +1713,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1392,7 +1836,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -1403,7 +1846,7 @@ "h": 18, "w": 24, "x": 0, - "y": 95 + "y": 104 }, "hiddenSeries": false, "id": 18, @@ -1424,7 +1867,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1547,7 +1990,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -1558,7 +2000,7 @@ "h": 18, "w": 24, "x": 0, - "y": 113 + "y": 122 }, "hiddenSeries": false, "id": 19, @@ -1579,7 +2021,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1698,7 +2140,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -1709,7 +2150,7 @@ "h": 19, "w": 24, "x": 0, - "y": 131 + "y": 140 }, "hiddenSeries": false, "id": 20, @@ -1729,7 +2170,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1848,7 +2289,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -1859,7 +2299,7 @@ "h": 18, "w": 24, "x": 0, - "y": 150 + "y": 159 }, "hiddenSeries": false, "id": 4, @@ -1879,7 +2319,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -1998,7 +2438,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -2009,7 +2448,7 @@ "h": 20, "w": 12, "x": 0, - "y": 168 + "y": 177 }, "hiddenSeries": false, "id": 12, @@ -2029,7 +2468,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -2103,7 +2542,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Mortality Rate by State Color", + "title": "Mortality Rate by State Color (2016)", "tooltip": { "shared": true, "sort": 0, @@ -2146,10 +2585,8 @@ "dashLength": 10, "dashes": false, "datasource": null, - "description": "", "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -2160,10 +2597,10 @@ "h": 20, "w": 12, "x": 12, - "y": 168 + "y": 177 }, "hiddenSeries": false, - "id": 22, + "id": 26, "legend": { "avg": false, "current": false, @@ -2180,7 +2617,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -2199,7 +2636,7 @@ }, { "params": [ - "color" + "color_2020" ], "type": "tag" }, @@ -2219,7 +2656,7 @@ [ { "params": [ - "Case_Fatality_Ratio" + "Mortality_Rate" ], "type": "field" }, @@ -2254,7 +2691,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "CFR by State Color", + "title": "Mortality Rate by State Color (2020)", "tooltip": { "shared": true, "sort": 0, @@ -2299,7 +2736,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -2310,7 +2746,7 @@ "h": 20, "w": 12, "x": 0, - "y": 188 + "y": 197 }, "hiddenSeries": false, "id": 10, @@ -2330,7 +2766,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -2404,7 +2840,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Testing by State Color", + "title": "Testing by State Color (2016)", "tooltip": { "shared": true, "sort": 0, @@ -2449,7 +2885,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -2460,10 +2895,10 @@ "h": 20, "w": 12, "x": 12, - "y": 188 + "y": 197 }, "hiddenSeries": false, - "id": 11, + "id": 27, "legend": { "avg": false, "current": false, @@ -2480,7 +2915,157 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color_2020" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "People_Tested" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Testing by State Color (2020)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 20, + "w": 12, + "x": 0, + "y": 217 + }, + "hiddenSeries": false, + "id": 22, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -2519,7 +3104,7 @@ [ { "params": [ - "Deaths" + "Case_Fatality_Ratio" ], "type": "field" }, @@ -2554,7 +3139,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Deaths by State Color", + "title": "CFR by State Color (2016)", "tooltip": { "shared": true, "sort": 0, @@ -2597,159 +3182,9 @@ "dashLength": 10, "dashes": false, "datasource": null, + "description": "", "fieldConfig": { "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 20, - "w": 12, - "x": 0, - "y": 208 - }, - "hiddenSeries": false, - "id": 17, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.3.4", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "state" - ], - "type": "tag" - }, - { - "params": [ - "previous" - ], - "type": "fill" - } - ], - "measurement": "covid", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "Testing_Rate" - ], - "type": "field" - }, - { - "params": [], - "type": "last" - } - ] - ], - "tags": [ - { - "key": "color", - "operator": "=~", - "value": "/^$color$/" - }, - { - "condition": "AND", - "key": "state", - "operator": "=~", - "value": "/^$state$/" - }, - { - "condition": "AND", - "key": "iso3", - "operator": "=~", - "value": "/^$iso3$/" - } - ] - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Testing Rate by State", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "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 - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -2760,10 +3195,10 @@ "h": 20, "w": 12, "x": 12, - "y": 208 + "y": 217 }, "hiddenSeries": false, - "id": 21, + "id": 28, "legend": { "avg": false, "current": false, @@ -2780,7 +3215,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -2799,7 +3234,7 @@ }, { "params": [ - "color" + "color_2020" ], "type": "tag" }, @@ -2819,7 +3254,7 @@ [ { "params": [ - "Total_Test_Results" + "Case_Fatality_Ratio" ], "type": "field" }, @@ -2854,7 +3289,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Total Test Results by State Color", + "title": "CFR by State Color (2020)", "tooltip": { "shared": true, "sort": 0, @@ -2899,7 +3334,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -2910,7 +3344,7 @@ "h": 20, "w": 12, "x": 0, - "y": 228 + "y": 237 }, "hiddenSeries": false, "id": 14, @@ -2930,7 +3364,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -3049,7 +3483,6 @@ "datasource": null, "fieldConfig": { "defaults": { - "custom": {}, "links": [] }, "overrides": [] @@ -3060,7 +3493,454 @@ "h": 20, "w": 12, "x": 12, - "y": 228 + "y": 237 + }, + "hiddenSeries": false, + "id": 17, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "state" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Testing_Rate" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Testing Rate by State", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 20, + "w": 12, + "x": 0, + "y": 257 + }, + "hiddenSeries": false, + "id": 21, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Total_Test_Results" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Total Test Results by State Color (2016)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 20, + "w": 12, + "x": 12, + "y": 257 + }, + "hiddenSeries": false, + "id": 29, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color_2020" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Total_Test_Results" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Total Test Results by State Color (2020)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 20, + "w": 12, + "x": 0, + "y": 277 }, "hiddenSeries": false, "id": 13, @@ -3080,7 +3960,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.3.4", + "pluginVersion": "8.1.2", "pointradius": 2, "points": false, "renderer": "flot", @@ -3154,7 +4034,156 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Incident Rate by State Color", + "title": "Incident Rate by State Color (2016)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "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 + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 20, + "w": 12, + "x": 12, + "y": 277 + }, + "hiddenSeries": false, + "id": 30, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "color_2020" + ], + "type": "tag" + }, + { + "params": [ + "previous" + ], + "type": "fill" + } + ], + "measurement": "covid", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "Incident_Rate" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [ + { + "key": "color", + "operator": "=~", + "value": "/^$color$/" + }, + { + "condition": "AND", + "key": "state", + "operator": "=~", + "value": "/^$state$/" + }, + { + "condition": "AND", + "key": "iso3", + "operator": "=~", + "value": "/^$iso3$/" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Incident Rate by State Color (2020)", "tooltip": { "shared": true, "sort": 0, @@ -3193,7 +4222,7 @@ } ], "refresh": false, - "schemaVersion": 26, + "schemaVersion": 30, "style": "dark", "tags": [], "templating": { @@ -3211,6 +4240,7 @@ }, "datasource": "InfluxDB - Covid", "definition": "SHOW TAG VALUES from covid with KEY=state;", + "description": null, "error": null, "hide": 0, "includeAll": true, @@ -3224,7 +4254,6 @@ "skipUrlSync": false, "sort": 0, "tagValuesQuery": "", - "tags": [], "tagsQuery": "", "type": "query", "useTags": false @@ -3242,6 +4271,7 @@ }, "datasource": "InfluxDB - Covid", "definition": "SHOW TAG VALUES from covid with KEY=color;", + "description": null, "error": null, "hide": 0, "includeAll": true, @@ -3255,7 +4285,6 @@ "skipUrlSync": false, "sort": 0, "tagValuesQuery": "", - "tags": [], "tagsQuery": "", "type": "query", "useTags": false @@ -3273,6 +4302,7 @@ }, "datasource": "InfluxDB - Covid", "definition": "SHOW TAG VALUES from covid with KEY=iso3;", + "description": null, "error": null, "hide": 0, "includeAll": true, @@ -3286,7 +4316,6 @@ "skipUrlSync": false, "sort": 0, "tagValuesQuery": "", - "tags": [], "tagsQuery": "", "type": "query", "useTags": false @@ -3294,7 +4323,7 @@ ] }, "time": { - "from": "now-9M", + "from": "now-16M", "to": "now" }, "timepicker": { @@ -3313,6 +4342,6 @@ }, "timezone": "", "title": "Covid Summer 2020", - "uid": "yDE9LL4Mk", - "version": 46 + "uid": "32NK4gVnk", + "version": 2 } \ No newline at end of file diff --git a/ingest3.py b/ingest3.py index 0401ef0..99388df 100644 --- a/ingest3.py +++ b/ingest3.py @@ -30,8 +30,8 @@ row_fields = { 'Country_Region': str, 'Total_Test_Results': f2int, 'Case_Fatality_Ratio': float, - 'Cases_28_Days': int, - 'Deaths_28_Days': int, + 'Cases_28_Days': f2int, + 'Deaths_28_Days': f2int, } # https://www.nytimes.com/elections/2016/results/president @@ -102,11 +102,84 @@ states = { } } +# https://upload.wikimedia.org/wikipedia/commons/4/49/ElectoralCollege2020.svg +states_2020 = { + 'red': { + 'Ohio', + 'Montana', + 'South Dakota', + 'Tennessee', + 'Nebraska', + 'North Dakota', + 'Mississippi', + 'Utah', + 'Alaska', + 'Idaho', + 'Arkansas', + 'Wyoming', + 'Alabama', + 'Indiana', + 'Kentucky', + 'Louisiana', + 'Kansas', + 'Florida', + 'Iowa', + 'Oklahoma', + 'Texas', + 'West Virginia', + 'South Carolina', + 'North Carolina', + }, + 'blue': { + 'Georgia', + 'Pennsylvania', + 'Missouri', + 'Arizona', + 'Wisconsin', + 'Michigan', + 'Minnesota', + 'New Mexico', + 'Oregon', + 'Nevada', + 'New Jersey', + 'Colorado', + 'Washington', + 'New Hampshire', + 'District of Columbia', + 'Maryland', + 'Virginia', + 'California', + 'Hawaii', + 'Massachusetts', + 'New York', + 'Rhode Island', + 'Vermont', + 'Connecticut', + 'Delaware', + 'Illinois', + 'Maine', + }, + 'other': { + 'American Samoa', + 'Guam', + 'Puerto Rico', + 'Diamond Princess', + 'Virgin Islands', + 'Grand Princess', + 'Northern Mariana Islands', + } +} + states_bycolor = {} for color, states in states.items(): for state in states: states_bycolor[state] = color +states_bycolor_2020 = {} +for color, states in states_2020.items(): + for state in states: + states_bycolor_2020[state] = color + def convert(func, inp): if inp == "": @@ -139,7 +212,8 @@ def get_data_for_influx(fpath, assigned_date=None): "tags": { "state": row["Province_State"], "iso3": row["ISO3"], - "color": states_bycolor[row["Province_State"]] + "color": states_bycolor[row["Province_State"]], + "color_2020": states_bycolor_2020[row["Province_State"]] }, "time": assigned_date or row["Last_Update"], "fields": row