From c118a76a81b1e21a32def46e37077fce8e70d33b Mon Sep 17 00:00:00 2001 From: FK Date: Tue, 17 Jan 2023 17:25:17 +0000 Subject: [PATCH] updating data for Intensivstationen --- .../Intensivstationen.nbconvert.ipynb | 111 +++++++++--------- 1 file changed, 53 insertions(+), 58 deletions(-) diff --git a/src/intensivstationen/Intensivstationen.nbconvert.ipynb b/src/intensivstationen/Intensivstationen.nbconvert.ipynb index fe6afcbb718..896ba92b986 100644 --- a/src/intensivstationen/Intensivstationen.nbconvert.ipynb +++ b/src/intensivstationen/Intensivstationen.nbconvert.ipynb @@ -6,10 +6,10 @@ "id": "9de5907f-18f5-4cb1-903e-26028ff1fa03", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:57:49.209454Z", - "iopub.status.busy": "2023-01-17T15:57:49.209240Z", - "iopub.status.idle": "2023-01-17T15:57:49.217133Z", - "shell.execute_reply": "2023-01-17T15:57:49.216485Z" + "iopub.execute_input": "2023-01-17T17:24:41.450664Z", + "iopub.status.busy": "2023-01-17T17:24:41.450476Z", + "iopub.status.idle": "2023-01-17T17:24:41.457865Z", + "shell.execute_reply": "2023-01-17T17:24:41.457166Z" } }, "outputs": [], @@ -28,10 +28,10 @@ "id": "640be762", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:57:49.220118Z", - "iopub.status.busy": "2023-01-17T15:57:49.219809Z", - "iopub.status.idle": "2023-01-17T15:57:49.785321Z", - "shell.execute_reply": "2023-01-17T15:57:49.784627Z" + "iopub.execute_input": "2023-01-17T17:24:41.460425Z", + "iopub.status.busy": "2023-01-17T17:24:41.460143Z", + "iopub.status.idle": "2023-01-17T17:24:41.962754Z", + "shell.execute_reply": "2023-01-17T17:24:41.962174Z" } }, "outputs": [], @@ -60,10 +60,10 @@ "id": "e40d4c8d", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:57:49.788836Z", - "iopub.status.busy": "2023-01-17T15:57:49.788257Z", - "iopub.status.idle": "2023-01-17T15:57:49.794048Z", - "shell.execute_reply": "2023-01-17T15:57:49.791712Z" + "iopub.execute_input": "2023-01-17T17:24:41.966046Z", + "iopub.status.busy": "2023-01-17T17:24:41.965591Z", + "iopub.status.idle": "2023-01-17T17:24:41.970620Z", + "shell.execute_reply": "2023-01-17T17:24:41.968736Z" } }, "outputs": [ @@ -71,7 +71,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "17.01.2023, 15:57:49 Uhr\n" + "17.01.2023, 17:24:41 Uhr\n" ] } ], @@ -85,10 +85,10 @@ "id": "336f56e6", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:57:49.796830Z", - "iopub.status.busy": "2023-01-17T15:57:49.796510Z", - "iopub.status.idle": "2023-01-17T15:58:01.904427Z", - "shell.execute_reply": "2023-01-17T15:58:01.903701Z" + "iopub.execute_input": "2023-01-17T17:24:41.973057Z", + "iopub.status.busy": "2023-01-17T17:24:41.972866Z", + "iopub.status.idle": "2023-01-17T17:24:54.400927Z", + "shell.execute_reply": "2023-01-17T17:24:54.400333Z" } }, "outputs": [ @@ -116,10 +116,10 @@ "id": "63be303c", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:01.908123Z", - "iopub.status.busy": "2023-01-17T15:58:01.907667Z", - "iopub.status.idle": "2023-01-17T15:58:01.928789Z", - "shell.execute_reply": "2023-01-17T15:58:01.928207Z" + "iopub.execute_input": "2023-01-17T17:24:54.403905Z", + "iopub.status.busy": "2023-01-17T17:24:54.403378Z", + "iopub.status.idle": "2023-01-17T17:24:54.423700Z", + "shell.execute_reply": "2023-01-17T17:24:54.423190Z" } }, "outputs": [], @@ -135,10 +135,10 @@ "id": "3f992231", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:01.931829Z", - "iopub.status.busy": "2023-01-17T15:58:01.931412Z", - "iopub.status.idle": "2023-01-17T15:58:06.420879Z", - "shell.execute_reply": "2023-01-17T15:58:06.420213Z" + "iopub.execute_input": "2023-01-17T17:24:54.426285Z", + "iopub.status.busy": "2023-01-17T17:24:54.425840Z", + "iopub.status.idle": "2023-01-17T17:24:59.508051Z", + "shell.execute_reply": "2023-01-17T17:24:59.507500Z" } }, "outputs": [ @@ -346,10 +346,10 @@ "id": "356494d3", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:06.424071Z", - "iopub.status.busy": "2023-01-17T15:58:06.423708Z", - "iopub.status.idle": "2023-01-17T15:58:06.545961Z", - "shell.execute_reply": "2023-01-17T15:58:06.545252Z" + "iopub.execute_input": "2023-01-17T17:24:59.511018Z", + "iopub.status.busy": "2023-01-17T17:24:59.510522Z", + "iopub.status.idle": "2023-01-17T17:24:59.630075Z", + "shell.execute_reply": "2023-01-17T17:24:59.629524Z" } }, "outputs": [], @@ -366,10 +366,10 @@ "id": "349edd73", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:06.549716Z", - "iopub.status.busy": "2023-01-17T15:58:06.549338Z", - "iopub.status.idle": "2023-01-17T15:58:19.256300Z", - "shell.execute_reply": "2023-01-17T15:58:19.255673Z" + "iopub.execute_input": "2023-01-17T17:24:59.633222Z", + "iopub.status.busy": "2023-01-17T17:24:59.632925Z", + "iopub.status.idle": "2023-01-17T17:25:11.122549Z", + "shell.execute_reply": "2023-01-17T17:25:11.121647Z" } }, "outputs": [ @@ -3852,10 +3852,10 @@ "id": "f10704f3", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:19.259603Z", - "iopub.status.busy": "2023-01-17T15:58:19.259226Z", - "iopub.status.idle": "2023-01-17T15:58:19.305331Z", - "shell.execute_reply": "2023-01-17T15:58:19.304671Z" + "iopub.execute_input": "2023-01-17T17:25:11.125188Z", + "iopub.status.busy": "2023-01-17T17:25:11.124873Z", + "iopub.status.idle": "2023-01-17T17:25:11.165859Z", + "shell.execute_reply": "2023-01-17T17:25:11.164370Z" } }, "outputs": [], @@ -3872,10 +3872,10 @@ "id": "d1b75357", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:19.308701Z", - "iopub.status.busy": "2023-01-17T15:58:19.308347Z", - "iopub.status.idle": "2023-01-17T15:58:19.312190Z", - "shell.execute_reply": "2023-01-17T15:58:19.311488Z" + "iopub.execute_input": "2023-01-17T17:25:11.168918Z", + "iopub.status.busy": "2023-01-17T17:25:11.168467Z", + "iopub.status.idle": "2023-01-17T17:25:11.171983Z", + "shell.execute_reply": "2023-01-17T17:25:11.171384Z" } }, "outputs": [], @@ -3893,35 +3893,30 @@ "id": "8b392b34", "metadata": { "execution": { - "iopub.execute_input": "2023-01-17T15:58:19.315108Z", - "iopub.status.busy": "2023-01-17T15:58:19.314596Z", - "iopub.status.idle": "2023-01-17T15:58:19.737632Z", - "shell.execute_reply": "2023-01-17T15:58:19.736867Z" + "iopub.execute_input": "2023-01-17T17:25:11.174716Z", + "iopub.status.busy": "2023-01-17T17:25:11.174431Z", + "iopub.status.idle": "2023-01-17T17:25:14.966101Z", + "shell.execute_reply": "2023-01-17T17:25:14.965472Z" } }, "outputs": [ { - "ename": "UndefinedValueError", - "evalue": "DATAWRAPPER_API_TOKEN not found. Declare it as envvar or define a default value.", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mUndefinedValueError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[11], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mcreateMedianOfFreeBedsByKreisChart\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeSeries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[43m \u001b[49m\u001b[43mchartTitle\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mgetChartTitle\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43mdateStart\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeSeries\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mdate\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mdateEnd\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeSeries\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mdate\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/Chart.py:9\u001b[0m, in \u001b[0;36mcreateMedianOfFreeBedsByKreisChart\u001b[0;34m(timeSeries, chartTitle)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreateMedianOfFreeBedsByKreisChart\u001b[39m(timeSeries, chartTitle):\n\u001b[0;32m----> 9\u001b[0m dataWrapper \u001b[38;5;241m=\u001b[39m Datawrapper(\u001b[43mAutoConfig\u001b[49m\u001b[43m(\u001b[49m\u001b[43msearch_path\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m../..\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mDATAWRAPPER_API_TOKEN\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 10\u001b[0m dataWrapper\u001b[38;5;241m.\u001b[39msetChartTitle(chartTitle)\n\u001b[1;32m 11\u001b[0m dataWrapper\u001b[38;5;241m.\u001b[39muploadChartData(data \u001b[38;5;241m=\u001b[39m _createMedianOfFreeBedsByKreisTableForChoroplethMap(timeSeries))\n", - "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/decouple.py:245\u001b[0m, in \u001b[0;36mAutoConfig.__call__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 242\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig:\n\u001b[1;32m 243\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_load(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msearch_path \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_caller_path())\n\u001b[0;32m--> 245\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/decouple.py:107\u001b[0m, in \u001b[0;36mConfig.__call__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 104\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 105\u001b[0m \u001b[38;5;124;03m Convenient shortcut to get.\u001b[39;00m\n\u001b[1;32m 106\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 107\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/decouple.py:92\u001b[0m, in \u001b[0;36mConfig.get\u001b[0;34m(self, option, default, cast)\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 91\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(default, Undefined):\n\u001b[0;32m---> 92\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m UndefinedValueError(\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m not found. Declare it as envvar or define a default value.\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mformat(option))\n\u001b[1;32m 94\u001b[0m value \u001b[38;5;241m=\u001b[39m default\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(cast, Undefined):\n", - "\u001b[0;31mUndefinedValueError\u001b[0m: DATAWRAPPER_API_TOKEN not found. Declare it as envvar or define a default value." + "name": "stdout", + "output_type": "stream", + "text": [ + "publishChart: {'data': {'publicId': 'dYmYb', 'language': 'de-DE', 'theme': 'datawrapper', 'id': 'dYmYb', 'type': 'd3-maps-choropleth', 'title': 'Median freier Intensivbetten im Zeitraum 24.04.2020 bis 17.01.2023', 'lastEditStep': 5, 'publishedAt': '2023-01-17T17:25:14.723Z', 'publicUrl': 'https://datawrapper.dwcdn.net/dYmYb/320/', 'publicVersion': 320, 'deleted': False, 'deletedAt': None, 'forkable': True, 'isFork': False, 'metadata': {'data': {'changes': [], 'transpose': False, 'vertical-header': True, 'horizontal-header': True, 'column-format': {'ags': {'type': 'text'}, 'Kreis': {'type': 'text'}, 'Einwohnerzahl': {'type': 'number', 'number-append': '', 'number-format': 'auto', 'number-divisor': 0, 'number-prepend': ''}, 'gemeindeschluessel': {'type': 'text'}, 'median_free_beds_in_percent': {'type': 'number'}}, 'upload-method': 'upload'}, 'describe': {'source-name': 'Landkreis-Daten', 'source-url': 'https://www.intensivregister.de/#/aktuelle-lage/downloads', 'intro': '', 'byline': '', 'aria-description': '', 'number-format': '-', 'number-divisor': 0, 'number-append': '', 'number-prepend': '', 'hide-title': False}, 'visualize': {'dark-mode-invert': True, 'highlighted-series': [], 'highlighted-values': [], 'sharing': {'enabled': False, 'auto': True}, 'labels': {'max': 33, 'type': 'places', 'places': [], 'enabled': False}, 'legend': {'size': 170, 'title': '', 'labels': 'ranges', 'enabled': True, 'reverse': True, 'labelMax': 'high', 'labelMin': 'low', 'position': 'mt', 'hideItems': [], 'offsetTop': 0, 'offsetLeft': 0, 'interactive': True, 'labelCenter': 'medium', 'labelFormat': '0%', 'orientation': 'horizontal', 'customLabels': ['Group A', 'Group B', 'Group C']}, 'basemap': 'germany-kreise-2021', 'tooltip': {'body': 'Median freier Intensivbetten: {{ FORMAT(median_free_beds_in_percent, \"0.0%\") }}\\n\\n', 'title': '{{ kreis }}', 'sticky': True, 'enabled': True}, 'zoomable': True, 'map-align': 'center', 'colorscale': {'map': [], 'mode': 'discrete', 'stops': 'custom', 'colors': [{'color': '#F03B20', 'position': 0}, {'color': '#FEB24C', 'position': 0.5}, {'color': '#38A800', 'position': 1}], 'palette': 0, 'rangeMax': '100', 'rangeMin': '0', 'stopCount': 3, 'customStops': [None, '10', '25', None, 45.5, 56.1, None], 'rangeCenter': '', 'categoryOrder': [], 'interpolation': 'equidistant', 'categoryLabels': []}, 'max-height': 650, 'map-padding': 0, 'map-key-attr': 'ags', 'map-type-set': True, 'chart-type-set': True, 'max-map-height': 650, 'min-label-zoom': 1, 'zoom-button-pos': 'br', 'map-label-format': '0,0.[00]', 'text-annotations': [], 'hide-empty-regions': False, 'avoid-label-overlap': True}, 'axes': {'keys': 'gemeindeschluessel', 'values': 'median_free_beds_in_percent'}, 'publish': {'embed-width': 600, 'embed-height': 785, 'blocks': {'logo': {'enabled': False}, 'embed': True, 'download-pdf': False, 'download-svg': False, 'get-the-data': True, 'download-image': True}, 'export-pdf': {}, 'embed-codes': {'embed-method-responsive': '', 'embed-method-iframe': ''}, 'chart-height': 673.13330078125}, 'annotate': {'notes': ''}, 'custom': {}, 'json_error': None}, 'externalData': '', 'utf8': False, 'createdAt': '2022-03-25T16:27:58.000Z', 'lastModifiedAt': '2023-01-17T17:25:14.723Z', 'forkedFrom': None, 'organizationId': None, 'authorId': 433861, 'folderId': None}, 'version': 320, 'url': 'https://datawrapper.dwcdn.net/dYmYb/320/'}\n" ] } ], "source": [ + "import os\n", + "\n", "createMedianOfFreeBedsByKreisChart(\n", " timeSeries,\n", " chartTitle = getChartTitle(\n", " dateStart=timeSeries['date'].min(),\n", - " dateEnd=timeSeries['date'].max()))" + " dateEnd=timeSeries['date'].max()),\n", + " accessToken = os.environ['DATAWRAPPER_API_TOKEN'])" ] } ],