diff --git a/notebooks/process/standardize_datasets.ipynb b/notebooks/process/standardize_datasets.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..5cf76d3079d488168d8c34dcf4d93339f437f599 --- /dev/null +++ b/notebooks/process/standardize_datasets.ipynb @@ -0,0 +1,201 @@ +{ + "nbformat": 4, + "nbformat_minor": 2, + "metadata": { + "language_info": { + "name": "python", + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "version": "3.7.7-final" + }, + "orig_nbformat": 2, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "npconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": 3, + "kernelspec": { + "name": "python37764bitvenvvenv814492364d964019a25eb1cf3dc3e99c", + "display_name": "Python 3.7.7 64-bit ('.venv': venv)" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Standardizing the various Covid-19 datasets\n", + "\n", + "This notebook demonstrates the use and usefulness of pulling data from various datasets together in one place. A lot of information gets lost when numbers are compared across entities that are too large. For example, we have excellent data available for Italy broken down by region (and even province). We also have data for Switzerland per Canton. These datasets, however, each have their own schemas and peculiarities - some work is therefore needed upfront to be able to treat them equally. \n", + "\n", + "We have implemented a set of \"converters\" to standardize the various datasets to a subset of useful fields. Each converter is aware of the details of each dataset and produces a view of the dataset that is homogenized with the others. In this way, we are able to visualize with simple commands data of very different origins using very simple procedures. " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "from pathlib import Path\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "from covid_19_dashboard import helper, plotting\n", + "from covid_19_dashboard.converters import CaseConverter" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# read in cantonal data and produce one dataframe\n", + "df_list = []\n", + "\n", + "for f in Path('../../data/openzh-covid-19').glob('COVID19_Fallzahlen_Kanton_*total.csv'):\n", + " df_list.append(pd.read_csv(f))\n", + "\n", + "df_ch = pd.concat(df_list)\n", + "\n", + "df_ch['date'] = pd.to_datetime(df_ch['date'], dayfirst=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "df_ita = pd.read_csv('../../data/covid-19-italy/dpc-covid19-ita-regioni.csv')" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "df_all = pd.DataFrame()\n", + "for df in [df_ch, df_ita]:\n", + " df_all = df_all.append(CaseConverter.convert(df))\n", + "df_all['date'] = pd.to_datetime(df_all.date)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": " date country region_iso region_label tested \\\n0 2020-02-28 00:00:00 CHE CH-AG Aargau NaN \n1 2020-03-02 00:00:00 CHE CH-AG Aargau NaN \n2 2020-03-03 00:00:00 CHE CH-AG Aargau NaN \n3 2020-03-04 00:00:00 CHE CH-AG Aargau NaN \n4 2020-03-05 00:00:00 CHE CH-AG Aargau NaN \n.. ... ... ... ... ... \n715 2020-03-26 17:00:00 ITA IT-32 Trentino-South Tyrol 12344.0 \n716 2020-03-27 17:00:00 ITA IT-32 Trentino-South Tyrol 13443.0 \n717 2020-03-28 17:00:00 ITA IT-32 Trentino-South Tyrol 14729.0 \n718 2020-03-29 17:00:00 ITA IT-32 Trentino-South Tyrol 16087.0 \n719 2020-03-30 17:00:00 ITA IT-32 Trentino-South Tyrol 17017.0 \n\n positive deceased population positive_100k deceased_100k \n0 1.0 NaN 678207 0.147448 NaN \n1 2.0 NaN 678207 0.294895 NaN \n2 6.0 NaN 678207 0.884686 NaN \n3 7.0 NaN 678207 1.032133 NaN \n4 9.0 NaN 678207 1.327028 NaN \n.. ... ... ... ... ... \n715 2203.0 134.0 1072276 205.450835 12.496783 \n716 2394.0 162.0 1072276 223.263414 15.108051 \n717 2614.0 184.0 1072276 243.780519 17.159761 \n718 2808.0 193.0 1072276 261.872876 17.999097 \n719 3007.0 221.0 1072276 280.431531 20.610365 \n\n[1209 rows x 10 columns]", + "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>date</th>\n <th>country</th>\n <th>region_iso</th>\n <th>region_label</th>\n <th>tested</th>\n <th>positive</th>\n <th>deceased</th>\n <th>population</th>\n <th>positive_100k</th>\n <th>deceased_100k</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>2020-02-28 00:00:00</td>\n <td>CHE</td>\n <td>CH-AG</td>\n <td>Aargau</td>\n <td>NaN</td>\n <td>1.0</td>\n <td>NaN</td>\n <td>678207</td>\n <td>0.147448</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2020-03-02 00:00:00</td>\n <td>CHE</td>\n <td>CH-AG</td>\n <td>Aargau</td>\n <td>NaN</td>\n <td>2.0</td>\n <td>NaN</td>\n <td>678207</td>\n <td>0.294895</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2020-03-03 00:00:00</td>\n <td>CHE</td>\n <td>CH-AG</td>\n <td>Aargau</td>\n <td>NaN</td>\n <td>6.0</td>\n <td>NaN</td>\n <td>678207</td>\n <td>0.884686</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>3</th>\n <td>2020-03-04 00:00:00</td>\n <td>CHE</td>\n <td>CH-AG</td>\n <td>Aargau</td>\n <td>NaN</td>\n <td>7.0</td>\n <td>NaN</td>\n <td>678207</td>\n <td>1.032133</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>4</th>\n <td>2020-03-05 00:00:00</td>\n <td>CHE</td>\n <td>CH-AG</td>\n <td>Aargau</td>\n <td>NaN</td>\n <td>9.0</td>\n <td>NaN</td>\n <td>678207</td>\n <td>1.327028</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>715</th>\n <td>2020-03-26 17:00:00</td>\n <td>ITA</td>\n <td>IT-32</td>\n <td>Trentino-South Tyrol</td>\n <td>12344.0</td>\n <td>2203.0</td>\n <td>134.0</td>\n <td>1072276</td>\n <td>205.450835</td>\n <td>12.496783</td>\n </tr>\n <tr>\n <th>716</th>\n <td>2020-03-27 17:00:00</td>\n <td>ITA</td>\n <td>IT-32</td>\n <td>Trentino-South Tyrol</td>\n <td>13443.0</td>\n <td>2394.0</td>\n <td>162.0</td>\n <td>1072276</td>\n <td>223.263414</td>\n <td>15.108051</td>\n </tr>\n <tr>\n <th>717</th>\n <td>2020-03-28 17:00:00</td>\n <td>ITA</td>\n <td>IT-32</td>\n <td>Trentino-South Tyrol</td>\n <td>14729.0</td>\n <td>2614.0</td>\n <td>184.0</td>\n <td>1072276</td>\n <td>243.780519</td>\n <td>17.159761</td>\n </tr>\n <tr>\n <th>718</th>\n <td>2020-03-29 17:00:00</td>\n <td>ITA</td>\n <td>IT-32</td>\n <td>Trentino-South Tyrol</td>\n <td>16087.0</td>\n <td>2808.0</td>\n <td>193.0</td>\n <td>1072276</td>\n <td>261.872876</td>\n <td>17.999097</td>\n </tr>\n <tr>\n <th>719</th>\n <td>2020-03-30 17:00:00</td>\n <td>ITA</td>\n <td>IT-32</td>\n <td>Trentino-South Tyrol</td>\n <td>17017.0</td>\n <td>3007.0</td>\n <td>221.0</td>\n <td>1072276</td>\n <td>280.431531</td>\n <td>20.610365</td>\n </tr>\n </tbody>\n</table>\n<p>1209 rows × 10 columns</p>\n</div>" + }, + "metadata": {}, + "execution_count": 6 + } + ], + "source": [ + "\n", + "df_all" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": "\n<div id=\"altair-viz-23bf70386a8f467b90d0bdc6233d3002\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n const outputDiv = document.getElementById(\"altair-viz-23bf70386a8f467b90d0bdc6233d3002\");\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-d9a8597c2ba106f4c8cbc64ce5e7759d\"}, \"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"region_label\"}, \"x\": {\"type\": \"temporal\", \"field\": \"date\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"positive\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-d9a8597c2ba106f4c8cbc64ce5e7759d\": [{\"date\": \"2020-02-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 0.2830111251673303, \"deceased_100k\": null}, {\"date\": \"2020-02-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-02-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-02-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-02-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-01T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-02T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 2.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 0.5660222503346606, \"deceased_100k\": null}, {\"date\": \"2020-03-03T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 4.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 1.1320445006693212, \"deceased_100k\": null}, {\"date\": \"2020-03-04T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 5.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 1.4150556258366518, \"deceased_100k\": null}, {\"date\": \"2020-03-05T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-06T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-07T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-08T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-09T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-10T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": 1.0, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": 0.2830111251673303}, {\"date\": \"2020-03-11T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": null, \"deceased\": null, \"population\": 353343, \"positive_100k\": null, \"deceased_100k\": null}, {\"date\": \"2020-03-12T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 180.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 50.94200253011947, \"deceased_100k\": null}, {\"date\": \"2020-03-13T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 258.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 73.01687029317122, \"deceased_100k\": null}, {\"date\": \"2020-03-14T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 265.0, \"deceased\": 3.0, \"population\": 353343, \"positive_100k\": 74.99794816934254, \"deceased_100k\": 0.849033375501991}, {\"date\": \"2020-03-15T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 291.0, \"deceased\": 6.0, \"population\": 353343, \"positive_100k\": 82.35623742369313, \"deceased_100k\": 1.698066751003982}, {\"date\": \"2020-03-16T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 330.0, \"deceased\": 8.0, \"population\": 353343, \"positive_100k\": 93.39367130521902, \"deceased_100k\": 2.2640890013386423}, {\"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 422.0, \"deceased\": 10.0, \"population\": 353343, \"positive_100k\": 119.43069482061341, \"deceased_100k\": 2.8301112516733036}, {\"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 511.0, \"deceased\": 14.0, \"population\": 353343, \"positive_100k\": 144.6186849605058, \"deceased_100k\": 3.9621557523426247}, {\"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 638.0, \"deceased\": 15.0, \"population\": 353343, \"positive_100k\": 180.56109785675676, \"deceased_100k\": 4.245166877509955}, {\"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 834.0, \"deceased\": 22.0, \"population\": 353343, \"positive_100k\": 236.0312783895535, \"deceased_100k\": 6.226244753681267}, {\"date\": \"2020-03-21T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 918.0, \"deceased\": 28.0, \"population\": 353343, \"positive_100k\": 259.8042129036092, \"deceased_100k\": 7.9243115046852495}, {\"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 939.0, \"deceased\": 37.0, \"population\": 353343, \"positive_100k\": 265.74744653212315, \"deceased_100k\": 10.471411631191222}, {\"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1165.0, \"deceased\": 48.0, \"population\": 353343, \"positive_100k\": 329.70796081993984, \"deceased_100k\": 13.584534008031856}, {\"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1211.0, \"deceased\": 53.0, \"population\": 353343, \"positive_100k\": 342.726472577637, \"deceased_100k\": 14.999589633868506}, {\"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1354.0, \"deceased\": 60.0, \"population\": 353343, \"positive_100k\": 383.19706347656523, \"deceased_100k\": 16.98066751003982}, {\"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1401.0, \"deceased\": 67.0, \"population\": 353343, \"positive_100k\": 396.49858635942974, \"deceased_100k\": 18.961745386211135}, {\"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1688.0, \"deceased\": 76.0, \"population\": 353343, \"positive_100k\": 477.72277928245364, \"deceased_100k\": 21.508845512717105}, {\"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1727.0, \"deceased\": 87.0, \"population\": 353343, \"positive_100k\": 488.7602131639795, \"deceased_100k\": 24.621967889557737}, {\"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1837.0, \"deceased\": 93.0, \"population\": 353343, \"positive_100k\": 519.8914369323858, \"deceased_100k\": 26.32003464056172}, {\"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1962.0, \"deceased\": 105.0, \"population\": 353343, \"positive_100k\": 555.2678275783021, \"deceased_100k\": 29.716168142569686}, {\"date\": \"2020-02-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 0.06574760284240036, \"deceased_100k\": null}, {\"date\": \"2020-02-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 2.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 0.13149520568480072, \"deceased_100k\": null}, {\"date\": \"2020-03-02T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 2.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 0.13149520568480072, \"deceased_100k\": null}, {\"date\": \"2020-03-03T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": 400.0, \"positive\": 9.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 0.5917284255816032, \"deceased_100k\": null}, {\"date\": \"2020-03-05T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 19.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 1.2492044540056069, \"deceased_100k\": null}, {\"date\": \"2020-03-06T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 26.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 1.7094376739024095, \"deceased_100k\": null}, {\"date\": \"2020-03-07T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 30.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 1.9724280852720109, \"deceased_100k\": null}, {\"date\": \"2020-03-08T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 37.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 2.4326613051688137, \"deceased_100k\": null}, {\"date\": \"2020-03-09T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": 855.0, \"positive\": 40.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 2.6299041136960146, \"deceased_100k\": null}, {\"date\": \"2020-03-10T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 49.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 3.2216325392776177, \"deceased_100k\": null}, {\"date\": \"2020-03-11T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 59.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 3.8791085677016217, \"deceased_100k\": null}, {\"date\": \"2020-03-12T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 92.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 6.048779461500834, \"deceased_100k\": null}, {\"date\": \"2020-03-13T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 140.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 9.204664397936051, \"deceased_100k\": null}, {\"date\": \"2020-03-16T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 270.0, \"deceased\": 1.0, \"population\": 1520968, \"positive_100k\": 17.7518527674481, \"deceased_100k\": 0.06574760284240036}, {\"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 294.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 19.329795235665706, \"deceased_100k\": null}, {\"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 424.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 27.876983605177756, \"deceased_100k\": null}, {\"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 526.0, \"deceased\": 3.0, \"population\": 1520968, \"positive_100k\": 34.58323909510259, \"deceased_100k\": 0.1972428085272011}, {\"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 773.0, \"deceased\": 3.0, \"population\": 1520968, \"positive_100k\": 50.822896997175484, \"deceased_100k\": 0.1972428085272011}, {\"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1068.0, \"deceased\": 5.0, \"population\": 1520968, \"positive_100k\": 70.2184398356836, \"deceased_100k\": 0.32873801421200183}, {\"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1211.0, \"deceased\": 5.0, \"population\": 1520968, \"positive_100k\": 79.62034704214685, \"deceased_100k\": 0.32873801421200183}, {\"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1363.0, \"deceased\": 7.0, \"population\": 1520968, \"positive_100k\": 89.6139826741917, \"deceased_100k\": 0.4602332198968026}, {\"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1476.0, \"deceased\": 9.0, \"population\": 1520968, \"positive_100k\": 97.04346179538294, \"deceased_100k\": 0.5917284255816032}, {\"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1578.0, \"deceased\": 11.0, \"population\": 1520968, \"positive_100k\": 103.74971728530778, \"deceased_100k\": 0.723223631266404}, {\"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1720.0, \"deceased\": 15.0, \"population\": 1520968, \"positive_100k\": 113.08587688892862, \"deceased_100k\": 0.9862140426360054}, {\"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1758.0, \"deceased\": 15.0, \"population\": 1520968, \"positive_100k\": 115.58428579693985, \"deceased_100k\": 0.9862140426360054}, {\"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1874.0, \"deceased\": 21.0, \"population\": 1520968, \"positive_100k\": 123.2110077266583, \"deceased_100k\": 1.3806996596904075}, {\"date\": \"2020-02-24T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 1463.0, \"positive\": 172.0, \"deceased\": 6.0, \"population\": 10067494, \"positive_100k\": 1.7084688602744638, \"deceased_100k\": 0.05959775093980687}, {\"date\": \"2020-02-25T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3700.0, \"positive\": 240.0, \"deceased\": 9.0, \"population\": 10067494, \"positive_100k\": 2.383910037592275, \"deceased_100k\": 0.0893966264097103}, {\"date\": \"2020-02-26T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3208.0, \"positive\": 258.0, \"deceased\": 9.0, \"population\": 10067494, \"positive_100k\": 2.562703290411695, \"deceased_100k\": 0.0893966264097103}, {\"date\": \"2020-02-27T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3320.0, \"positive\": 403.0, \"deceased\": 14.0, \"population\": 10067494, \"positive_100k\": 4.002982271457028, \"deceased_100k\": 0.13906141885954934}, {\"date\": \"2020-02-28T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 4835.0, \"positive\": 531.0, \"deceased\": 17.0, \"population\": 10067494, \"positive_100k\": 5.274400958172907, \"deceased_100k\": 0.1688602943294528}, {\"date\": \"2020-02-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 5723.0, \"positive\": 615.0, \"deceased\": 23.0, \"population\": 10067494, \"positive_100k\": 6.108769471330204, \"deceased_100k\": 0.22845804526925967}, {\"date\": \"2020-03-01T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 6879.0, \"positive\": 984.0, \"deceased\": 24.0, \"population\": 10067494, \"positive_100k\": 9.774031154128325, \"deceased_100k\": 0.23839100375922748}, {\"date\": \"2020-03-02T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 7925.0, \"positive\": 1254.0, \"deceased\": 38.0, \"population\": 10067494, \"positive_100k\": 12.455929946419635, \"deceased_100k\": 0.3774524226187768}, {\"date\": \"2020-03-03T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 9577.0, \"positive\": 1520.0, \"deceased\": 55.0, \"population\": 10067494, \"positive_100k\": 15.098096904751074, \"deceased_100k\": 0.5463127169482296}, {\"date\": \"2020-03-04T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 12138.0, \"positive\": 1820.0, \"deceased\": 73.0, \"population\": 10067494, \"positive_100k\": 18.07798445174142, \"deceased_100k\": 0.7251059697676502}, {\"date\": \"2020-03-05T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 12354.0, \"positive\": 2251.0, \"deceased\": 98.0, \"population\": 10067494, \"positive_100k\": 22.359089560917543, \"deceased_100k\": 0.9734299320168456}, {\"date\": \"2020-03-06T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 13556.0, \"positive\": 2612.0, \"deceased\": 135.0, \"population\": 10067494, \"positive_100k\": 25.94488757579592, \"deceased_100k\": 1.3409493961456544}, {\"date\": \"2020-03-07T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 15778.0, \"positive\": 3420.0, \"deceased\": 154.0, \"population\": 10067494, \"positive_100k\": 33.97071803568991, \"deceased_100k\": 1.5296756074550428}, {\"date\": \"2020-03-08T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 18534.0, \"positive\": 4189.0, \"deceased\": 267.0, \"population\": 10067494, \"positive_100k\": 41.609163114475166, \"deceased_100k\": 2.6520999168214057}, {\"date\": \"2020-03-09T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 20135.0, \"positive\": 5469.0, \"deceased\": 333.0, \"population\": 10067494, \"positive_100k\": 54.32334998163396, \"deceased_100k\": 3.307675177159281}, {\"date\": \"2020-03-10T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 21479.0, \"positive\": 5791.0, \"deceased\": 468.0, \"population\": 10067494, \"positive_100k\": 57.5217626154036, \"deceased_100k\": 4.648624573304936}, {\"date\": \"2020-03-11T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 25629.0, \"positive\": 7280.0, \"deceased\": 617.0, \"population\": 10067494, \"positive_100k\": 72.31193780696567, \"deceased_100k\": 6.12863538831014}, {\"date\": \"2020-03-12T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 29534.0, \"positive\": 8725.0, \"deceased\": 744.0, \"population\": 10067494, \"positive_100k\": 86.66506282496914, \"deceased_100k\": 7.390121116536052}, {\"date\": \"2020-03-13T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 32700.0, \"positive\": 9820.0, \"deceased\": 890.0, \"population\": 10067494, \"positive_100k\": 97.5416523714839, \"deceased_100k\": 8.840333056071351}, {\"date\": \"2020-03-14T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 37138.0, \"positive\": 11685.0, \"deceased\": 966.0, \"population\": 10067494, \"positive_100k\": 116.06661995527388, \"deceased_100k\": 9.595237901308906}, {\"date\": \"2020-03-15T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 40369.0, \"positive\": 13272.0, \"deceased\": 1218.0, \"population\": 10067494, \"positive_100k\": 131.83022507885278, \"deceased_100k\": 12.098343440780795}, {\"date\": \"2020-03-16T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 43565.0, \"positive\": 14649.0, \"deceased\": 1420.0, \"population\": 10067494, \"positive_100k\": 145.50790891953847, \"deceased_100k\": 14.104801055754292}, {\"date\": \"2020-03-17T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 46449.0, \"positive\": 16220.0, \"deceased\": 1640.0, \"population\": 10067494, \"positive_100k\": 161.1125867072779, \"deceased_100k\": 16.29005192354721}, {\"date\": \"2020-03-18T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 48983.0, \"positive\": 17713.0, \"deceased\": 1959.0, \"population\": 10067494, \"positive_100k\": 175.94249373279982, \"deceased_100k\": 19.45866568184694}, {\"date\": \"2020-03-19T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 52244.0, \"positive\": 19884.0, \"deceased\": 2168.0, \"population\": 10067494, \"positive_100k\": 197.50694661451996, \"deceased_100k\": 21.534654006250214}, {\"date\": \"2020-03-20T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 57174.0, \"positive\": 22264.0, \"deceased\": 2549.0, \"population\": 10067494, \"positive_100k\": 221.14738782064336, \"deceased_100k\": 25.319111190927952}, {\"date\": \"2020-03-21T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 66730.0, \"positive\": 25515.0, \"deceased\": 3095.0, \"population\": 10067494, \"positive_100k\": 253.43943587152873, \"deceased_100k\": 30.742506526450377}, {\"date\": \"2020-03-22T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 70598.0, \"positive\": 27206.0, \"deceased\": 3456.0, \"population\": 10067494, \"positive_100k\": 270.23606867806427, \"deceased_100k\": 34.328304541328755}, {\"date\": \"2020-03-23T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 73242.0, \"positive\": 28761.0, \"deceased\": 3776.0, \"population\": 10067494, \"positive_100k\": 285.6818191299642, \"deceased_100k\": 37.50685125811846}, {\"date\": \"2020-03-24T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 76695.0, \"positive\": 30703.0, \"deceased\": 4178.0, \"population\": 10067494, \"positive_100k\": 304.9716245174817, \"deceased_100k\": 41.49990057108552}, {\"date\": \"2020-03-25T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 81666.0, \"positive\": 32346.0, \"deceased\": 4474.0, \"population\": 10067494, \"positive_100k\": 321.2914753164988, \"deceased_100k\": 44.44005628411599}, {\"date\": \"2020-03-26T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 87713.0, \"positive\": 34889.0, \"deceased\": 4861.0, \"population\": 10067494, \"positive_100k\": 346.55098875648696, \"deceased_100k\": 48.28411121973353}, {\"date\": \"2020-03-27T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 95860.0, \"positive\": 37298.0, \"deceased\": 5402.0, \"population\": 10067494, \"positive_100k\": 370.47948575881946, \"deceased_100k\": 53.657841762806115}, {\"date\": \"2020-03-28T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 102503.0, \"positive\": 39415.0, \"deceased\": 5944.0, \"population\": 10067494, \"positive_100k\": 391.5075588820813, \"deceased_100k\": 59.041505264368666}, {\"date\": \"2020-03-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 107398.0, \"positive\": 41007.0, \"deceased\": 6360.0, \"population\": 10067494, \"positive_100k\": 407.32082879810997, \"deceased_100k\": 63.17361599619528}, {\"date\": \"2020-03-30T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 111057.0, \"positive\": 42161.0, \"deceased\": 6818.0, \"population\": 10067494, \"positive_100k\": 418.7834628955329, \"deceased_100k\": 67.72291098460053}, {\"date\": \"2020-02-24T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 2200.0, \"positive\": 33.0, \"deceased\": 1.0, \"population\": 4926818, \"positive_100k\": 0.6698035121248644, \"deceased_100k\": 0.02029707612499589}, {\"date\": \"2020-02-25T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 3780.0, \"positive\": 43.0, \"deceased\": 1.0, \"population\": 4926818, \"positive_100k\": 0.8727742733748233, \"deceased_100k\": 0.02029707612499589}, {\"date\": \"2020-02-26T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 4900.0, \"positive\": 71.0, \"deceased\": 2.0, \"population\": 4926818, \"positive_100k\": 1.4410924048747082, \"deceased_100k\": 0.04059415224999178}, {\"date\": \"2020-02-27T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 6164.0, \"positive\": 111.0, \"deceased\": 2.0, \"population\": 4926818, \"positive_100k\": 2.2529754498745436, \"deceased_100k\": 0.04059415224999178}, {\"date\": \"2020-02-28T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 7414.0, \"positive\": 151.0, \"deceased\": 2.0, \"population\": 4926818, \"positive_100k\": 3.06485849487438, \"deceased_100k\": 0.04059415224999178}, {\"date\": \"2020-02-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 8659.0, \"positive\": 191.0, \"deceased\": 2.0, \"population\": 4926818, \"positive_100k\": 3.8767415398742147, \"deceased_100k\": 0.04059415224999178}, {\"date\": \"2020-03-01T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 9056.0, \"positive\": 263.0, \"deceased\": 2.0, \"population\": 4926818, \"positive_100k\": 5.338131020873919, \"deceased_100k\": 0.04059415224999178}, {\"date\": \"2020-03-02T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 9782.0, \"positive\": 273.0, \"deceased\": 2.0, \"population\": 4926818, \"positive_100k\": 5.541101782123878, \"deceased_100k\": 0.04059415224999178}, {\"date\": \"2020-03-03T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 10176.0, \"positive\": 307.0, \"deceased\": 3.0, \"population\": 4926818, \"positive_100k\": 6.2312023703737385, \"deceased_100k\": 0.060891228374987665}, {\"date\": \"2020-03-04T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 10515.0, \"positive\": 360.0, \"deceased\": 6.0, \"population\": 4926818, \"positive_100k\": 7.306947404998521, \"deceased_100k\": 0.12178245674997533}, {\"date\": \"2020-03-05T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 11949.0, \"positive\": 407.0, \"deceased\": 10.0, \"population\": 4926818, \"positive_100k\": 8.260909982873327, \"deceased_100k\": 0.2029707612499589}, {\"date\": \"2020-03-06T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 13023.0, \"positive\": 488.0, \"deceased\": 12.0, \"population\": 4926818, \"positive_100k\": 9.904973148997994, \"deceased_100k\": 0.24356491349995066}, {\"date\": \"2020-03-07T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 14429.0, \"positive\": 543.0, \"deceased\": 13.0, \"population\": 4926818, \"positive_100k\": 11.021312335872768, \"deceased_100k\": 0.26386198962494656}, {\"date\": \"2020-03-08T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 15918.0, \"positive\": 670.0, \"deceased\": 18.0, \"population\": 4926818, \"positive_100k\": 13.599041003747246, \"deceased_100k\": 0.36534737024992603}, {\"date\": \"2020-03-09T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 15956.0, \"positive\": 744.0, \"deceased\": 20.0, \"population\": 4926818, \"positive_100k\": 15.101024636996941, \"deceased_100k\": 0.4059415224999178}, {\"date\": \"2020-03-10T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 16643.0, \"positive\": 856.0, \"deceased\": 26.0, \"population\": 4926818, \"positive_100k\": 17.37429716299648, \"deceased_100k\": 0.5277239792498931}, {\"date\": \"2020-03-11T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 21400.0, \"positive\": 1023.0, \"deceased\": 29.0, \"population\": 4926818, \"positive_100k\": 20.763908875870793, \"deceased_100k\": 0.5886152076248808}, {\"date\": \"2020-03-12T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 23438.0, \"positive\": 1384.0, \"deceased\": 32.0, \"population\": 4926818, \"positive_100k\": 28.09115335699431, \"deceased_100k\": 0.6495064359998685}, {\"date\": \"2020-03-13T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 25691.0, \"positive\": 1595.0, \"deceased\": 42.0, \"population\": 4926818, \"positive_100k\": 32.373836419368445, \"deceased_100k\": 0.8524771972498274}, {\"date\": \"2020-03-14T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 26980.0, \"positive\": 1937.0, \"deceased\": 55.0, \"population\": 4926818, \"positive_100k\": 39.31543645411704, \"deceased_100k\": 1.1163391868747738}, {\"date\": \"2020-03-15T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 32546.0, \"positive\": 2172.0, \"deceased\": 63.0, \"population\": 4926818, \"positive_100k\": 44.08524934349107, \"deceased_100k\": 1.278715795874741}, {\"date\": \"2020-03-16T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 35052.0, \"positive\": 2473.0, \"deceased\": 69.0, \"population\": 4926818, \"positive_100k\": 50.19466925711484, \"deceased_100k\": 1.4004982526247163}, {\"date\": \"2020-03-17T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 35478.0, \"positive\": 2704.0, \"deceased\": 80.0, \"population\": 4926818, \"positive_100k\": 54.88329384198889, \"deceased_100k\": 1.623766089999671}, {\"date\": \"2020-03-18T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 40841.0, \"positive\": 3214.0, \"deceased\": 94.0, \"population\": 4926818, \"positive_100k\": 65.2348026657368, \"deceased_100k\": 1.9079251557496135}, {\"date\": \"2020-03-19T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 44658.0, \"positive\": 3484.0, \"deceased\": 115.0, \"population\": 4926818, \"positive_100k\": 70.71501321948567, \"deceased_100k\": 2.3341637543745275}, {\"date\": \"2020-03-20T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 49288.0, \"positive\": 4031.0, \"deceased\": 131.0, \"population\": 4926818, \"positive_100k\": 81.81751385985844, \"deceased_100k\": 2.6589169723744615}, {\"date\": \"2020-03-21T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 53642.0, \"positive\": 4617.0, \"deceased\": 146.0, \"population\": 4926818, \"positive_100k\": 93.71160046910603, \"deceased_100k\": 2.9633731142494}, {\"date\": \"2020-03-22T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 57671.0, \"positive\": 5122.0, \"deceased\": 169.0, \"population\": 4926818, \"positive_100k\": 103.96162391222894, \"deceased_100k\": 3.4302058651243055}, {\"date\": \"2020-03-23T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 61115.0, \"positive\": 5505.0, \"deceased\": 192.0, \"population\": 4926818, \"positive_100k\": 111.73540406810237, \"deceased_100k\": 3.8970386159992105}, {\"date\": \"2020-03-24T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 66178.0, \"positive\": 5948.0, \"deceased\": 216.0, \"population\": 4926818, \"positive_100k\": 120.72700879147554, \"deceased_100k\": 4.384168442999112}, {\"date\": \"2020-03-25T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 70877.0, \"positive\": 6442.0, \"deceased\": 258.0, \"population\": 4926818, \"positive_100k\": 130.75376439722353, \"deceased_100k\": 5.236645640248939}, {\"date\": \"2020-03-26T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 79759.0, \"positive\": 6935.0, \"deceased\": 287.0, \"population\": 4926818, \"positive_100k\": 140.7602229268465, \"deceased_100k\": 5.82526084787382}, {\"date\": \"2020-03-27T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 83627.0, \"positive\": 7497.0, \"deceased\": 313.0, \"population\": 4926818, \"positive_100k\": 152.1671797090942, \"deceased_100k\": 6.352984827123715}, {\"date\": \"2020-03-28T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 89380.0, \"positive\": 7930.0, \"deceased\": 362.0, \"population\": 4926818, \"positive_100k\": 160.9558136712174, \"deceased_100k\": 7.347541557248513}, {\"date\": \"2020-03-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 94784.0, \"positive\": 8358.0, \"deceased\": 392.0, \"population\": 4926818, \"positive_100k\": 169.64296225271565, \"deceased_100k\": 7.956453840998389}, {\"date\": \"2020-03-30T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-34\", \"region_label\": \"Veneto\", \"tested\": 99941.0, \"positive\": 8724.0, \"deceased\": 413.0, \"population\": 4926818, \"positive_100k\": 177.07169211446413, \"deceased_100k\": 8.382692439623304}]}}, {\"mode\": \"vega-lite\"});\n</script>", + "text/plain": "alt.Chart(...)" + }, + "metadata": {}, + "execution_count": 7 + } + ], + "source": [ + "base = alt.Chart(df_all[df_all.region_label.isin(['Lombardy', 'Veneto', 'Ticino', 'Zürich'])])\n", + "base.mark_line().encode(x='date', y='positive', color='region_label')" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": "\n<div id=\"altair-viz-387edbbd841b4ef49c8f6ed464aea2ec\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n const outputDiv = document.getElementById(\"altair-viz-387edbbd841b4ef49c8f6ed464aea2ec\");\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"hconcat\": [{\"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"region_label\", \"legend\": {\"title\": \"Region\"}}, \"opacity\": {\"condition\": {\"value\": 1, \"selection\": \"selector012\"}, \"value\": 0.2}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"region_label\", \"title\": \"Region\"}, {\"type\": \"quantitative\", \"field\": \"positive\", \"title\": \"Cases\"}, {\"type\": \"temporal\", \"field\": \"date\", \"title\": \"Date\"}], \"x\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Days since 100th case\"}, \"field\": \"sinceDay0\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Cases\"}, \"field\": \"positive\", \"scale\": {\"type\": \"log\"}}}, \"height\": 300, \"selection\": {\"selector012\": {\"type\": \"multi\", \"fields\": [\"region_label\"], \"bind\": \"legend\"}}, \"width\": 300}, {\"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"region_label\", \"legend\": {\"title\": \"Region\"}}, \"opacity\": {\"condition\": {\"value\": 1, \"selection\": \"selector013\"}, \"value\": 0.2}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"region_label\", \"title\": \"Region\"}, {\"type\": \"quantitative\", \"field\": \"positive_100k\", \"title\": \"Cases/100k\"}, {\"type\": \"temporal\", \"field\": \"date\", \"title\": \"Date\"}], \"x\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Days since 100th case\"}, \"field\": \"sinceDay0\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Cases/100k\"}, \"field\": \"positive_100k\", \"scale\": {\"type\": \"log\"}}}, \"height\": 300, \"selection\": {\"selector013\": {\"type\": \"multi\", \"fields\": [\"region_label\"], \"bind\": \"legend\"}}, \"width\": 300}], \"data\": {\"name\": \"data-fd8e2687dbf2746fafc0f84ae875443d\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-fd8e2687dbf2746fafc0f84ae875443d\": [{\"index\": 172, \"date\": \"2020-03-12T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 108.0, \"deceased\": 2.0, \"population\": 499480, \"positive_100k\": 21.62248738688236, \"deceased_100k\": 0.400416433090414, \"sinceDay0\": 0}, {\"index\": 173, \"date\": \"2020-03-13T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 173.0, \"deceased\": 2.0, \"population\": 499480, \"positive_100k\": 34.63602146232081, \"deceased_100k\": 0.400416433090414, \"sinceDay0\": 1}, {\"index\": 174, \"date\": \"2020-03-14T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 282.0, \"deceased\": 2.0, \"population\": 499480, \"positive_100k\": 56.458717065748374, \"deceased_100k\": 0.400416433090414, \"sinceDay0\": 2}, {\"index\": 175, \"date\": \"2020-03-15T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 372.0, \"deceased\": 4.0, \"population\": 499480, \"positive_100k\": 74.47745655481701, \"deceased_100k\": 0.800832866180828, \"sinceDay0\": 3}, {\"index\": 176, \"date\": \"2020-03-16T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 472.0, \"deceased\": 4.0, \"population\": 499480, \"positive_100k\": 94.49827820933771, \"deceased_100k\": 0.800832866180828, \"sinceDay0\": 4}, {\"index\": 177, \"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 619.0, \"deceased\": 4.0, \"population\": 499480, \"positive_100k\": 123.92888604148315, \"deceased_100k\": 0.800832866180828, \"sinceDay0\": 5}, {\"index\": 178, \"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 751.0, \"deceased\": 6.0, \"population\": 499480, \"positive_100k\": 150.35637062545047, \"deceased_100k\": 1.2012492992712422, \"sinceDay0\": 6}, {\"index\": 179, \"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 961.0, \"deceased\": 6.0, \"population\": 499480, \"positive_100k\": 192.40009609994394, \"deceased_100k\": 1.2012492992712422, \"sinceDay0\": 7}, {\"index\": 180, \"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1136.0, \"deceased\": 8.0, \"population\": 499480, \"positive_100k\": 227.43653399535518, \"deceased_100k\": 1.601665732361656, \"sinceDay0\": 8}, {\"index\": 181, \"date\": \"2020-03-21T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1262.0, \"deceased\": 9.0, \"population\": 499480, \"positive_100k\": 252.66276928005126, \"deceased_100k\": 1.8018739489068631, \"sinceDay0\": 9}, {\"index\": 182, \"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1417.0, \"deceased\": 10.0, \"population\": 499480, \"positive_100k\": 283.6950428445583, \"deceased_100k\": 2.0020821654520704, \"sinceDay0\": 10}, {\"index\": 183, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1509.0, \"deceased\": 10.0, \"population\": 499480, \"positive_100k\": 302.1141987667174, \"deceased_100k\": 2.0020821654520704, \"sinceDay0\": 11}, {\"index\": 184, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1598.0, \"deceased\": 13.0, \"population\": 499480, \"positive_100k\": 319.9327300392408, \"deceased_100k\": 2.602706815087691, \"sinceDay0\": 12}, {\"index\": 185, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1708.0, \"deceased\": 16.0, \"population\": 499480, \"positive_100k\": 341.9556338592136, \"deceased_100k\": 3.203331464723312, \"sinceDay0\": 13}, {\"index\": 186, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1902.0, \"deceased\": 22.0, \"population\": 499480, \"positive_100k\": 380.79602786898374, \"deceased_100k\": 4.404580763994555, \"sinceDay0\": 14}, {\"index\": 187, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2051.0, \"deceased\": 23.0, \"population\": 499480, \"positive_100k\": 410.6270521342195, \"deceased_100k\": 4.6047889805397615, \"sinceDay0\": 15}, {\"index\": 188, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2277.0, \"deceased\": 27.0, \"population\": 499480, \"positive_100k\": 455.87410907343633, \"deceased_100k\": 5.40562184672059, \"sinceDay0\": 16}, {\"index\": 189, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2349.0, \"deceased\": 37.0, \"population\": 499480, \"positive_100k\": 470.28910066469126, \"deceased_100k\": 7.407704012172659, \"sinceDay0\": 17}, {\"index\": 190, \"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2375.0, \"deceased\": 42.0, \"population\": 499480, \"positive_100k\": 475.4945142948667, \"deceased_100k\": 8.408745094898695, \"sinceDay0\": 18}, {\"index\": 288, \"date\": \"2020-02-24T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 1463.0, \"positive\": 172.0, \"deceased\": 6.0, \"population\": 10067494, \"positive_100k\": 1.7084688602744638, \"deceased_100k\": 0.05959775093980687, \"sinceDay0\": 0}, {\"index\": 289, \"date\": \"2020-02-25T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3700.0, \"positive\": 240.0, \"deceased\": 9.0, \"population\": 10067494, \"positive_100k\": 2.383910037592275, \"deceased_100k\": 0.0893966264097103, \"sinceDay0\": 1}, {\"index\": 290, \"date\": \"2020-02-26T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3208.0, \"positive\": 258.0, \"deceased\": 9.0, \"population\": 10067494, \"positive_100k\": 2.562703290411695, \"deceased_100k\": 0.0893966264097103, \"sinceDay0\": 2}, {\"index\": 291, \"date\": \"2020-02-27T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3320.0, \"positive\": 403.0, \"deceased\": 14.0, \"population\": 10067494, \"positive_100k\": 4.002982271457028, \"deceased_100k\": 0.13906141885954934, \"sinceDay0\": 3}, {\"index\": 292, \"date\": \"2020-02-28T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 4835.0, \"positive\": 531.0, \"deceased\": 17.0, \"population\": 10067494, \"positive_100k\": 5.274400958172907, \"deceased_100k\": 0.1688602943294528, \"sinceDay0\": 4}, {\"index\": 293, \"date\": \"2020-02-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 5723.0, \"positive\": 615.0, \"deceased\": 23.0, \"population\": 10067494, \"positive_100k\": 6.108769471330204, \"deceased_100k\": 0.22845804526925967, \"sinceDay0\": 5}, {\"index\": 294, \"date\": \"2020-03-01T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 6879.0, \"positive\": 984.0, \"deceased\": 24.0, \"population\": 10067494, \"positive_100k\": 9.774031154128325, \"deceased_100k\": 0.23839100375922748, \"sinceDay0\": 6}, {\"index\": 295, \"date\": \"2020-03-02T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 7925.0, \"positive\": 1254.0, \"deceased\": 38.0, \"population\": 10067494, \"positive_100k\": 12.455929946419635, \"deceased_100k\": 0.3774524226187768, \"sinceDay0\": 7}, {\"index\": 296, \"date\": \"2020-03-03T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 9577.0, \"positive\": 1520.0, \"deceased\": 55.0, \"population\": 10067494, \"positive_100k\": 15.098096904751074, \"deceased_100k\": 0.5463127169482296, \"sinceDay0\": 8}, {\"index\": 297, \"date\": \"2020-03-04T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 12138.0, \"positive\": 1820.0, \"deceased\": 73.0, \"population\": 10067494, \"positive_100k\": 18.07798445174142, \"deceased_100k\": 0.7251059697676502, \"sinceDay0\": 9}, {\"index\": 298, \"date\": \"2020-03-05T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 12354.0, \"positive\": 2251.0, \"deceased\": 98.0, \"population\": 10067494, \"positive_100k\": 22.359089560917543, \"deceased_100k\": 0.9734299320168456, \"sinceDay0\": 10}, {\"index\": 299, \"date\": \"2020-03-06T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 13556.0, \"positive\": 2612.0, \"deceased\": 135.0, \"population\": 10067494, \"positive_100k\": 25.94488757579592, \"deceased_100k\": 1.3409493961456544, \"sinceDay0\": 11}, {\"index\": 300, \"date\": \"2020-03-07T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 15778.0, \"positive\": 3420.0, \"deceased\": 154.0, \"population\": 10067494, \"positive_100k\": 33.97071803568991, \"deceased_100k\": 1.5296756074550428, \"sinceDay0\": 12}, {\"index\": 301, \"date\": \"2020-03-08T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 18534.0, \"positive\": 4189.0, \"deceased\": 267.0, \"population\": 10067494, \"positive_100k\": 41.609163114475166, \"deceased_100k\": 2.6520999168214057, \"sinceDay0\": 13}, {\"index\": 302, \"date\": \"2020-03-09T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 20135.0, \"positive\": 5469.0, \"deceased\": 333.0, \"population\": 10067494, \"positive_100k\": 54.32334998163396, \"deceased_100k\": 3.307675177159281, \"sinceDay0\": 14}, {\"index\": 303, \"date\": \"2020-03-10T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 21479.0, \"positive\": 5791.0, \"deceased\": 468.0, \"population\": 10067494, \"positive_100k\": 57.5217626154036, \"deceased_100k\": 4.648624573304936, \"sinceDay0\": 15}, {\"index\": 304, \"date\": \"2020-03-11T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 25629.0, \"positive\": 7280.0, \"deceased\": 617.0, \"population\": 10067494, \"positive_100k\": 72.31193780696567, \"deceased_100k\": 6.12863538831014, \"sinceDay0\": 16}, {\"index\": 305, \"date\": \"2020-03-12T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 29534.0, \"positive\": 8725.0, \"deceased\": 744.0, \"population\": 10067494, \"positive_100k\": 86.66506282496914, \"deceased_100k\": 7.390121116536052, \"sinceDay0\": 17}, {\"index\": 306, \"date\": \"2020-03-13T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 32700.0, \"positive\": 9820.0, \"deceased\": 890.0, \"population\": 10067494, \"positive_100k\": 97.5416523714839, \"deceased_100k\": 8.840333056071351, \"sinceDay0\": 18}, {\"index\": 307, \"date\": \"2020-03-14T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 37138.0, \"positive\": 11685.0, \"deceased\": 966.0, \"population\": 10067494, \"positive_100k\": 116.06661995527388, \"deceased_100k\": 9.595237901308906, \"sinceDay0\": 19}, {\"index\": 308, \"date\": \"2020-03-15T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 40369.0, \"positive\": 13272.0, \"deceased\": 1218.0, \"population\": 10067494, \"positive_100k\": 131.83022507885278, \"deceased_100k\": 12.098343440780795, \"sinceDay0\": 20}, {\"index\": 309, \"date\": \"2020-03-16T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 43565.0, \"positive\": 14649.0, \"deceased\": 1420.0, \"population\": 10067494, \"positive_100k\": 145.50790891953847, \"deceased_100k\": 14.104801055754292, \"sinceDay0\": 21}, {\"index\": 310, \"date\": \"2020-03-17T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 46449.0, \"positive\": 16220.0, \"deceased\": 1640.0, \"population\": 10067494, \"positive_100k\": 161.1125867072779, \"deceased_100k\": 16.29005192354721, \"sinceDay0\": 22}, {\"index\": 311, \"date\": \"2020-03-18T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 48983.0, \"positive\": 17713.0, \"deceased\": 1959.0, \"population\": 10067494, \"positive_100k\": 175.94249373279982, \"deceased_100k\": 19.45866568184694, \"sinceDay0\": 23}, {\"index\": 312, \"date\": \"2020-03-19T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 52244.0, \"positive\": 19884.0, \"deceased\": 2168.0, \"population\": 10067494, \"positive_100k\": 197.50694661451996, \"deceased_100k\": 21.534654006250214, \"sinceDay0\": 24}, {\"index\": 313, \"date\": \"2020-03-20T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 57174.0, \"positive\": 22264.0, \"deceased\": 2549.0, \"population\": 10067494, \"positive_100k\": 221.14738782064336, \"deceased_100k\": 25.319111190927952, \"sinceDay0\": 25}, {\"index\": 314, \"date\": \"2020-03-21T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 66730.0, \"positive\": 25515.0, \"deceased\": 3095.0, \"population\": 10067494, \"positive_100k\": 253.43943587152873, \"deceased_100k\": 30.742506526450377, \"sinceDay0\": 26}, {\"index\": 315, \"date\": \"2020-03-22T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 70598.0, \"positive\": 27206.0, \"deceased\": 3456.0, \"population\": 10067494, \"positive_100k\": 270.23606867806427, \"deceased_100k\": 34.328304541328755, \"sinceDay0\": 27}, {\"index\": 316, \"date\": \"2020-03-23T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 73242.0, \"positive\": 28761.0, \"deceased\": 3776.0, \"population\": 10067494, \"positive_100k\": 285.6818191299642, \"deceased_100k\": 37.50685125811846, \"sinceDay0\": 28}, {\"index\": 317, \"date\": \"2020-03-24T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 76695.0, \"positive\": 30703.0, \"deceased\": 4178.0, \"population\": 10067494, \"positive_100k\": 304.9716245174817, \"deceased_100k\": 41.49990057108552, \"sinceDay0\": 29}, {\"index\": 318, \"date\": \"2020-03-25T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 81666.0, \"positive\": 32346.0, \"deceased\": 4474.0, \"population\": 10067494, \"positive_100k\": 321.2914753164988, \"deceased_100k\": 44.44005628411599, \"sinceDay0\": 30}, {\"index\": 319, \"date\": \"2020-03-26T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 87713.0, \"positive\": 34889.0, \"deceased\": 4861.0, \"population\": 10067494, \"positive_100k\": 346.55098875648696, \"deceased_100k\": 48.28411121973353, \"sinceDay0\": 31}, {\"index\": 320, \"date\": \"2020-03-27T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 95860.0, \"positive\": 37298.0, \"deceased\": 5402.0, \"population\": 10067494, \"positive_100k\": 370.47948575881946, \"deceased_100k\": 53.657841762806115, \"sinceDay0\": 32}, {\"index\": 321, \"date\": \"2020-03-28T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 102503.0, \"positive\": 39415.0, \"deceased\": 5944.0, \"population\": 10067494, \"positive_100k\": 391.5075588820813, \"deceased_100k\": 59.041505264368666, \"sinceDay0\": 33}, {\"index\": 322, \"date\": \"2020-03-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 107398.0, \"positive\": 41007.0, \"deceased\": 6360.0, \"population\": 10067494, \"positive_100k\": 407.32082879810997, \"deceased_100k\": 63.17361599619528, \"sinceDay0\": 34}, {\"index\": 323, \"date\": \"2020-03-30T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 111057.0, \"positive\": 42161.0, \"deceased\": 6818.0, \"population\": 10067494, \"positive_100k\": 418.7834628955329, \"deceased_100k\": 67.72291098460053, \"sinceDay0\": 35}, {\"index\": 59, \"date\": \"2020-03-12T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 180.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 50.94200253011947, \"deceased_100k\": null, \"sinceDay0\": 0}, {\"index\": 60, \"date\": \"2020-03-13T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 258.0, \"deceased\": null, \"population\": 353343, \"positive_100k\": 73.01687029317122, \"deceased_100k\": null, \"sinceDay0\": 1}, {\"index\": 61, \"date\": \"2020-03-14T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 265.0, \"deceased\": 3.0, \"population\": 353343, \"positive_100k\": 74.99794816934254, \"deceased_100k\": 0.849033375501991, \"sinceDay0\": 2}, {\"index\": 62, \"date\": \"2020-03-15T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 291.0, \"deceased\": 6.0, \"population\": 353343, \"positive_100k\": 82.35623742369313, \"deceased_100k\": 1.698066751003982, \"sinceDay0\": 3}, {\"index\": 63, \"date\": \"2020-03-16T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 330.0, \"deceased\": 8.0, \"population\": 353343, \"positive_100k\": 93.39367130521902, \"deceased_100k\": 2.2640890013386423, \"sinceDay0\": 4}, {\"index\": 64, \"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 422.0, \"deceased\": 10.0, \"population\": 353343, \"positive_100k\": 119.43069482061341, \"deceased_100k\": 2.8301112516733036, \"sinceDay0\": 5}, {\"index\": 65, \"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 511.0, \"deceased\": 14.0, \"population\": 353343, \"positive_100k\": 144.6186849605058, \"deceased_100k\": 3.9621557523426247, \"sinceDay0\": 6}, {\"index\": 66, \"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 638.0, \"deceased\": 15.0, \"population\": 353343, \"positive_100k\": 180.56109785675676, \"deceased_100k\": 4.245166877509955, \"sinceDay0\": 7}, {\"index\": 67, \"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 834.0, \"deceased\": 22.0, \"population\": 353343, \"positive_100k\": 236.0312783895535, \"deceased_100k\": 6.226244753681267, \"sinceDay0\": 8}, {\"index\": 68, \"date\": \"2020-03-21T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 918.0, \"deceased\": 28.0, \"population\": 353343, \"positive_100k\": 259.8042129036092, \"deceased_100k\": 7.9243115046852495, \"sinceDay0\": 9}, {\"index\": 69, \"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 939.0, \"deceased\": 37.0, \"population\": 353343, \"positive_100k\": 265.74744653212315, \"deceased_100k\": 10.471411631191222, \"sinceDay0\": 10}, {\"index\": 70, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1165.0, \"deceased\": 48.0, \"population\": 353343, \"positive_100k\": 329.70796081993984, \"deceased_100k\": 13.584534008031856, \"sinceDay0\": 11}, {\"index\": 71, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1211.0, \"deceased\": 53.0, \"population\": 353343, \"positive_100k\": 342.726472577637, \"deceased_100k\": 14.999589633868506, \"sinceDay0\": 12}, {\"index\": 72, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1354.0, \"deceased\": 60.0, \"population\": 353343, \"positive_100k\": 383.19706347656523, \"deceased_100k\": 16.98066751003982, \"sinceDay0\": 13}, {\"index\": 73, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1401.0, \"deceased\": 67.0, \"population\": 353343, \"positive_100k\": 396.49858635942974, \"deceased_100k\": 18.961745386211135, \"sinceDay0\": 14}, {\"index\": 74, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1688.0, \"deceased\": 76.0, \"population\": 353343, \"positive_100k\": 477.72277928245364, \"deceased_100k\": 21.508845512717105, \"sinceDay0\": 15}, {\"index\": 75, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1727.0, \"deceased\": 87.0, \"population\": 353343, \"positive_100k\": 488.7602131639795, \"deceased_100k\": 24.621967889557737, \"sinceDay0\": 16}, {\"index\": 76, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1837.0, \"deceased\": 93.0, \"population\": 353343, \"positive_100k\": 519.8914369323858, \"deceased_100k\": 26.32003464056172, \"sinceDay0\": 17}, {\"index\": 77, \"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1962.0, \"deceased\": 105.0, \"population\": 353343, \"positive_100k\": 555.2678275783021, \"deceased_100k\": 29.716168142569686, \"sinceDay0\": 18}, {\"index\": 113, \"date\": \"2020-03-11T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 108.0, \"deceased\": 1.0, \"population\": 799145, \"positive_100k\": 13.514443561556416, \"deceased_100k\": 0.1251337366810779, \"sinceDay0\": 0}, {\"index\": 114, \"date\": \"2020-03-12T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 156.0, \"deceased\": 1.0, \"population\": 799145, \"positive_100k\": 19.520862922248153, \"deceased_100k\": 0.1251337366810779, \"sinceDay0\": 1}, {\"index\": 115, \"date\": \"2020-03-13T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 204.0, \"deceased\": 2.0, \"population\": 799145, \"positive_100k\": 25.527282282939893, \"deceased_100k\": 0.2502674733621558, \"sinceDay0\": 2}, {\"index\": 116, \"date\": \"2020-03-14T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 350.0, \"deceased\": 3.0, \"population\": 799145, \"positive_100k\": 43.79680783837727, \"deceased_100k\": 0.3754012100432337, \"sinceDay0\": 3}, {\"index\": 117, \"date\": \"2020-03-15T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 406.0, \"deceased\": 4.0, \"population\": 799145, \"positive_100k\": 50.80429709251763, \"deceased_100k\": 0.5005349467243116, \"sinceDay0\": 4}, {\"index\": 118, \"date\": \"2020-03-16T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 508.0, \"deceased\": 5.0, \"population\": 799145, \"positive_100k\": 63.567938233987576, \"deceased_100k\": 0.6256686834053895, \"sinceDay0\": 5}, {\"index\": 119, \"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 608.0, \"deceased\": 5.0, \"population\": 799145, \"positive_100k\": 76.08131190209536, \"deceased_100k\": 0.6256686834053895, \"sinceDay0\": 6}, {\"index\": 120, \"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 796.0, \"deceased\": 5.0, \"population\": 799145, \"positive_100k\": 99.60645439813801, \"deceased_100k\": 0.6256686834053895, \"sinceDay0\": 7}, {\"index\": 121, \"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1212.0, \"deceased\": 7.0, \"population\": 799145, \"positive_100k\": 151.66208885746641, \"deceased_100k\": 0.8759361567675453, \"sinceDay0\": 8}, {\"index\": 122, \"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1432.0, \"deceased\": 12.0, \"population\": 799145, \"positive_100k\": 179.19151092730357, \"deceased_100k\": 1.5016048401729347, \"sinceDay0\": 9}, {\"index\": 123, \"date\": \"2020-03-21T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1676.0, \"deceased\": 15.0, \"population\": 799145, \"positive_100k\": 209.72414267748655, \"deceased_100k\": 1.8770060502161685, \"sinceDay0\": 10}, {\"index\": 124, \"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1782.0, \"deceased\": 16.0, \"population\": 799145, \"positive_100k\": 222.98831876568082, \"deceased_100k\": 2.0021397868972466, \"sinceDay0\": 11}, {\"index\": 125, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1822.0, \"deceased\": 25.0, \"population\": 799145, \"positive_100k\": 227.99366823292394, \"deceased_100k\": 3.1283434170269477, \"sinceDay0\": 12}, {\"index\": 126, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2162.0, \"deceased\": 29.0, \"population\": 799145, \"positive_100k\": 270.5391387044904, \"deceased_100k\": 3.6288783637512587, \"sinceDay0\": 13}, {\"index\": 127, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2215.0, \"deceased\": 36.0, \"population\": 799145, \"positive_100k\": 277.1712267485875, \"deceased_100k\": 4.504814520518805, \"sinceDay0\": 14}, {\"index\": 128, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2532.0, \"deceased\": 47.0, \"population\": 799145, \"positive_100k\": 316.8386212764893, \"deceased_100k\": 5.881285624010661, \"sinceDay0\": 15}, {\"index\": 129, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2745.0, \"deceased\": 48.0, \"population\": 799145, \"positive_100k\": 343.49210718955885, \"deceased_100k\": 6.006419360691739, \"sinceDay0\": 16}, {\"index\": 130, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2936.0, \"deceased\": 55.0, \"population\": 799145, \"positive_100k\": 367.39265089564475, \"deceased_100k\": 6.882355517459285, \"sinceDay0\": 17}, {\"index\": 131, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 3168.0, \"deceased\": 66.0, \"population\": 799145, \"positive_100k\": 396.42367780565485, \"deceased_100k\": 8.258826620951142, \"sinceDay0\": 18}, {\"index\": 299, \"date\": \"2020-03-13T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 140.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 9.204664397936051, \"deceased_100k\": null, \"sinceDay0\": 0}, {\"index\": 300, \"date\": \"2020-03-16T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 270.0, \"deceased\": 1.0, \"population\": 1520968, \"positive_100k\": 17.7518527674481, \"deceased_100k\": 0.06574760284240036, \"sinceDay0\": 1}, {\"index\": 301, \"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 294.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 19.329795235665706, \"deceased_100k\": null, \"sinceDay0\": 2}, {\"index\": 302, \"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 424.0, \"deceased\": null, \"population\": 1520968, \"positive_100k\": 27.876983605177756, \"deceased_100k\": null, \"sinceDay0\": 3}, {\"index\": 303, \"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 526.0, \"deceased\": 3.0, \"population\": 1520968, \"positive_100k\": 34.58323909510259, \"deceased_100k\": 0.1972428085272011, \"sinceDay0\": 4}, {\"index\": 304, \"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 773.0, \"deceased\": 3.0, \"population\": 1520968, \"positive_100k\": 50.822896997175484, \"deceased_100k\": 0.1972428085272011, \"sinceDay0\": 5}, {\"index\": 305, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1068.0, \"deceased\": 5.0, \"population\": 1520968, \"positive_100k\": 70.2184398356836, \"deceased_100k\": 0.32873801421200183, \"sinceDay0\": 6}, {\"index\": 306, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1211.0, \"deceased\": 5.0, \"population\": 1520968, \"positive_100k\": 79.62034704214685, \"deceased_100k\": 0.32873801421200183, \"sinceDay0\": 7}, {\"index\": 307, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1363.0, \"deceased\": 7.0, \"population\": 1520968, \"positive_100k\": 89.6139826741917, \"deceased_100k\": 0.4602332198968026, \"sinceDay0\": 8}, {\"index\": 308, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1476.0, \"deceased\": 9.0, \"population\": 1520968, \"positive_100k\": 97.04346179538294, \"deceased_100k\": 0.5917284255816032, \"sinceDay0\": 9}, {\"index\": 309, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1578.0, \"deceased\": 11.0, \"population\": 1520968, \"positive_100k\": 103.74971728530778, \"deceased_100k\": 0.723223631266404, \"sinceDay0\": 10}, {\"index\": 310, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1720.0, \"deceased\": 15.0, \"population\": 1520968, \"positive_100k\": 113.08587688892862, \"deceased_100k\": 0.9862140426360054, \"sinceDay0\": 11}, {\"index\": 311, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1758.0, \"deceased\": 15.0, \"population\": 1520968, \"positive_100k\": 115.58428579693985, \"deceased_100k\": 0.9862140426360054, \"sinceDay0\": 12}, {\"index\": 312, \"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1874.0, \"deceased\": 21.0, \"population\": 1520968, \"positive_100k\": 123.2110077266583, \"deceased_100k\": 1.3806996596904075, \"sinceDay0\": 13}]}}, {\"mode\": \"vega-lite\"});\n</script>", + "text/plain": "alt.HConcatChart(...)" + }, + "metadata": {}, + "execution_count": 24 + } + ], + "source": [ + "since_df_positive = helper.make_since_df(df_all[df_all.region_label.isin(['Lombardy', 'Ticino', 'Vaud', 'Geneva','Zürich'])], region_column='region_label', start_case=100)\n", + "base = alt.Chart(since_df_positive).properties(height=300,width=300)\n", + "days_log = plotting.make_region_since_chart(base, 'positive', 'sinceDay0', 'region_label', 'Days since 100th case', 'Cases', 'Cases', 'Region')\n", + "days_log_100k = plotting.make_region_since_chart(base, 'positive_100k', 'sinceDay0', 'region_label', 'Days since 100th case', 'Cases/100k', 'Cases/100k', 'Region')\n", + "alt.hconcat(days_log, days_log_100k)" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": "\n<div id=\"altair-viz-3db26e03ac634104a5a56438abaeff70\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n const outputDiv = document.getElementById(\"altair-viz-3db26e03ac634104a5a56438abaeff70\");\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"hconcat\": [{\"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"region_label\", \"legend\": {\"title\": \"Region\"}}, \"opacity\": {\"condition\": {\"value\": 1, \"selection\": \"selector016\"}, \"value\": 0.2}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"region_label\", \"title\": \"Region\"}, {\"type\": \"quantitative\", \"field\": \"deceased\", \"title\": \"Deaths\"}, {\"type\": \"temporal\", \"field\": \"date\", \"title\": \"Date\"}], \"x\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Days since 10th death\"}, \"field\": \"sinceDay0\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Deaths\"}, \"field\": \"deceased\", \"scale\": {\"type\": \"log\"}}}, \"height\": 300, \"selection\": {\"selector016\": {\"type\": \"multi\", \"fields\": [\"region_label\"], \"bind\": \"legend\"}}, \"width\": 300}, {\"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"region_label\", \"legend\": {\"title\": \"Region\"}}, \"opacity\": {\"condition\": {\"value\": 1, \"selection\": \"selector017\"}, \"value\": 0.2}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"region_label\", \"title\": \"Region\"}, {\"type\": \"quantitative\", \"field\": \"deceased_100k\", \"title\": \"Deaths/100k\"}, {\"type\": \"temporal\", \"field\": \"date\", \"title\": \"Date\"}], \"x\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Days since 100th case\"}, \"field\": \"sinceDay0\"}, \"y\": {\"type\": \"quantitative\", \"axis\": {\"title\": \"Deaths/100k\"}, \"field\": \"deceased_100k\", \"scale\": {\"type\": \"log\"}}}, \"height\": 300, \"selection\": {\"selector017\": {\"type\": \"multi\", \"fields\": [\"region_label\"], \"bind\": \"legend\"}}, \"width\": 300}], \"data\": {\"name\": \"data-41cca6e0e8c3c60c3f4d5396c5bc8d8c\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-41cca6e0e8c3c60c3f4d5396c5bc8d8c\": [{\"index\": 182, \"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1417.0, \"deceased\": 10.0, \"population\": 499480, \"positive_100k\": 283.6950428445583, \"deceased_100k\": 2.0020821654520704, \"sinceDay0\": 0}, {\"index\": 183, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1509.0, \"deceased\": 10.0, \"population\": 499480, \"positive_100k\": 302.1141987667174, \"deceased_100k\": 2.0020821654520704, \"sinceDay0\": 1}, {\"index\": 184, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1598.0, \"deceased\": 13.0, \"population\": 499480, \"positive_100k\": 319.9327300392408, \"deceased_100k\": 2.602706815087691, \"sinceDay0\": 2}, {\"index\": 185, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1708.0, \"deceased\": 16.0, \"population\": 499480, \"positive_100k\": 341.9556338592136, \"deceased_100k\": 3.203331464723312, \"sinceDay0\": 3}, {\"index\": 186, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 1902.0, \"deceased\": 22.0, \"population\": 499480, \"positive_100k\": 380.79602786898374, \"deceased_100k\": 4.404580763994555, \"sinceDay0\": 4}, {\"index\": 187, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2051.0, \"deceased\": 23.0, \"population\": 499480, \"positive_100k\": 410.6270521342195, \"deceased_100k\": 4.6047889805397615, \"sinceDay0\": 5}, {\"index\": 188, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2277.0, \"deceased\": 27.0, \"population\": 499480, \"positive_100k\": 455.87410907343633, \"deceased_100k\": 5.40562184672059, \"sinceDay0\": 6}, {\"index\": 189, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2349.0, \"deceased\": 37.0, \"population\": 499480, \"positive_100k\": 470.28910066469126, \"deceased_100k\": 7.407704012172659, \"sinceDay0\": 7}, {\"index\": 190, \"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-GE\", \"region_label\": \"Geneva\", \"tested\": null, \"positive\": 2375.0, \"deceased\": 42.0, \"population\": 499480, \"positive_100k\": 475.4945142948667, \"deceased_100k\": 8.408745094898695, \"sinceDay0\": 8}, {\"index\": 291, \"date\": \"2020-02-27T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 3320.0, \"positive\": 403.0, \"deceased\": 14.0, \"population\": 10067494, \"positive_100k\": 4.002982271457028, \"deceased_100k\": 0.13906141885954934, \"sinceDay0\": 0}, {\"index\": 292, \"date\": \"2020-02-28T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 4835.0, \"positive\": 531.0, \"deceased\": 17.0, \"population\": 10067494, \"positive_100k\": 5.274400958172907, \"deceased_100k\": 0.1688602943294528, \"sinceDay0\": 1}, {\"index\": 293, \"date\": \"2020-02-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 5723.0, \"positive\": 615.0, \"deceased\": 23.0, \"population\": 10067494, \"positive_100k\": 6.108769471330204, \"deceased_100k\": 0.22845804526925967, \"sinceDay0\": 2}, {\"index\": 294, \"date\": \"2020-03-01T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 6879.0, \"positive\": 984.0, \"deceased\": 24.0, \"population\": 10067494, \"positive_100k\": 9.774031154128325, \"deceased_100k\": 0.23839100375922748, \"sinceDay0\": 3}, {\"index\": 295, \"date\": \"2020-03-02T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 7925.0, \"positive\": 1254.0, \"deceased\": 38.0, \"population\": 10067494, \"positive_100k\": 12.455929946419635, \"deceased_100k\": 0.3774524226187768, \"sinceDay0\": 4}, {\"index\": 296, \"date\": \"2020-03-03T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 9577.0, \"positive\": 1520.0, \"deceased\": 55.0, \"population\": 10067494, \"positive_100k\": 15.098096904751074, \"deceased_100k\": 0.5463127169482296, \"sinceDay0\": 5}, {\"index\": 297, \"date\": \"2020-03-04T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 12138.0, \"positive\": 1820.0, \"deceased\": 73.0, \"population\": 10067494, \"positive_100k\": 18.07798445174142, \"deceased_100k\": 0.7251059697676502, \"sinceDay0\": 6}, {\"index\": 298, \"date\": \"2020-03-05T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 12354.0, \"positive\": 2251.0, \"deceased\": 98.0, \"population\": 10067494, \"positive_100k\": 22.359089560917543, \"deceased_100k\": 0.9734299320168456, \"sinceDay0\": 7}, {\"index\": 299, \"date\": \"2020-03-06T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 13556.0, \"positive\": 2612.0, \"deceased\": 135.0, \"population\": 10067494, \"positive_100k\": 25.94488757579592, \"deceased_100k\": 1.3409493961456544, \"sinceDay0\": 8}, {\"index\": 300, \"date\": \"2020-03-07T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 15778.0, \"positive\": 3420.0, \"deceased\": 154.0, \"population\": 10067494, \"positive_100k\": 33.97071803568991, \"deceased_100k\": 1.5296756074550428, \"sinceDay0\": 9}, {\"index\": 301, \"date\": \"2020-03-08T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 18534.0, \"positive\": 4189.0, \"deceased\": 267.0, \"population\": 10067494, \"positive_100k\": 41.609163114475166, \"deceased_100k\": 2.6520999168214057, \"sinceDay0\": 10}, {\"index\": 302, \"date\": \"2020-03-09T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 20135.0, \"positive\": 5469.0, \"deceased\": 333.0, \"population\": 10067494, \"positive_100k\": 54.32334998163396, \"deceased_100k\": 3.307675177159281, \"sinceDay0\": 11}, {\"index\": 303, \"date\": \"2020-03-10T18:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 21479.0, \"positive\": 5791.0, \"deceased\": 468.0, \"population\": 10067494, \"positive_100k\": 57.5217626154036, \"deceased_100k\": 4.648624573304936, \"sinceDay0\": 12}, {\"index\": 304, \"date\": \"2020-03-11T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 25629.0, \"positive\": 7280.0, \"deceased\": 617.0, \"population\": 10067494, \"positive_100k\": 72.31193780696567, \"deceased_100k\": 6.12863538831014, \"sinceDay0\": 13}, {\"index\": 305, \"date\": \"2020-03-12T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 29534.0, \"positive\": 8725.0, \"deceased\": 744.0, \"population\": 10067494, \"positive_100k\": 86.66506282496914, \"deceased_100k\": 7.390121116536052, \"sinceDay0\": 14}, {\"index\": 306, \"date\": \"2020-03-13T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 32700.0, \"positive\": 9820.0, \"deceased\": 890.0, \"population\": 10067494, \"positive_100k\": 97.5416523714839, \"deceased_100k\": 8.840333056071351, \"sinceDay0\": 15}, {\"index\": 307, \"date\": \"2020-03-14T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 37138.0, \"positive\": 11685.0, \"deceased\": 966.0, \"population\": 10067494, \"positive_100k\": 116.06661995527388, \"deceased_100k\": 9.595237901308906, \"sinceDay0\": 16}, {\"index\": 308, \"date\": \"2020-03-15T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 40369.0, \"positive\": 13272.0, \"deceased\": 1218.0, \"population\": 10067494, \"positive_100k\": 131.83022507885278, \"deceased_100k\": 12.098343440780795, \"sinceDay0\": 17}, {\"index\": 309, \"date\": \"2020-03-16T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 43565.0, \"positive\": 14649.0, \"deceased\": 1420.0, \"population\": 10067494, \"positive_100k\": 145.50790891953847, \"deceased_100k\": 14.104801055754292, \"sinceDay0\": 18}, {\"index\": 310, \"date\": \"2020-03-17T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 46449.0, \"positive\": 16220.0, \"deceased\": 1640.0, \"population\": 10067494, \"positive_100k\": 161.1125867072779, \"deceased_100k\": 16.29005192354721, \"sinceDay0\": 19}, {\"index\": 311, \"date\": \"2020-03-18T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 48983.0, \"positive\": 17713.0, \"deceased\": 1959.0, \"population\": 10067494, \"positive_100k\": 175.94249373279982, \"deceased_100k\": 19.45866568184694, \"sinceDay0\": 20}, {\"index\": 312, \"date\": \"2020-03-19T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 52244.0, \"positive\": 19884.0, \"deceased\": 2168.0, \"population\": 10067494, \"positive_100k\": 197.50694661451996, \"deceased_100k\": 21.534654006250214, \"sinceDay0\": 21}, {\"index\": 313, \"date\": \"2020-03-20T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 57174.0, \"positive\": 22264.0, \"deceased\": 2549.0, \"population\": 10067494, \"positive_100k\": 221.14738782064336, \"deceased_100k\": 25.319111190927952, \"sinceDay0\": 22}, {\"index\": 314, \"date\": \"2020-03-21T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 66730.0, \"positive\": 25515.0, \"deceased\": 3095.0, \"population\": 10067494, \"positive_100k\": 253.43943587152873, \"deceased_100k\": 30.742506526450377, \"sinceDay0\": 23}, {\"index\": 315, \"date\": \"2020-03-22T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 70598.0, \"positive\": 27206.0, \"deceased\": 3456.0, \"population\": 10067494, \"positive_100k\": 270.23606867806427, \"deceased_100k\": 34.328304541328755, \"sinceDay0\": 24}, {\"index\": 316, \"date\": \"2020-03-23T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 73242.0, \"positive\": 28761.0, \"deceased\": 3776.0, \"population\": 10067494, \"positive_100k\": 285.6818191299642, \"deceased_100k\": 37.50685125811846, \"sinceDay0\": 25}, {\"index\": 317, \"date\": \"2020-03-24T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 76695.0, \"positive\": 30703.0, \"deceased\": 4178.0, \"population\": 10067494, \"positive_100k\": 304.9716245174817, \"deceased_100k\": 41.49990057108552, \"sinceDay0\": 26}, {\"index\": 318, \"date\": \"2020-03-25T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 81666.0, \"positive\": 32346.0, \"deceased\": 4474.0, \"population\": 10067494, \"positive_100k\": 321.2914753164988, \"deceased_100k\": 44.44005628411599, \"sinceDay0\": 27}, {\"index\": 319, \"date\": \"2020-03-26T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 87713.0, \"positive\": 34889.0, \"deceased\": 4861.0, \"population\": 10067494, \"positive_100k\": 346.55098875648696, \"deceased_100k\": 48.28411121973353, \"sinceDay0\": 28}, {\"index\": 320, \"date\": \"2020-03-27T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 95860.0, \"positive\": 37298.0, \"deceased\": 5402.0, \"population\": 10067494, \"positive_100k\": 370.47948575881946, \"deceased_100k\": 53.657841762806115, \"sinceDay0\": 29}, {\"index\": 321, \"date\": \"2020-03-28T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 102503.0, \"positive\": 39415.0, \"deceased\": 5944.0, \"population\": 10067494, \"positive_100k\": 391.5075588820813, \"deceased_100k\": 59.041505264368666, \"sinceDay0\": 30}, {\"index\": 322, \"date\": \"2020-03-29T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 107398.0, \"positive\": 41007.0, \"deceased\": 6360.0, \"population\": 10067494, \"positive_100k\": 407.32082879810997, \"deceased_100k\": 63.17361599619528, \"sinceDay0\": 31}, {\"index\": 323, \"date\": \"2020-03-30T17:00:00\", \"country\": \"ITA\", \"region_iso\": \"IT-25\", \"region_label\": \"Lombardy\", \"tested\": 111057.0, \"positive\": 42161.0, \"deceased\": 6818.0, \"population\": 10067494, \"positive_100k\": 418.7834628955329, \"deceased_100k\": 67.72291098460053, \"sinceDay0\": 32}, {\"index\": 64, \"date\": \"2020-03-17T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 422.0, \"deceased\": 10.0, \"population\": 353343, \"positive_100k\": 119.43069482061341, \"deceased_100k\": 2.8301112516733036, \"sinceDay0\": 0}, {\"index\": 65, \"date\": \"2020-03-18T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 511.0, \"deceased\": 14.0, \"population\": 353343, \"positive_100k\": 144.6186849605058, \"deceased_100k\": 3.9621557523426247, \"sinceDay0\": 1}, {\"index\": 66, \"date\": \"2020-03-19T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 638.0, \"deceased\": 15.0, \"population\": 353343, \"positive_100k\": 180.56109785675676, \"deceased_100k\": 4.245166877509955, \"sinceDay0\": 2}, {\"index\": 67, \"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 834.0, \"deceased\": 22.0, \"population\": 353343, \"positive_100k\": 236.0312783895535, \"deceased_100k\": 6.226244753681267, \"sinceDay0\": 3}, {\"index\": 68, \"date\": \"2020-03-21T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 918.0, \"deceased\": 28.0, \"population\": 353343, \"positive_100k\": 259.8042129036092, \"deceased_100k\": 7.9243115046852495, \"sinceDay0\": 4}, {\"index\": 69, \"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 939.0, \"deceased\": 37.0, \"population\": 353343, \"positive_100k\": 265.74744653212315, \"deceased_100k\": 10.471411631191222, \"sinceDay0\": 5}, {\"index\": 70, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1165.0, \"deceased\": 48.0, \"population\": 353343, \"positive_100k\": 329.70796081993984, \"deceased_100k\": 13.584534008031856, \"sinceDay0\": 6}, {\"index\": 71, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1211.0, \"deceased\": 53.0, \"population\": 353343, \"positive_100k\": 342.726472577637, \"deceased_100k\": 14.999589633868506, \"sinceDay0\": 7}, {\"index\": 72, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1354.0, \"deceased\": 60.0, \"population\": 353343, \"positive_100k\": 383.19706347656523, \"deceased_100k\": 16.98066751003982, \"sinceDay0\": 8}, {\"index\": 73, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1401.0, \"deceased\": 67.0, \"population\": 353343, \"positive_100k\": 396.49858635942974, \"deceased_100k\": 18.961745386211135, \"sinceDay0\": 9}, {\"index\": 74, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1688.0, \"deceased\": 76.0, \"population\": 353343, \"positive_100k\": 477.72277928245364, \"deceased_100k\": 21.508845512717105, \"sinceDay0\": 10}, {\"index\": 75, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1727.0, \"deceased\": 87.0, \"population\": 353343, \"positive_100k\": 488.7602131639795, \"deceased_100k\": 24.621967889557737, \"sinceDay0\": 11}, {\"index\": 76, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1837.0, \"deceased\": 93.0, \"population\": 353343, \"positive_100k\": 519.8914369323858, \"deceased_100k\": 26.32003464056172, \"sinceDay0\": 12}, {\"index\": 77, \"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-TI\", \"region_label\": \"Ticino\", \"tested\": null, \"positive\": 1962.0, \"deceased\": 105.0, \"population\": 353343, \"positive_100k\": 555.2678275783021, \"deceased_100k\": 29.716168142569686, \"sinceDay0\": 13}, {\"index\": 122, \"date\": \"2020-03-20T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1432.0, \"deceased\": 12.0, \"population\": 799145, \"positive_100k\": 179.19151092730357, \"deceased_100k\": 1.5016048401729347, \"sinceDay0\": 0}, {\"index\": 123, \"date\": \"2020-03-21T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1676.0, \"deceased\": 15.0, \"population\": 799145, \"positive_100k\": 209.72414267748655, \"deceased_100k\": 1.8770060502161685, \"sinceDay0\": 1}, {\"index\": 124, \"date\": \"2020-03-22T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1782.0, \"deceased\": 16.0, \"population\": 799145, \"positive_100k\": 222.98831876568082, \"deceased_100k\": 2.0021397868972466, \"sinceDay0\": 2}, {\"index\": 125, \"date\": \"2020-03-23T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 1822.0, \"deceased\": 25.0, \"population\": 799145, \"positive_100k\": 227.99366823292394, \"deceased_100k\": 3.1283434170269477, \"sinceDay0\": 3}, {\"index\": 126, \"date\": \"2020-03-24T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2162.0, \"deceased\": 29.0, \"population\": 799145, \"positive_100k\": 270.5391387044904, \"deceased_100k\": 3.6288783637512587, \"sinceDay0\": 4}, {\"index\": 127, \"date\": \"2020-03-25T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2215.0, \"deceased\": 36.0, \"population\": 799145, \"positive_100k\": 277.1712267485875, \"deceased_100k\": 4.504814520518805, \"sinceDay0\": 5}, {\"index\": 128, \"date\": \"2020-03-26T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2532.0, \"deceased\": 47.0, \"population\": 799145, \"positive_100k\": 316.8386212764893, \"deceased_100k\": 5.881285624010661, \"sinceDay0\": 6}, {\"index\": 129, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2745.0, \"deceased\": 48.0, \"population\": 799145, \"positive_100k\": 343.49210718955885, \"deceased_100k\": 6.006419360691739, \"sinceDay0\": 7}, {\"index\": 130, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 2936.0, \"deceased\": 55.0, \"population\": 799145, \"positive_100k\": 367.39265089564475, \"deceased_100k\": 6.882355517459285, \"sinceDay0\": 8}, {\"index\": 131, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-VD\", \"region_label\": \"Vaud\", \"tested\": null, \"positive\": 3168.0, \"deceased\": 66.0, \"population\": 799145, \"positive_100k\": 396.42367780565485, \"deceased_100k\": 8.258826620951142, \"sinceDay0\": 9}, {\"index\": 309, \"date\": \"2020-03-27T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1578.0, \"deceased\": 11.0, \"population\": 1520968, \"positive_100k\": 103.74971728530778, \"deceased_100k\": 0.723223631266404, \"sinceDay0\": 0}, {\"index\": 310, \"date\": \"2020-03-28T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1720.0, \"deceased\": 15.0, \"population\": 1520968, \"positive_100k\": 113.08587688892862, \"deceased_100k\": 0.9862140426360054, \"sinceDay0\": 1}, {\"index\": 311, \"date\": \"2020-03-29T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1758.0, \"deceased\": 15.0, \"population\": 1520968, \"positive_100k\": 115.58428579693985, \"deceased_100k\": 0.9862140426360054, \"sinceDay0\": 2}, {\"index\": 312, \"date\": \"2020-03-30T00:00:00\", \"country\": \"CHE\", \"region_iso\": \"CH-ZH\", \"region_label\": \"Z\\u00fcrich\", \"tested\": null, \"positive\": 1874.0, \"deceased\": 21.0, \"population\": 1520968, \"positive_100k\": 123.2110077266583, \"deceased_100k\": 1.3806996596904075, \"sinceDay0\": 3}]}}, {\"mode\": \"vega-lite\"});\n</script>", + "text/plain": "alt.HConcatChart(...)" + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "since_df_deceased = helper.make_since_df(df_all[df_all.region_label.isin(['Lombardy', 'Ticino', 'Vaud', 'Geneva','Zürich'])], column='deceased', region_column='region_label', start_case=10)\n", + "base = alt.Chart(since_df_deceased).properties(height=300,width=300)\n", + "days_log = plotting.make_region_since_chart(base, 'deceased', 'sinceDay0', 'region_label', 'Days since 10th death', 'Deaths', 'Deaths', 'Region')\n", + "days_log_100k = plotting.make_region_since_chart(base, 'deceased_100k', 'sinceDay0', 'region_label', 'Days since 100th case', 'Deaths/100k', 'Deaths/100k', 'Region')\n", + "alt.hconcat(days_log, days_log_100k)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ] +} \ No newline at end of file diff --git a/src/covid-19/covid_19_dashboard/covid_19_dashboard/__init__.py b/src/covid-19/covid_19_dashboard/covid_19_dashboard/__init__.py index b0b17a303dd1171a722508d4b0593f499ed99ec4..157af333f16b8e145958993fab92eb54df95aad0 100644 --- a/src/covid-19/covid_19_dashboard/covid_19_dashboard/__init__.py +++ b/src/covid-19/covid_19_dashboard/covid_19_dashboard/__init__.py @@ -4,4 +4,6 @@ __author__ = """Chandrasekhar Ramakrishnan""" __email__ = 'cramakri@ethz.ch' __version__ = '0.1.0' +from .converters import italy, switzerland + from .helper import * \ No newline at end of file diff --git a/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/__init__.py b/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b8ee7cfea4c5866367fbf5d5f1593b2d2df838d3 --- /dev/null +++ b/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/__init__.py @@ -0,0 +1,48 @@ +""" + +A set of data converters to standardize various covid-19 datasets +into a common format. + +""" + +import pandas as pd + +from .. import helper + +class CaseConverter(object): + """Base converter class.""" + + _converter_registry = [] + + conversion_dict = {} + column_list = [] + common_columns = [ + "date", + "country", + "region_iso", + "region_label", + "tested", + "positive", + "deceased", + "population", + "positive_100k", + "deceased_100k" + ] + + @classmethod + def can_convert(cls, df): + """Returns true if the class can convert the Dataframe.""" + return all([col in df.columns for col in cls.column_list]) + + @classmethod + def convert(cls, df): + """Converts the Dataframe into the common format.""" + for converter in cls._converter_registry: + if converter.can_convert(df): + return converter.convert(df) + raise NotImplementedError("DataFrame could not be converted") + + @classmethod + def _register(cls): + CaseConverter._converter_registry.append(cls) + diff --git a/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/italy.py b/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/italy.py new file mode 100644 index 0000000000000000000000000000000000000000..7e04ddff4e79c06e18fea25ab8f8b3a5783e2846 --- /dev/null +++ b/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/italy.py @@ -0,0 +1,69 @@ +""" +Converters for covid-19 data from Italy. +""" + +import pandas as pd + +from . import CaseConverter +from .. import helper + + +class ItalyCaseConverter(CaseConverter): + """ + Converter for data from Italian Civil Protection + and made available at https://github.com/pcm-dpc/COVID-19 + """ + + conversion_dict = { + "data": "date", + "totale_casi": "positive", + "tamponi": "tested", + "deceduti": "deceased", + "stato": "country", + "codice_regione": "istatid", + } + + column_list = ["data", "stato", "codice_regione", "denominazione_regione"] + + @classmethod + def convert(cls, df): + # rename the existing columns + df_conv = df.rename(columns=cls.conversion_dict) + + # get metadata for regions of italy + metadata = pd.DataFrame( + helper.get_region_populations( + "ITA", + additional_fields="?istatid", + additional_query="?region wdt:P635 ?istatid .", + ) + ) + metadata["istatid"] = metadata.istatid.astype(int) + df_conv = _correct_trentino(df_conv) + merged = pd.merge(df_conv, metadata, on='istatid').drop_duplicates() + merged = merged.rename(columns={"regionLabel": "region_label"}) + + # calculate incidence rates + merged['population'] = merged.population.astype(int) + merged['positive_100k'] = merged['positive'] / merged['population'] * 100000 + merged['deceased_100k'] = merged['deceased'] / merged['population'] * 100000 + + return merged[CaseConverter.common_columns] + + +def _correct_trentino(df): + """Merge Bolzano and Trento.""" + # The regional data includes Bolzano and Trento separate regions - they are + # two provinces of the Trentino Alto Adige region, so merge them together + + df_trentino_alto_adige = df.loc[df['istatid'] == 4].groupby('date').sum().reset_index() + df_trentino_alto_adige['istatid'] = 4 + df_trentino_alto_adige['latitude'] = 46.4337 + df_trentino_alto_adige['longitude'] = 11.1693 + df_trentino_alto_adige['denominazione_regione'] = 'Trentino Alto Adige' + df_trentino_alto_adige['country'] = 'ITA' + df = df[df['istatid'] !=4 ].append(df_trentino_alto_adige) + return df + + +ItalyCaseConverter._register() diff --git a/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/switzerland.py b/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/switzerland.py new file mode 100644 index 0000000000000000000000000000000000000000..1fbf87ddce3202c9ffc398be6710fed41b721afb --- /dev/null +++ b/src/covid-19/covid_19_dashboard/covid_19_dashboard/converters/switzerland.py @@ -0,0 +1,69 @@ +""" +Covid-19 converters for data from Switzerland. +""" + +import pandas as pd + +from . import CaseConverter +from .. import helper + +class OpenZHCaseConverter(CaseConverter): + """ + Converter for data from Switzerland, collected by + OpenData Zürich and hosted at https://github.com/openZH/covid_19/ + """ + + conversion_dict = { + "ncumul_tested": "tested", + "ncumul_conf": "positive", + "ncumul_deceased": "deceased", + "abbreviation_canton_and_fl": "region_iso", + } + column_list = [ + "date", + "time", + "abbreviation_canton_and_fl", + "ncumul_tested", + "ncumul_conf", + "ncumul_hosp", + "ncumul_ICU", + "ncumul_vent", + "ncumul_released", + "ncumul_deceased", + "source", + ] + + @classmethod + def convert(cls, df): + # rename the existing columns + df_conv = df.rename(columns=cls.conversion_dict) + + # make cantons iso-3116 compliant + df_conv["region_iso"] = df_conv.apply( + lambda row: f'CH-{row["region_iso"]}', axis=1 + ) + + # get metadata for swiss cantons + metadata = pd.DataFrame(helper.get_region_populations("CHE")) + merged = pd.merge(df_conv, metadata, on='region_iso').drop_duplicates() + merged["country"] = "CHE" + + # standardize the canton names + merged['regionLabel'] = merged.apply(lambda row: _standardize_canton_name(row['regionLabel']), axis=1) + merged = merged.rename(columns={"regionLabel": "region_label"}) + + # calculate incidence rates + merged['population'] = merged.population.astype(int) + merged['positive_100k'] = merged['positive'] / merged['population'] * 100000 + merged['deceased_100k'] = merged['deceased'] / merged['population'] * 100000 + + return merged[CaseConverter.common_columns] + + +def _standardize_canton_name(label): + label = label.lower() + if label.startswith('canton of'): + label = label[len('canton of'):].strip() + return label.capitalize() + +OpenZHCaseConverter._register() \ No newline at end of file diff --git a/src/covid-19/covid_19_dashboard/covid_19_dashboard/helper.py b/src/covid-19/covid_19_dashboard/covid_19_dashboard/helper.py index 05deeed6eaf5ed5c8e095caa7ed8f250d8aec67d..163e7a863dbd2c5885307c454fb662d0b703b652 100644 --- a/src/covid-19/covid_19_dashboard/covid_19_dashboard/helper.py +++ b/src/covid-19/covid_19_dashboard/covid_19_dashboard/helper.py @@ -153,28 +153,30 @@ def growth_df(rates_frames_map, geodata_df, name, countries_over_thresh, cutoff) return confirmed_rate_df -def get_region_populations(country_iso3): +def get_region_populations(country_iso3, additional_fields="", additional_query=""): import sys from SPARQLWrapper import SPARQLWrapper, JSON endpoint_url = "https://query.wikidata.org/sparql" query = """ - SELECT DISTINCT ?population ?region_iso ?regionLabel + SELECT DISTINCT ?region_iso ?regionLabel {additional_fields} (MAX(?population_cnt) as ?population) {{ # select country by its iso-3 ?country wdt:P298 "{country_iso3}" . # region has an iso ?iso ?region wdt:P300 ?region_iso . - # region has a population of ?population - ?region wdt:P1082 ?population . + # region has a population of ?population_cnt + ?region wdt:P1082 ?population_cnt . # country contains region ?region ?country wdt:P150 ?region . # country is an instance of sovereign state ?country wdt:P31 wd:Q3624078 . + {additional_query} SERVICE wikibase:label {{ bd:serviceParam wikibase:language "en" }} }} + GROUP BY ?region_iso ?regionLabel {additional_fields} """ def get_results(endpoint_url, query): @@ -188,12 +190,20 @@ def get_region_populations(country_iso3): sparql.setReturnFormat(JSON) return sparql.query().convert() - results = get_results(endpoint_url, query.format(country_iso3=country_iso3)) + results = get_results( + endpoint_url, + query.format( + country_iso3=country_iso3, + additional_fields=additional_fields, + additional_query=additional_query, + ), + ) - return { - result["region_iso"]["value"]: int(result["population"]["value"]) - for result in results["results"]["bindings"] - } + res = [] + for binding in results["results"]["bindings"]: + res.append({k: v["value"] for k, v in binding.items()}) + + return res def make_since_df(df, column="positive", region_column="state", start_case=100): @@ -211,4 +221,4 @@ def make_since_df(df, column="positive", region_column="state", start_case=100): since_df.loc[df.index, "sinceDay0"] = range(0, len(df)) since_df = since_df.astype({"sinceDay0": "int32"}) - return since_df \ No newline at end of file + return since_df diff --git a/src/covid-19/covid_19_dashboard/covid_19_dashboard/italy_utils.py b/src/covid-19/covid_19_dashboard/covid_19_dashboard/italy_utils.py index 6bc392b1c08980a59c5aba4d727d213c16448cc1..e8254c90a8b2458d738c950b9300c632977a2d04 100644 --- a/src/covid-19/covid_19_dashboard/covid_19_dashboard/italy_utils.py +++ b/src/covid-19/covid_19_dashboard/covid_19_dashboard/italy_utils.py @@ -2,7 +2,6 @@ import json import os import pandas as pd - def translate_columns(data_folder, df, description_filename): description_file_path = os.path.join(data_folder, description_filename)