diff --git a/src/intensivstationen/Intensivstationen.nbconvert.ipynb b/src/intensivstationen/Intensivstationen.nbconvert.ipynb index e3e53fe870d..9bb116b906c 100644 --- a/src/intensivstationen/Intensivstationen.nbconvert.ipynb +++ b/src/intensivstationen/Intensivstationen.nbconvert.ipynb @@ -6,59 +6,77 @@ "id": "9de5907f-18f5-4cb1-903e-26028ff1fa03", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:33:15.922037Z", - "iopub.status.busy": "2022-12-05T13:33:15.921181Z", - "iopub.status.idle": "2022-12-05T13:33:16.274097Z", - "shell.execute_reply": "2022-12-05T13:33:16.273561Z" + "iopub.execute_input": "2023-01-17T14:25:20.046543Z", + "iopub.status.busy": "2023-01-17T14:25:20.046232Z", + "iopub.status.idle": "2023-01-17T14:25:20.053776Z", + "shell.execute_reply": "2023-01-17T14:25:20.053215Z" } }, "outputs": [], "source": [ - "import pandas as pd\n", - "from urllib import request\n", + "import os\n", + "import sys\n", "\n", - "pd.set_option('display.max_rows', 100)\n", - "pd.set_option('display.max_columns', None)\n", - "pd.set_option('mode.chained_assignment', 'raise')" + "module_path = os.path.abspath(os.path.join('..'))\n", + "if module_path not in sys.path:\n", + " sys.path.append(module_path)\n" ] }, { "cell_type": "code", "execution_count": 2, - "id": "e40d4c8d", + "id": "640be762", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:33:16.277294Z", - "iopub.status.busy": "2022-12-05T13:33:16.276717Z", - "iopub.status.idle": "2022-12-05T13:33:16.280833Z", - "shell.execute_reply": "2022-12-05T13:33:16.280184Z" + "iopub.execute_input": "2023-01-17T14:25:20.056419Z", + "iopub.status.busy": "2023-01-17T14:25:20.055982Z", + "iopub.status.idle": "2023-01-17T14:25:20.913002Z", + "shell.execute_reply": "2023-01-17T14:25:20.912373Z" } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "05.12.2022, 14:33:16 Uhr\n" + "ename": "ModuleNotFoundError", + "evalue": "No module named 'decouple'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[2], line 11\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mKreisOptionsProvider\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m getKreisOptionsAndAlleLandkreise\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mIntensiveCareBedsPersister\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m getAndPersistIntensiveCareBeds4AlleKreise\n\u001b[0;32m---> 11\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mChart\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m createMedianOfFreeBedsByKreisChart\n\u001b[1;32m 14\u001b[0m pd\u001b[38;5;241m.\u001b[39mset_option(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdisplay.max_rows\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;241m100\u001b[39m)\n\u001b[1;32m 15\u001b[0m pd\u001b[38;5;241m.\u001b[39mset_option(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdisplay.max_columns\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n", + "File \u001b[0;32m~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/Chart.py:1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdecouple\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AutoConfig\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mDatawrapper\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Datawrapper\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mColumnsAdder\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ColumnsAdder\n", + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'decouple'" ] } ], "source": [ + "import pandas as pd\n", + "from DateProvider import DateProvider\n", "from datetime import datetime\n", + "from ColumnsAdder import ColumnsAdder\n", + "from MedianOfFreeBedsByKreisTableFactory import MedianOfFreeBedsByKreisTableFactory\n", + "from TimeseriesReader import readTimeseries\n", + "from IntensivstationenHtmlFileUpdater import saveLastUpdatedIntensivstationen, saveKreisOptions\n", + "from KreiseReader import readKreise\n", + "from KreisOptionsProvider import getKreisOptionsAndAlleLandkreise\n", + "from IntensiveCareBedsPersister import getAndPersistIntensiveCareBeds4AlleKreise\n", + "from Chart import createMedianOfFreeBedsByKreisChart\n", "\n", - "print(datetime.now().strftime(\"%d.%m.%Y, %H:%M:%S Uhr\"))" + "\n", + "pd.set_option('display.max_rows', 100)\n", + "pd.set_option('display.max_columns', None)\n", + "pd.set_option('mode.chained_assignment', 'raise')\n" ] }, { "cell_type": "code", "execution_count": 3, - "id": "579c0911", + "id": "e40d4c8d", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:33:16.284148Z", - "iopub.status.busy": "2022-12-05T13:33:16.283939Z", - "iopub.status.idle": "2022-12-05T13:33:16.989074Z", - "shell.execute_reply": "2022-12-05T13:33:16.986448Z" + "iopub.execute_input": "2023-01-17T14:25:20.916234Z", + "iopub.status.busy": "2023-01-17T14:25:20.915769Z", + "iopub.status.idle": "2023-01-17T14:25:20.920845Z", + "shell.execute_reply": "2023-01-17T14:25:20.920219Z" } }, "outputs": [ @@ -66,111 +84,24 @@ "name": "stdout", "output_type": "stream", "text": [ - "/home/frankknoll/Dokumente/Corona/projects/HowBadIsMyBatch/src/intensivstationen\r\n" + "17.01.2023, 14:25:20 Uhr\n" ] } ], "source": [ - "! pwd" + "print(datetime.now().strftime(\"%d.%m.%Y, %H:%M:%S Uhr\"))" ] }, { "cell_type": "code", "execution_count": 4, - "id": "dfa836ec", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:33:16.999683Z", - "iopub.status.busy": "2022-12-05T13:33:16.998858Z", - "iopub.status.idle": "2022-12-05T13:33:17.009146Z", - "shell.execute_reply": "2022-12-05T13:33:17.007377Z" - } - }, - "outputs": [], - "source": [ - "needsUpdate = False" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "79de4057", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:33:17.019274Z", - "iopub.status.busy": "2022-12-05T13:33:17.017784Z", - "iopub.status.idle": "2022-12-05T13:33:17.166150Z", - "shell.execute_reply": "2022-12-05T13:33:17.165518Z" - } - }, - "outputs": [], - "source": [ - "from bs4 import BeautifulSoup\n", - "import requests\n", - "from datetime import datetime\n", - "from time import sleep\n", - "from selenium import webdriver\n", - "from selenium.webdriver.firefox.options import Options\n", - "\n", - "class DateProvider:\n", - " \n", - " INTENSIVSTATIONEN_DATE_FORMAT = \"%d.%m.%Y, %H:%M Uhr\"\n", - "\n", - " def __init__(self):\n", - " self.lastUpdated = None\n", - " self.lastUpdatedDataSource = None\n", - "\n", - " def needsUpdate(self):\n", - " return self.getLastUpdated() < self.getLastUpdatedDataSource()\n", - " \n", - " def getLastUpdated(self):\n", - " if self.lastUpdated is None:\n", - " htmlContent = requests.get(\"https://knollfrank.github.io/HowBadIsMyBatch/intensivstationen.html\").text\n", - " soup = BeautifulSoup(htmlContent, \"lxml\")\n", - " dateStr = soup.find(id = \"Datenstand\").text\n", - " self.lastUpdated = datetime.strptime(dateStr, DateProvider.INTENSIVSTATIONEN_DATE_FORMAT)\n", - " \n", - " return self.lastUpdated\n", - "\n", - " def getLastUpdatedDataSource(self):\n", - " if self.lastUpdatedDataSource is None:\n", - " html = self._getOriginalHtml()\n", - " lastUpdatedColumn = 'Letzte Änderung'\n", - " dataFrame = self._asDataFrame(html, lastUpdatedColumn)\n", - " self.lastUpdatedDataSource = dataFrame.loc['Landkreis-Daten', lastUpdatedColumn].to_pydatetime()\n", - "\n", - " return self.lastUpdatedDataSource\n", - "\n", - " def _getOriginalHtml(self):\n", - " options = Options()\n", - " options.headless = True\n", - " options.add_argument(\"-profile\")\n", - " # put the root directory your default profile path here, you can check it by opening Firefox and then pasting 'about:profiles' into the url field \n", - " options.add_argument(\"/home/frankknoll/snap/firefox/common/.mozilla/firefox/1j6r2yp6.default\")\n", - " driver = webdriver.Firefox(options = options)\n", - " driver.get('https://www.intensivregister.de/#/aktuelle-lage/downloads')\n", - " sleep(10)\n", - " innerHTML = driver.execute_script(\"return document.body.innerHTML\")\n", - " driver.quit()\n", - " return innerHTML\n", - "\n", - " def _asDataFrame(self, html, lastUpdatedColumn):\n", - " dataFrame = pd.read_html(html, parse_dates = [lastUpdatedColumn])[0]\n", - " dataFrame[lastUpdatedColumn] = pd.to_datetime(dataFrame[lastUpdatedColumn], format = \"%d.%m.%Y %H:%M Uhr\")\n", - " dataFrame.set_index('Name', inplace = True)\n", - " return dataFrame\n" - ] - }, - { - "cell_type": "code", - "execution_count": 6, "id": "336f56e6", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:33:17.169436Z", - "iopub.status.busy": "2022-12-05T13:33:17.168987Z", - "iopub.status.idle": "2022-12-05T13:33:31.118196Z", - "shell.execute_reply": "2022-12-05T13:33:31.117473Z" + "iopub.execute_input": "2023-01-17T14:25:20.923692Z", + "iopub.status.busy": "2023-01-17T14:25:20.923250Z", + "iopub.status.idle": "2023-01-17T14:25:21.928844Z", + "shell.execute_reply": "2023-01-17T14:25:21.928050Z" } }, "outputs": [ @@ -178,9 +109,25 @@ "name": "stdout", "output_type": "stream", "text": [ - " lastUpdated: 2022-11-30 12:49:00\n", - "lastUpdatedDataSource: 2022-12-05 12:49:00\n", - "needsUpdate: True\n" + " lastUpdated: 2023-01-14 12:49:00\n" + ] + }, + { + "ename": "SessionNotCreatedException", + "evalue": "Message: Failed to set preferences: Unable to write Firefox profile: No such file or directory (os error 2)\n", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mSessionNotCreatedException\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[4], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m dateProvider \u001b[38;5;241m=\u001b[39m DateProvider()\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m lastUpdated:\u001b[39m\u001b[38;5;124m'\u001b[39m, dateProvider\u001b[38;5;241m.\u001b[39mgetLastUpdated())\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlastUpdatedDataSource:\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[43mdateProvider\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetLastUpdatedDataSource\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m) \n\u001b[1;32m 4\u001b[0m needsUpdate \u001b[38;5;241m=\u001b[39m dateProvider\u001b[38;5;241m.\u001b[39mneedsUpdate()\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mneedsUpdate:\u001b[39m\u001b[38;5;124m'\u001b[39m, needsUpdate)\n", + "File \u001b[0;32m~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/DateProvider.py:31\u001b[0m, in \u001b[0;36mDateProvider.getLastUpdatedDataSource\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetLastUpdatedDataSource\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 30\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlastUpdatedDataSource \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 31\u001b[0m html \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_getOriginalHtml\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 32\u001b[0m lastUpdatedColumn \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mLetzte Änderung\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 33\u001b[0m dataFrame \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_asDataFrame(html, lastUpdatedColumn)\n", + "File \u001b[0;32m~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/DateProvider.py:44\u001b[0m, in \u001b[0;36mDateProvider._getOriginalHtml\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# put the root directory your default profile path here, you can check it by opening Firefox and then pasting 'about:profiles' into the url field \u001b[39;00m\n\u001b[1;32m 43\u001b[0m options\u001b[38;5;241m.\u001b[39madd_argument(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/home/frankknoll/snap/firefox/common/.mozilla/firefox/1j6r2yp6.default\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 44\u001b[0m driver \u001b[38;5;241m=\u001b[39m \u001b[43mwebdriver\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mFirefox\u001b[49m\u001b[43m(\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 45\u001b[0m driver\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://www.intensivregister.de/#/aktuelle-lage/downloads\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 46\u001b[0m sleep(\u001b[38;5;241m10\u001b[39m)\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py:197\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, firefox_profile, firefox_binary, capabilities, proxy, executable_path, options, service_log_path, service_args, service, desired_capabilities, log_path, keep_alive)\u001b[0m\n\u001b[1;32m 192\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mservice\u001b[38;5;241m.\u001b[39mstart()\n\u001b[1;32m 194\u001b[0m executor \u001b[38;5;241m=\u001b[39m FirefoxRemoteConnection(\n\u001b[1;32m 195\u001b[0m remote_server_addr\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mservice\u001b[38;5;241m.\u001b[39mservice_url, ignore_proxy\u001b[38;5;241m=\u001b[39moptions\u001b[38;5;241m.\u001b[39m_ignore_local_proxy\n\u001b[1;32m 196\u001b[0m )\n\u001b[0;32m--> 197\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mcommand_executor\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecutor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_remote \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:288\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)\u001b[0m\n\u001b[1;32m 286\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_authenticator_id \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 287\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstart_client()\n\u001b[0;32m--> 288\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart_session\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcapabilities\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbrowser_profile\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:381\u001b[0m, in \u001b[0;36mWebDriver.start_session\u001b[0;34m(self, capabilities, browser_profile)\u001b[0m\n\u001b[1;32m 379\u001b[0m w3c_caps \u001b[38;5;241m=\u001b[39m _make_w3c_caps(capabilities)\n\u001b[1;32m 380\u001b[0m parameters \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapabilities\u001b[39m\u001b[38;5;124m\"\u001b[39m: w3c_caps}\n\u001b[0;32m--> 381\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mCommand\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mNEW_SESSION\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 382\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msessionId\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m response:\n\u001b[1;32m 383\u001b[0m response \u001b[38;5;241m=\u001b[39m response[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444\u001b[0m, in \u001b[0;36mWebDriver.execute\u001b[0;34m(self, driver_command, params)\u001b[0m\n\u001b[1;32m 442\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcommand_executor\u001b[38;5;241m.\u001b[39mexecute(driver_command, params)\n\u001b[1;32m 443\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response:\n\u001b[0;32m--> 444\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43merror_handler\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_response\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 445\u001b[0m response[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_unwrap_value(response\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[1;32m 446\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249\u001b[0m, in \u001b[0;36mErrorHandler.check_response\u001b[0;34m(self, response)\u001b[0m\n\u001b[1;32m 247\u001b[0m alert_text \u001b[38;5;241m=\u001b[39m value[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124malert\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 248\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exception_class(message, screen, stacktrace, alert_text) \u001b[38;5;66;03m# type: ignore[call-arg] # mypy is not smart enough here\u001b[39;00m\n\u001b[0;32m--> 249\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exception_class(message, screen, stacktrace)\n", + "\u001b[0;31mSessionNotCreatedException\u001b[0m: Message: Failed to set preferences: Unable to write Firefox profile: No such file or directory (os error 2)\n" ] } ], @@ -194,269 +141,65 @@ }, { "cell_type": "code", - "execution_count": 7, - "id": "03784154", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:33:31.121382Z", - "iopub.status.busy": "2022-12-05T13:33:31.121151Z", - "iopub.status.idle": "2022-12-05T13:33:31.126158Z", - "shell.execute_reply": "2022-12-05T13:33:31.125603Z" - } - }, - "outputs": [], - "source": [ - "from bs4 import BeautifulSoup\n", - "\n", - "class HtmlTransformerUtil:\n", - " \n", - " def applySoupTransformerToFile(self, file, soupTransformer):\n", - " self._writeSoup(soupTransformer(self._readSoup(file)), file)\n", - "\n", - " def _readSoup(self, file):\n", - " with open(file) as fp:\n", - " soup = BeautifulSoup(fp, 'lxml')\n", - " return soup\n", - "\n", - " def _writeSoup(self, soup, file):\n", - " with open(file, \"w\") as fp:\n", - " fp.write(str(soup)) \n" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "af101279", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:33:31.128954Z", - "iopub.status.busy": "2022-12-05T13:33:31.128733Z", - "iopub.status.idle": "2022-12-05T13:33:31.132967Z", - "shell.execute_reply": "2022-12-05T13:33:31.132243Z" - } - }, - "outputs": [], - "source": [ - "def saveLastUpdatedIntensivstationen(lastUpdated):\n", - " def setLastUpdated(soup):\n", - " soup.find(id = \"Datenstand\").string.replace_with(lastUpdated.strftime(DateProvider.INTENSIVSTATIONEN_DATE_FORMAT))\n", - " return soup\n", - "\n", - " HtmlTransformerUtil().applySoupTransformerToFile(\n", - " file = \"../../docs/intensivstationen.html\",\n", - " soupTransformer = setLastUpdated)" - ] - }, - { - "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "id": "63be303c", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:33:31.136146Z", - "iopub.status.busy": "2022-12-05T13:33:31.135871Z", - "iopub.status.idle": "2022-12-05T13:33:31.165780Z", - "shell.execute_reply": "2022-12-05T13:33:31.165247Z" - } - }, - "outputs": [], - "source": [ - "saveLastUpdatedIntensivstationen(dateProvider.getLastUpdatedDataSource())" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "d021de84", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:33:31.168581Z", - "iopub.status.busy": "2022-12-05T13:33:31.168238Z", - "iopub.status.idle": "2022-12-05T13:33:31.226680Z", - "shell.execute_reply": "2022-12-05T13:33:31.225887Z" - } - }, - "outputs": [], - "source": [ - "def readTimeseries(download = False):\n", - " timeSeriesFile = 'zeitreihe-tagesdaten.csv'\n", - " if download:\n", - " _downloadTimeseries(timeSeriesFile)\n", - "\n", - " timeseries = pd.read_csv(\n", - " timeSeriesFile,\n", - " low_memory = False,\n", - " usecols = ['date', 'bundesland', 'gemeindeschluessel', 'betten_belegt', 'betten_frei'],\n", - " parse_dates = ['date'],\n", - " date_parser = lambda dateStr: pd.to_datetime(dateStr, format = \"%Y-%m-%d\"),\n", - " dtype = {\n", - " 'gemeindeschluessel': 'string',\n", - " 'bundesland': 'string'\n", - " })\n", - " return timeseries.sort_values(by = 'date', ascending = True)\n", - "\n", - "# download https://diviexchange.blob.core.windows.net/%24web/zeitreihe-tagesdaten.csv or https://www.intensivregister.de/#/aktuelle-lage/downloads\n", - "def _downloadTimeseries(timeSeriesFile):\n", - " request.urlretrieve(\n", - " 'https://diviexchange.blob.core.windows.net/%24web/zeitreihe-tagesdaten.csv',\n", - " timeSeriesFile)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "3f992231", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:33:31.230684Z", - "iopub.status.busy": "2022-12-05T13:33:31.230285Z", - "iopub.status.idle": "2022-12-05T13:34:23.278366Z", - "shell.execute_reply": "2022-12-05T13:34:23.277732Z" + "iopub.execute_input": "2023-01-17T14:25:21.931546Z", + "iopub.status.busy": "2023-01-17T14:25:21.931244Z", + "iopub.status.idle": "2023-01-17T14:25:22.507178Z", + "shell.execute_reply": "2023-01-17T14:25:22.506540Z" } }, "outputs": [ { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
datebundeslandgemeindeschluesselbetten_freibetten_belegt
02020-04-2401010014038
2672020-04-24090947199
2662020-04-2409094641723
2652020-04-240909463925
2642020-04-2409094621251
..................
3781192022-12-0506064374122
3781182022-12-050606436019
3781172022-12-050606435964
3781152022-12-050606433118
3783882022-12-051616077424
\n", - "

378389 rows × 5 columns

\n", - "
" - ], - "text/plain": [ - " date bundesland gemeindeschluessel betten_frei betten_belegt\n", - "0 2020-04-24 01 01001 40 38\n", - "267 2020-04-24 09 09471 9 9\n", - "266 2020-04-24 09 09464 17 23\n", - "265 2020-04-24 09 09463 9 25\n", - "264 2020-04-24 09 09462 12 51\n", - "... ... ... ... ... ...\n", - "378119 2022-12-05 06 06437 4 122\n", - "378118 2022-12-05 06 06436 0 19\n", - "378117 2022-12-05 06 06435 9 64\n", - "378115 2022-12-05 06 06433 1 18\n", - "378388 2022-12-05 16 16077 4 24\n", - "\n", - "[378389 rows x 5 columns]" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" + "ename": "SessionNotCreatedException", + "evalue": "Message: Failed to set preferences: Unable to write Firefox profile: No such file or directory (os error 2)\n", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mSessionNotCreatedException\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[5], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m saveLastUpdatedIntensivstationen(\n\u001b[0;32m----> 2\u001b[0m \u001b[43mdateProvider\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetLastUpdatedDataSource\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 3\u001b[0m toHtmlFile \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m../../docs/intensivstationen.html\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "File \u001b[0;32m~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/DateProvider.py:31\u001b[0m, in \u001b[0;36mDateProvider.getLastUpdatedDataSource\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetLastUpdatedDataSource\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 30\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlastUpdatedDataSource \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 31\u001b[0m html \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_getOriginalHtml\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 32\u001b[0m lastUpdatedColumn \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mLetzte Änderung\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 33\u001b[0m dataFrame \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_asDataFrame(html, lastUpdatedColumn)\n", + "File \u001b[0;32m~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/DateProvider.py:44\u001b[0m, in \u001b[0;36mDateProvider._getOriginalHtml\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# put the root directory your default profile path here, you can check it by opening Firefox and then pasting 'about:profiles' into the url field \u001b[39;00m\n\u001b[1;32m 43\u001b[0m options\u001b[38;5;241m.\u001b[39madd_argument(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/home/frankknoll/snap/firefox/common/.mozilla/firefox/1j6r2yp6.default\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 44\u001b[0m driver \u001b[38;5;241m=\u001b[39m \u001b[43mwebdriver\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mFirefox\u001b[49m\u001b[43m(\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 45\u001b[0m driver\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://www.intensivregister.de/#/aktuelle-lage/downloads\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 46\u001b[0m sleep(\u001b[38;5;241m10\u001b[39m)\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py:197\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, firefox_profile, firefox_binary, capabilities, proxy, executable_path, options, service_log_path, service_args, service, desired_capabilities, log_path, keep_alive)\u001b[0m\n\u001b[1;32m 192\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mservice\u001b[38;5;241m.\u001b[39mstart()\n\u001b[1;32m 194\u001b[0m executor \u001b[38;5;241m=\u001b[39m FirefoxRemoteConnection(\n\u001b[1;32m 195\u001b[0m remote_server_addr\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mservice\u001b[38;5;241m.\u001b[39mservice_url, ignore_proxy\u001b[38;5;241m=\u001b[39moptions\u001b[38;5;241m.\u001b[39m_ignore_local_proxy\n\u001b[1;32m 196\u001b[0m )\n\u001b[0;32m--> 197\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mcommand_executor\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecutor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_remote \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:288\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)\u001b[0m\n\u001b[1;32m 286\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_authenticator_id \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 287\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstart_client()\n\u001b[0;32m--> 288\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart_session\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcapabilities\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbrowser_profile\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:381\u001b[0m, in \u001b[0;36mWebDriver.start_session\u001b[0;34m(self, capabilities, browser_profile)\u001b[0m\n\u001b[1;32m 379\u001b[0m w3c_caps \u001b[38;5;241m=\u001b[39m _make_w3c_caps(capabilities)\n\u001b[1;32m 380\u001b[0m parameters \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapabilities\u001b[39m\u001b[38;5;124m\"\u001b[39m: w3c_caps}\n\u001b[0;32m--> 381\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mCommand\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mNEW_SESSION\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 382\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msessionId\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m response:\n\u001b[1;32m 383\u001b[0m response \u001b[38;5;241m=\u001b[39m response[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444\u001b[0m, in \u001b[0;36mWebDriver.execute\u001b[0;34m(self, driver_command, params)\u001b[0m\n\u001b[1;32m 442\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcommand_executor\u001b[38;5;241m.\u001b[39mexecute(driver_command, params)\n\u001b[1;32m 443\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response:\n\u001b[0;32m--> 444\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43merror_handler\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_response\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 445\u001b[0m response[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_unwrap_value(response\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[1;32m 446\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n", + "File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249\u001b[0m, in \u001b[0;36mErrorHandler.check_response\u001b[0;34m(self, response)\u001b[0m\n\u001b[1;32m 247\u001b[0m alert_text \u001b[38;5;241m=\u001b[39m value[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124malert\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 248\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exception_class(message, screen, stacktrace, alert_text) \u001b[38;5;66;03m# type: ignore[call-arg] # mypy is not smart enough here\u001b[39;00m\n\u001b[0;32m--> 249\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exception_class(message, screen, stacktrace)\n", + "\u001b[0;31mSessionNotCreatedException\u001b[0m: Message: Failed to set preferences: Unable to write Firefox profile: No such file or directory (os error 2)\n" + ] + } + ], + "source": [ + "saveLastUpdatedIntensivstationen(\n", + " dateProvider.getLastUpdatedDataSource(),\n", + " toHtmlFile = \"../../docs/intensivstationen.html\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "3f992231", + "metadata": { + "execution": { + "iopub.execute_input": "2023-01-17T14:25:22.509837Z", + "iopub.status.busy": "2023-01-17T14:25:22.509528Z", + "iopub.status.idle": "2023-01-17T14:25:22.522955Z", + "shell.execute_reply": "2023-01-17T14:25:22.522436Z" + } + }, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'needsUpdate' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m timeSeries \u001b[38;5;241m=\u001b[39m readTimeseries(download \u001b[38;5;241m=\u001b[39m \u001b[43mneedsUpdate\u001b[49m)\n\u001b[1;32m 2\u001b[0m timeSeries\n", + "\u001b[0;31mNameError\u001b[0m: name 'needsUpdate' is not defined" + ] } ], "source": [ @@ -466,4698 +209,110 @@ }, { "cell_type": "code", - "execution_count": 12, - "id": "2d34c6a4", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.281179Z", - "iopub.status.busy": "2022-12-05T13:34:23.280897Z", - "iopub.status.idle": "2022-12-05T13:34:23.287034Z", - "shell.execute_reply": "2022-12-05T13:34:23.286323Z" - } - }, - "outputs": [], - "source": [ - "def readKreise(download = False):\n", - " kreiseFile = '04-kreise.xlsx'\n", - " if download:\n", - " _downloadKreise(kreiseFile)\n", - " \n", - " kreise = pd.read_excel(\n", - " kreiseFile,\n", - " sheet_name = 'Kreisfreie Städte u. Landkreise',\n", - " header = 5,\n", - " index_col = 0)\n", - " kreise = kreise.rename(columns = {'2': 'Bundesland', 3: 'Kreis', 6: 'Einwohnerzahl'})[['Bundesland', 'Kreis', 'Einwohnerzahl']]\n", - " kreise.index.set_names(\"Key\", inplace = True)\n", - " return kreise\n", - "\n", - "# download https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.xlsx?__blob=publicationFile or https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.html\n", - "def _downloadKreise(kreiseFile):\n", - " request.urlretrieve(\n", - " 'https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.xlsx?__blob=publicationFile',\n", - " kreiseFile)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "74ea4d55", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.289773Z", - "iopub.status.busy": "2022-12-05T13:34:23.289488Z", - "iopub.status.idle": "2022-12-05T13:34:23.489906Z", - "shell.execute_reply": "2022-12-05T13:34:23.489285Z" - } - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
BundeslandKreisEinwohnerzahl
Key
NaNNaNNaNNaN
01Schleswig-HolsteinNaNNaN
01001Kreisfreie StadtFlensburg, Stadt89934.0
01002Kreisfreie StadtKiel, Landeshauptstadt246601.0
01003Kreisfreie StadtLübeck, Hansestadt215846.0
............
2) Die Ergebnisse ab Berichtsjahr 2016 sind aufgrund methodischer Änderungen und technischer Weiterentwicklung\\n nur bedingt mit den Vorjahreswerten vegleichbar. Erläuterungen dazu finden Sie unter www.destatis.de beim Bevölkerungsstand.NaNNaNNaN
NaNNaNNaNNaN
© Daten (im Auftrag der Herausgebergemeinschaft Statistische Ämter des Bundes und der Länder)NaNNaNNaN
Statistisches Bundesamt (Destatis), 2021NaNNaNNaN
Vervielfältigung und Verbreitung, auch auszugsweise, mit Quellenangabe gestattet.NaNNaNNaN
\n", - "

488 rows × 3 columns

\n", - "
" - ], - "text/plain": [ - " Bundesland \\\n", - "Key \n", - "NaN NaN \n", - "01 Schleswig-Holstein \n", - "01001 Kreisfreie Stadt \n", - "01002 Kreisfreie Stadt \n", - "01003 Kreisfreie Stadt \n", - "... ... \n", - "2) Die Ergebnisse ab Berichtsjahr 2016 sind auf... NaN \n", - "NaN NaN \n", - "© Daten (im Auftrag der Herausgebergemeinschaft... NaN \n", - " Statistisches Bundesamt (Destatis), 2021 NaN \n", - " Vervielfältigung und Verbreitung, auch aus... NaN \n", - "\n", - " Kreis \\\n", - "Key \n", - "NaN NaN \n", - "01 NaN \n", - "01001 Flensburg, Stadt \n", - "01002 Kiel, Landeshauptstadt \n", - "01003 Lübeck, Hansestadt \n", - "... ... \n", - "2) Die Ergebnisse ab Berichtsjahr 2016 sind auf... NaN \n", - "NaN NaN \n", - "© Daten (im Auftrag der Herausgebergemeinschaft... NaN \n", - " Statistisches Bundesamt (Destatis), 2021 NaN \n", - " Vervielfältigung und Verbreitung, auch aus... NaN \n", - "\n", - " Einwohnerzahl \n", - "Key \n", - "NaN NaN \n", - "01 NaN \n", - "01001 89934.0 \n", - "01002 246601.0 \n", - "01003 215846.0 \n", - "... ... \n", - "2) Die Ergebnisse ab Berichtsjahr 2016 sind auf... NaN \n", - "NaN NaN \n", - "© Daten (im Auftrag der Herausgebergemeinschaft... NaN \n", - " Statistisches Bundesamt (Destatis), 2021 NaN \n", - " Vervielfältigung und Verbreitung, auch aus... NaN \n", - "\n", - "[488 rows x 3 columns]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "kreise = readKreise(download = False)\n", - "kreise" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "af96fb11", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.492433Z", - "iopub.status.busy": "2022-12-05T13:34:23.492176Z", - "iopub.status.idle": "2022-12-05T13:34:23.497263Z", - "shell.execute_reply": "2022-12-05T13:34:23.496688Z" - } - }, - "outputs": [], - "source": [ - "class ColumnsAdder:\n", - "\n", - " def __init__(self, kreise):\n", - " self.kreise = kreise\n", - "\n", - " def addKreisAndBundeslandAndEinwohnerzahlColumns(self, dataFrame):\n", - " dataFrame = self.addKreisAndEinwohnerzahlColumns(dataFrame)\n", - " return self._addBundeslandColumn(dataFrame)\n", - " \n", - " def addKreisAndEinwohnerzahlColumns(self, dataFrame):\n", - " dataFrame_kreise = pd.merge(dataFrame, self.kreise, how = 'left', left_on = 'gemeindeschluessel', right_index = True)\n", - " dataFrame['Kreis'] = dataFrame_kreise['Kreis']\n", - " dataFrame['Einwohnerzahl'] = dataFrame_kreise['Einwohnerzahl']\n", - " return dataFrame\n", - "\n", - " def _addBundeslandColumn(self, dataFrame):\n", - " return pd.merge(\n", - " dataFrame,\n", - " self._createBundeslandByKeyTable(),\n", - " how = 'left',\n", - " left_on = 'bundesland',\n", - " right_index = True)\n", - "\n", - " def _createBundeslandByKeyTable(self):\n", - " return self.kreise[self.kreise.index.str.len() == 2][['Bundesland']]\n" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "62a20115", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.499530Z", - "iopub.status.busy": "2022-12-05T13:34:23.499302Z", - "iopub.status.idle": "2022-12-05T13:34:23.677385Z", - "shell.execute_reply": "2022-12-05T13:34:23.676684Z" - } - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
datebundeslandgemeindeschluesselbetten_freibetten_belegtKreisEinwohnerzahlBundesland
02020-04-2401010014038Flensburg, Stadt89934.0Schleswig-Holstein
2672020-04-24090947199Bamberg147497.0Bayern
2662020-04-2409094641723Hof45173.0Bayern
2652020-04-240909463925Coburg40842.0Bayern
2642020-04-2409094621251Bayreuth74048.0Bayern
...........................
3781192022-12-0506064374122Odenwaldkreis96754.0Hessen
3781182022-12-050606436019Main-Taunus-Kreis239264.0Hessen
3781172022-12-050606435964Main-Kinzig-Kreis421689.0Hessen
3781152022-12-050606433118Groß-Gerau275807.0Hessen
3783882022-12-051616077424Altenburger Land88356.0Thüringen
\n", - "

378389 rows × 8 columns

\n", - "
" - ], - "text/plain": [ - " date bundesland gemeindeschluessel betten_frei betten_belegt \\\n", - "0 2020-04-24 01 01001 40 38 \n", - "267 2020-04-24 09 09471 9 9 \n", - "266 2020-04-24 09 09464 17 23 \n", - "265 2020-04-24 09 09463 9 25 \n", - "264 2020-04-24 09 09462 12 51 \n", - "... ... ... ... ... ... \n", - "378119 2022-12-05 06 06437 4 122 \n", - "378118 2022-12-05 06 06436 0 19 \n", - "378117 2022-12-05 06 06435 9 64 \n", - "378115 2022-12-05 06 06433 1 18 \n", - "378388 2022-12-05 16 16077 4 24 \n", - "\n", - " Kreis Einwohnerzahl Bundesland \n", - "0 Flensburg, Stadt 89934.0 Schleswig-Holstein \n", - "267 Bamberg 147497.0 Bayern \n", - "266 Hof 45173.0 Bayern \n", - "265 Coburg 40842.0 Bayern \n", - "264 Bayreuth 74048.0 Bayern \n", - "... ... ... ... \n", - "378119 Odenwaldkreis 96754.0 Hessen \n", - "378118 Main-Taunus-Kreis 239264.0 Hessen \n", - "378117 Main-Kinzig-Kreis 421689.0 Hessen \n", - "378115 Groß-Gerau 275807.0 Hessen \n", - "378388 Altenburger Land 88356.0 Thüringen \n", - "\n", - "[378389 rows x 8 columns]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "timeSeries = ColumnsAdder(kreise).addKreisAndBundeslandAndEinwohnerzahlColumns(timeSeries)\n", - "timeSeries" - ] - }, - { - "cell_type": "code", - "execution_count": 16, + "execution_count": 7, "id": "356494d3", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.680461Z", - "iopub.status.busy": "2022-12-05T13:34:23.680231Z", - "iopub.status.idle": "2022-12-05T13:34:23.694050Z", - "shell.execute_reply": "2022-12-05T13:34:23.693446Z" + "iopub.execute_input": "2023-01-17T14:25:22.525404Z", + "iopub.status.busy": "2023-01-17T14:25:22.525107Z", + "iopub.status.idle": "2023-01-17T14:25:22.537819Z", + "shell.execute_reply": "2023-01-17T14:25:22.537290Z" } }, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'timeSeries' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m kreisValues \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\u001b[43mtimeSeries\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mKreis\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mdrop_duplicates()\u001b[38;5;241m.\u001b[39mvalues)\n\u001b[1;32m 2\u001b[0m saveKreisOptions(\n\u001b[1;32m 3\u001b[0m kreisOptions \u001b[38;5;241m=\u001b[39m getKreisOptionsAndAlleLandkreise(kreisValues),\n\u001b[1;32m 4\u001b[0m toHtmlFile \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m../../docs/intensivstationen.html\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "\u001b[0;31mNameError\u001b[0m: name 'timeSeries' is not defined" + ] + } + ], "source": [ - "kreisValues = sorted(timeSeries['Kreis'].drop_duplicates().values)" + "kreisValues = sorted(timeSeries['Kreis'].drop_duplicates().values)\n", + "saveKreisOptions(\n", + " kreisOptions = getKreisOptionsAndAlleLandkreise(kreisValues),\n", + " toHtmlFile = \"../../docs/intensivstationen.html\")" ] }, { "cell_type": "code", - "execution_count": 17, - "id": "05aa0117", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.696889Z", - "iopub.status.busy": "2022-12-05T13:34:23.696674Z", - "iopub.status.idle": "2022-12-05T13:34:23.700114Z", - "shell.execute_reply": "2022-12-05T13:34:23.699571Z" - } - }, - "outputs": [], - "source": [ - "def getKreisOptions(kreisValues):\n", - " return [getKreisOption(kreis) for kreis in kreisValues]\n", - "\n", - "def getKreisOption(kreis):\n", - " return f''\n" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "9c38ca16", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.702827Z", - "iopub.status.busy": "2022-12-05T13:34:23.702589Z", - "iopub.status.idle": "2022-12-05T13:34:23.705946Z", - "shell.execute_reply": "2022-12-05T13:34:23.705365Z" - } - }, - "outputs": [], - "source": [ - "kreisOptions = [''] + getKreisOptions(kreisValues)" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "9eb453d0", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.708378Z", - "iopub.status.busy": "2022-12-05T13:34:23.708108Z", - "iopub.status.idle": "2022-12-05T13:34:23.712564Z", - "shell.execute_reply": "2022-12-05T13:34:23.712053Z" - } - }, - "outputs": [], - "source": [ - "from bs4 import BeautifulSoup\n", - "\n", - "\n", - "class KreisOptionsSetter:\n", - "\n", - " def setKreisOptions(self, html, options):\n", - " soup = self._setKreisOptions(self._parse(html), self._parseOptions(options))\n", - " return str(soup)\n", - "\n", - " def _setKreisOptions(self, soup, options):\n", - " kreisSelect = soup.find(id = \"kreisSelect\")\n", - " kreisSelect.clear()\n", - " for option in options:\n", - " kreisSelect.append(option)\n", - " return soup\n", - "\n", - " def _parseOptions(self, options):\n", - " return [self._parse(option).option for option in options]\n", - "\n", - " def _parse(self, html):\n", - " return BeautifulSoup(html, 'lxml')\n" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "29b0930a", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.715615Z", - "iopub.status.busy": "2022-12-05T13:34:23.715350Z", - "iopub.status.idle": "2022-12-05T13:34:23.722997Z", - "shell.execute_reply": "2022-12-05T13:34:23.722368Z" - } - }, - "outputs": [], - "source": [ - "import unittest" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "45072a1d", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.726203Z", - "iopub.status.busy": "2022-12-05T13:34:23.725738Z", - "iopub.status.idle": "2022-12-05T13:34:23.729594Z", - "shell.execute_reply": "2022-12-05T13:34:23.728988Z" - } - }, - "outputs": [], - "source": [ - "class TestHelper:\n", - "\n", - " @staticmethod\n", - " def createDataFrame(index, columns, data, dtypes = {}):\n", - " return pd.DataFrame(index = index, columns = columns, data = data).astype(dtypes)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "e4f8fa80", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.732788Z", - "iopub.status.busy": "2022-12-05T13:34:23.732533Z", - "iopub.status.idle": "2022-12-05T13:34:23.739863Z", - "shell.execute_reply": "2022-12-05T13:34:23.739211Z" - } - }, - "outputs": [], - "source": [ - "class KreisOptionsSetterTest(unittest.TestCase):\n", - "\n", - " def test_setKreisOptions(self):\n", - " # Given\n", - " kreisOptionsSetter = KreisOptionsSetter()\n", - "\n", - " # When\n", - " htmlActual = kreisOptionsSetter.setKreisOptions(\n", - " html='''\n", - " \n", - " \n", - "

Test

\n", - " \n", - " \n", - " \n", - " ''',\n", - " options=[\n", - " '',\n", - " '',\n", - " ''])\n", - "\n", - " # Then\n", - " assertEqualHTML(\n", - " htmlActual,\n", - " '''\n", - " \n", - " \n", - "

Test

\n", - " \n", - " \n", - " \n", - " ''')\n", - "\n", - "# adapted from https://stackoverflow.com/questions/8006909/pretty-print-assertequal-for-html-strings\n", - "def assertEqualHTML(string1, string2, file1='', file2=''):\n", - " u'''\n", - " Compare two unicode strings containing HTML.\n", - " A human friendly diff goes to logging.error() if they\n", - " are not equal, and an exception gets raised.\n", - " '''\n", - " from bs4 import BeautifulSoup as bs\n", - " import difflib\n", - "\n", - " def short(mystr):\n", - " max = 20\n", - " if len(mystr) > max:\n", - " return mystr[:max]\n", - " return mystr\n", - " p = []\n", - " for mystr, file in [(string1, file1), (string2, file2)]:\n", - " if not isinstance(mystr, str):\n", - " raise Exception(u'string ist not unicode: %r %s' %\n", - " (short(mystr), file))\n", - " soup = bs(mystr)\n", - " pretty = soup.prettify()\n", - " p.append(pretty)\n", - " if p[0] != p[1]:\n", - " for line in difflib.unified_diff(p[0].splitlines(), p[1].splitlines(), fromfile=file1, tofile=file2):\n", - " display(line)\n", - " display(p[0], ' != ', p[1])\n", - " raise Exception('Not equal %s %s' % (file1, file2))\n" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "403f8b7b", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.742169Z", - "iopub.status.busy": "2022-12-05T13:34:23.741967Z", - "iopub.status.idle": "2022-12-05T13:34:23.747093Z", - "shell.execute_reply": "2022-12-05T13:34:23.746418Z" - } - }, - "outputs": [], - "source": [ - "from bs4 import BeautifulSoup\n", - "\n", - "\n", - "def saveKreisOptions(kreisOptions):\n", - " HtmlTransformerUtil().applySoupTransformerToFile(\n", - " file = \"../../docs/intensivstationen.html\",\n", - " soupTransformer =\n", - " lambda soup:\n", - " BeautifulSoup(\n", - " KreisOptionsSetter().setKreisOptions(html = str(soup), options = kreisOptions),\n", - " 'lxml'))\n" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "5dd8d864", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.750413Z", - "iopub.status.busy": "2022-12-05T13:34:23.750007Z", - "iopub.status.idle": "2022-12-05T13:34:23.881791Z", - "shell.execute_reply": "2022-12-05T13:34:23.881263Z" - } - }, - "outputs": [], - "source": [ - "saveKreisOptions(kreisOptions)" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "43c2f826", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.884901Z", - "iopub.status.busy": "2022-12-05T13:34:23.884619Z", - "iopub.status.idle": "2022-12-05T13:34:23.889692Z", - "shell.execute_reply": "2022-12-05T13:34:23.889202Z" - } - }, - "outputs": [], - "source": [ - "import os\n", - "import json\n", - "\n", - "\n", - "class IOUtils:\n", - "\n", - " def saveDictAsJson(dict, file):\n", - " IOUtils.ensurePath(file)\n", - " with open(file, 'w') as outfile:\n", - " json.dump(dict, outfile)\n", - "\n", - " @staticmethod\n", - " def ensurePath(file):\n", - " directory = os.path.dirname(file)\n", - " if not os.path.exists(directory):\n", - " os.makedirs(directory)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "997a4bdb", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.892139Z", - "iopub.status.busy": "2022-12-05T13:34:23.891892Z", - "iopub.status.idle": "2022-12-05T13:34:23.897733Z", - "shell.execute_reply": "2022-12-05T13:34:23.897193Z" - } - }, - "outputs": [], - "source": [ - "def getIntensiveCareBeds(timeSeries, kreis = None):\n", - " if kreis is not None:\n", - " return timeSeries[timeSeries['Kreis'] == kreis][['date', 'betten_belegt', 'betten_frei', 'Einwohnerzahl']]\n", - " else:\n", - " return timeSeries.groupby('date').agg(**{\n", - " 'betten_belegt': pd.NamedAgg(column = 'betten_belegt', aggfunc = 'sum'),\n", - " 'betten_frei': pd.NamedAgg(column = 'betten_frei', aggfunc = 'sum'),\n", - " 'Einwohnerzahl': pd.NamedAgg(column = 'Einwohnerzahl', aggfunc = 'sum')\n", - " }).reset_index()" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "a97f5b2b", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.900813Z", - "iopub.status.busy": "2022-12-05T13:34:23.900512Z", - "iopub.status.idle": "2022-12-05T13:34:23.906789Z", - "shell.execute_reply": "2022-12-05T13:34:23.906125Z" - } - }, - "outputs": [], - "source": [ - "def getAndPersistIntensiveCareBeds(timeSeries, kreis = None):\n", - " intensiveCareBeds = getIntensiveCareBeds(timeSeries, kreis)\n", - " display(kreis)\n", - " _saveAsJson(intensiveCareBeds, _getFilename(kreis))\n", - " return intensiveCareBeds\n", - "\n", - "\n", - "def _saveAsJson(intensiveCareBeds, file):\n", - " IOUtils.saveDictAsJson(\n", - " {\n", - " 'population': int(intensiveCareBeds.iloc[0]['Einwohnerzahl']),\n", - " 'data': _intensiveCareBeds2Dict(intensiveCareBeds),\n", - " },\n", - " file)\n", - "\n", - "\n", - "def _intensiveCareBeds2Dict(intensiveCareBeds):\n", - " df = intensiveCareBeds[['date', 'betten_belegt', 'betten_frei']].copy()\n", - " df['date'] = df['date'].dt.strftime('%Y-%m-%d')\n", - " return df.to_dict(orient = \"records\")\n", - "\n", - "\n", - "def _getFilename(kreis):\n", - " return f'../../docs/data/intensivstationen/intensivstationen-{_getSuffix(kreis)}.json'\n", - "\n", - "\n", - "def _getSuffix(kreis):\n", - " return kreis if kreis is not None else 'de'\n" - ] - }, - { - "cell_type": "code", - "execution_count": 28, + "execution_count": 8, "id": "349edd73", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.909788Z", - "iopub.status.busy": "2022-12-05T13:34:23.909329Z", - "iopub.status.idle": "2022-12-05T13:34:23.948250Z", - "shell.execute_reply": "2022-12-05T13:34:23.947596Z" + "iopub.execute_input": "2023-01-17T14:25:22.540140Z", + "iopub.status.busy": "2023-01-17T14:25:22.539842Z", + "iopub.status.idle": "2023-01-17T14:25:22.551789Z", + "shell.execute_reply": "2023-01-17T14:25:22.551210Z" } }, "outputs": [ { - "data": { - "text/plain": [ - "None" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "

\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
datebetten_belegtbetten_freiEinwohnerzahl
02020-04-24192371227082401553.0
12020-04-25191001229082401553.0
22020-04-26186171269482401553.0
32020-04-27188031253782360711.0
42020-04-28193451220782504802.0
...............
9512022-12-0120513298882658396.0
9522022-12-0220501293582658396.0
9532022-12-0320189295982658396.0
9542022-12-0419955314182658396.0
9552022-12-0520141307782658396.0
\n", - "

956 rows × 4 columns

\n", - "
" - ], - "text/plain": [ - " date betten_belegt betten_frei Einwohnerzahl\n", - "0 2020-04-24 19237 12270 82401553.0\n", - "1 2020-04-25 19100 12290 82401553.0\n", - "2 2020-04-26 18617 12694 82401553.0\n", - "3 2020-04-27 18803 12537 82360711.0\n", - "4 2020-04-28 19345 12207 82504802.0\n", - ".. ... ... ... ...\n", - "951 2022-12-01 20513 2988 82658396.0\n", - "952 2022-12-02 20501 2935 82658396.0\n", - "953 2022-12-03 20189 2959 82658396.0\n", - "954 2022-12-04 19955 3141 82658396.0\n", - "955 2022-12-05 20141 3077 82658396.0\n", - "\n", - "[956 rows x 4 columns]" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "getAndPersistIntensiveCareBeds(timeSeries)" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "id": "1b97137f", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:23.951181Z", - "iopub.status.busy": "2022-12-05T13:34:23.950846Z", - "iopub.status.idle": "2022-12-05T13:34:36.721736Z", - "shell.execute_reply": "2022-12-05T13:34:36.721141Z" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "'Ahrweiler'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Aichach-Friedberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Alb-Donau-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Altenburger Land'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Altenkirchen (Westerwald)'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Altmarkkreis Salzwedel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Altötting'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Alzey-Worms'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Amberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Amberg-Sulzbach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ammerland'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Anhalt-Bitterfeld'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ansbach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Aschaffenburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Augsburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Aurich'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bad Dürkheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bad Kissingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bad Kreuznach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bad Tölz-Wolfratshausen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Baden-Baden, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bamberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Barnim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bautzen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bayreuth'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Berchtesgadener Land'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bergstraße'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Berlin, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bernkastel-Wittlich'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Biberach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bielefeld, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Birkenfeld'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bochum, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bodenseekreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bonn, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Borken'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bottrop, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Brandenburg an der Havel, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Braunschweig, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Breisgau-Hochschwarzwald'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bremen, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Bremerhaven, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Burgenlandkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Böblingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Börde'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Calw'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Celle'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Cham'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Chemnitz, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Cloppenburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Coburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Cochem-Zell'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Coesfeld'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Cottbus, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Cuxhaven'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dachau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dahme-Spreewald'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Darmstadt, Wissenschaftsstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Darmstadt-Dieburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Deggendorf'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Delmenhorst, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dessau-Roßlau, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Diepholz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dillingen a.d.Donau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dingolfing-Landau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dithmarschen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Donau-Ries'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Donnersbergkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dortmund, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Dresden, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Duisburg, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Düren'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Düsseldorf, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ebersberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Eichsfeld'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Eichstätt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Eifelkreis Bitburg-Prüm'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Elbe-Elster'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Emden, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Emmendingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Emsland'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ennepe-Ruhr-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Enzkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Erding'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Erfurt, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Erlangen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Erlangen-Höchstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Erzgebirgskreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Essen, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Esslingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Euskirchen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Flensburg, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Forchheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Frankenthal (Pfalz), kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Frankfurt (Oder), Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Frankfurt am Main, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Freiburg im Breisgau, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Freising'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Freudenstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Freyung-Grafenau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Friesland'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Fulda'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Fürstenfeldbruck'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Fürth'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Garmisch-Partenkirchen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Gelsenkirchen, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Gera, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Germersheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Gießen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Gifhorn'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Goslar'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Gotha'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Grafschaft Bentheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Greiz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Groß-Gerau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Göppingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Görlitz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Göttingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Günzburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Gütersloh'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hagen, Stadt der FernUniversität'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Halle (Saale), Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hamburg, Freie und Hansestadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hameln-Pyrmont'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hamm, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Harburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Harz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Havelland'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Haßberge'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Heidekreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Heidelberg, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Heidenheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Heilbronn'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Heilbronn, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Heinsberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Helmstedt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Herford'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Herne, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hersfeld-Rotenburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Herzogtum Lauenburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hildburghausen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hildesheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hochsauerlandkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hochtaunuskreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hof'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Hohenlohekreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Holzminden'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Höxter'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ilm-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ingolstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Jena, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Jerichower Land'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kaiserslautern'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kaiserslautern, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Karlsruhe'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Karlsruhe, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kassel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kassel, documenta-Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kaufbeuren'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kelheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kempten (Allgäu)'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kiel, Landeshauptstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kitzingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kleve'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Koblenz, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Konstanz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Krefeld, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kronach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kulmbach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kusel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Kyffhäuserkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Köln, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lahn-Dill-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Landau in der Pfalz, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Landkreis Rostock'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Landsberg am Lech'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Landshut'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Leer'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Leipzig'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Leipzig, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Leverkusen, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lichtenfels'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Limburg-Weilburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lindau (Bodensee)'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lippe'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ludwigsburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ludwigshafen am Rhein, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ludwigslust-Parchim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lörrach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lübeck, Hansestadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lüchow-Dannenberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Lüneburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Magdeburg, Landeshauptstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Main-Kinzig-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Main-Spessart'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Main-Tauber-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Main-Taunus-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mainz, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mainz-Bingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mannheim, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mansfeld-Südharz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Marburg-Biedenkopf'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mayen-Koblenz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mecklenburgische Seenplatte'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Meißen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Memmingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Merzig-Wadern'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mettmann'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Miesbach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Miltenberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Minden-Lübbecke'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mittelsachsen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Märkisch-Oderland'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Märkischer Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mönchengladbach, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mühldorf a.Inn'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Mülheim an der Ruhr, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'München'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'München, Landeshauptstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Münster, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neckar-Odenwald-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neu-Ulm'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neuburg-Schrobenhausen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neumarkt i.d.OPf.'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neumünster, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neunkirchen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neustadt a.d.Aisch-Bad Windsheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neustadt an der Weinstraße, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Neuwied'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nienburg (Weser)'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nordfriesland'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nordhausen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nordsachsen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nordwestmecklenburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Northeim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nürnberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Nürnberger Land'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oberallgäu'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oberbergischer Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oberhausen, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oberhavel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oberspreewald-Lausitz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Odenwaldkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oder-Spree'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Offenbach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Offenbach am Main, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oldenburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Oldenburg (Oldenburg), Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Olpe'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ortenaukreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Osnabrück'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Osnabrück, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ostalbkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ostallgäu'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Osterholz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ostholstein'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ostprignitz-Ruppin'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Paderborn'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Passau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Peine'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Pfaffenhofen a.d.Ilm'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Pforzheim, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Pinneberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Pirmasens, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Plön'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Potsdam, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Potsdam-Mittelmark'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Prignitz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rastatt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ravensburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Recklinghausen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Regen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Regensburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Region Hannover'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Regionalverband Saarbrücken'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rems-Murr-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Remscheid, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rendsburg-Eckernförde'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Reutlingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhein-Erft-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhein-Hunsrück-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhein-Kreis Neuss'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhein-Lahn-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhein-Neckar-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhein-Sieg-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rheingau-Taunus-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rheinisch-Bergischer Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rhön-Grabfeld'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rosenheim'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rostock'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rotenburg (Wümme)'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Roth'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rottal-Inn'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Rottweil'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Saale-Holzland-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Saale-Orla-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Saalekreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Saalfeld-Rudolstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Saarlouis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Saarpfalz-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Salzgitter, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Salzlandkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schaumburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schleswig-Flensburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schmalkalden-Meiningen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schwabach'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schwalm-Eder-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schwandorf'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schwarzwald-Baar-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schweinfurt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schwerin'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Schwäbisch Hall'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Segeberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Siegen-Wittgenstein'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Sigmaringen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Soest'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Solingen, Klingenstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Sonneberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Speyer, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Spree-Neiße'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'St. Wendel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Stade'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Starnberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Steinburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Steinfurt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Stendal'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Stormarn'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Straubing'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Straubing-Bogen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Stuttgart, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Städteregion Aachen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Suhl, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Sächsische Schweiz-Osterzgebirge'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Sömmerda'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Südliche Weinstraße'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Südwestpfalz'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Teltow-Fläming'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Tirschenreuth'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Traunstein'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Trier, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Trier-Saarburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Tuttlingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Tübingen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Uckermark'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Uelzen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Ulm, Stadtkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Unna'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Unstrut-Hainich-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Unterallgäu'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Vechta'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Verden'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Viersen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Vogelsbergkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Vogtlandkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Vorpommern-Greifswald'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Vorpommern-Rügen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Vulkaneifel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Waldeck-Frankenberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Waldshut'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Warendorf'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wartburgkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Weiden i.d.OPf.'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Weilheim-Schongau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Weimar, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Weimarer Land'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Weißenburg-Gunzenhausen'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Werra-Meißner-Kreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wesel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wesermarsch'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Westerwaldkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wetteraukreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wiesbaden, Landeshauptstadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wilhelmshaven, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wittenberg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wittmund'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wolfenbüttel'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wolfsburg, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Worms, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wunsiedel i.Fichtelgebirge'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Wuppertal, Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Würzburg'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Zollernalbkreis'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Zweibrücken, kreisfreie Stadt'" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "'Zwickau'" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "for kreis in kreisValues:\n", - " getAndPersistIntensiveCareBeds(timeSeries, kreis)" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "id": "d9d4acab", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.724360Z", - "iopub.status.busy": "2022-12-05T13:34:36.724143Z", - "iopub.status.idle": "2022-12-05T13:34:36.728249Z", - "shell.execute_reply": "2022-12-05T13:34:36.727836Z" - } - }, - "outputs": [], - "source": [ - "class MedianOfFreeBedsByKreisTableFactory:\n", - " \n", - " def __init__(self, dataFrame):\n", - " self.dataFrame = dataFrame\n", - "\n", - " def createMedianOfFreeBedsByKreisTable(self, kreisKey):\n", - " self.dataFrame['free_beds_divided_by_all_beds_in_percent'] = self.dataFrame['betten_frei'] / (self.dataFrame['betten_frei'] + self.dataFrame['betten_belegt']) * 100\n", - " aggregated = self.dataFrame.groupby(kreisKey).agg(\n", - " median_free_beds_in_percent =\n", - " pd.NamedAgg(\n", - " column = 'free_beds_divided_by_all_beds_in_percent',\n", - " aggfunc = 'median'))\n", - " return aggregated.sort_values(by = 'median_free_beds_in_percent', ascending = False)" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "a739d4d1", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.730372Z", - "iopub.status.busy": "2022-12-05T13:34:36.730158Z", - "iopub.status.idle": "2022-12-05T13:34:36.740833Z", - "shell.execute_reply": "2022-12-05T13:34:36.740327Z" - } - }, - "outputs": [], - "source": [ - "from pandas.testing import assert_frame_equal\n", - "import statistics\n", - "\n", - "class MedianOfFreeBedsByKreisTableFactoryTest(unittest.TestCase):\n", - "\n", - " def test_createMedianOfFreeBedsByKreisTable(self):\n", - " # Given\n", - " dataFrame = TestHelper.createDataFrame(\n", - " columns = ['date', 'betten_frei', 'betten_belegt', 'Kreis'],\n", - " data = [ ['2020-04-24', 40, 38, 'Flensburg, Stadt'],\n", - " ['2020-04-24', 42, 36, 'Flensburg, Stadt'],\n", - " ['2020-04-24', 44, 34, 'Flensburg, Stadt'],\n", - " ['2020-04-24', 9, 10, 'Bamberg']],\n", - " index = [\n", - " 0,\n", - " 1,\n", - " 2,\n", - " 3])\n", - " medianOfFreeBedsByKreisTableFactory = MedianOfFreeBedsByKreisTableFactory(dataFrame)\n", - " \n", - " # When\n", - " medianOfFreeBedsByKreisTable = medianOfFreeBedsByKreisTableFactory.createMedianOfFreeBedsByKreisTable('Kreis')\n", - "\n", - " # Then\n", - " assert_frame_equal(\n", - " medianOfFreeBedsByKreisTable,\n", - " TestHelper.createDataFrame(\n", - " columns = ['median_free_beds_in_percent'],\n", - " data = [ [statistics.median([40/(40 + 38) * 100, 42/(42 + 36) * 100, 44/(44 + 34) * 100])],\n", - " [9/(9 + 10) * 100]],\n", - " index = pd.Index(\n", - " name = 'Kreis',\n", - " data = [\n", - " 'Flensburg, Stadt',\n", - " 'Bamberg'\n", - " ])),\n", - " check_dtype = False)" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "af22cdc5", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.743284Z", - "iopub.status.busy": "2022-12-05T13:34:36.743091Z", - "iopub.status.idle": "2022-12-05T13:34:36.764204Z", - "shell.execute_reply": "2022-12-05T13:34:36.763646Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "test_setKreisOptions (__main__.KreisOptionsSetterTest) ... ok\n", - "test_createMedianOfFreeBedsByKreisTable (__main__.MedianOfFreeBedsByKreisTableFactoryTest) ... ok\n", - "\n", - "----------------------------------------------------------------------\n", - "Ran 2 tests in 0.013s\n", - "\n", - "OK\n" + "ename": "NameError", + "evalue": "name 'timeSeries' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[8], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m getAndPersistIntensiveCareBeds4AlleKreise(\n\u001b[0;32m----> 2\u001b[0m \u001b[43mtimeSeries\u001b[49m,\n\u001b[1;32m 3\u001b[0m intensivstationenDataDir \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m../../docs/data/intensivstationen\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 4\u001b[0m kreisValues \u001b[38;5;241m=\u001b[39m kreisValues)\n", + "\u001b[0;31mNameError\u001b[0m: name 'timeSeries' is not defined" ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" } ], "source": [ - "unittest.main(argv = [''], verbosity = 2, exit = False)" + "getAndPersistIntensiveCareBeds4AlleKreise(\n", + " timeSeries,\n", + " intensivstationenDataDir = '../../docs/data/intensivstationen',\n", + " kreisValues = kreisValues)\n" ] }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 9, "id": "f10704f3", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.766917Z", - "iopub.status.busy": "2022-12-05T13:34:36.766669Z", - "iopub.status.idle": "2022-12-05T13:34:36.809453Z", - "shell.execute_reply": "2022-12-05T13:34:36.808830Z" + "iopub.execute_input": "2023-01-17T14:25:22.554665Z", + "iopub.status.busy": "2023-01-17T14:25:22.554375Z", + "iopub.status.idle": "2023-01-17T14:25:22.566660Z", + "shell.execute_reply": "2023-01-17T14:25:22.566217Z" } }, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'timeSeries' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m medianOfFreeBedsByKreisTable \u001b[38;5;241m=\u001b[39m MedianOfFreeBedsByKreisTableFactory(\u001b[43mtimeSeries\u001b[49m)\u001b[38;5;241m.\u001b[39mcreateMedianOfFreeBedsByKreisTable(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mKreis\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 2\u001b[0m medianOfFreeBedsByKreisTable\u001b[38;5;241m.\u001b[39mreset_index()\u001b[38;5;241m.\u001b[39mto_json(\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m../../docs/data/intensivstationen/medianOfFreeBedsByKreisTable.json\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 4\u001b[0m orient \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrecords\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "\u001b[0;31mNameError\u001b[0m: name 'timeSeries' is not defined" + ] + } + ], "source": [ - "medianOfFreeBedsByKreisTableFactory = MedianOfFreeBedsByKreisTableFactory(timeSeries)\n", - "medianOfFreeBedsByKreisTable = medianOfFreeBedsByKreisTableFactory.createMedianOfFreeBedsByKreisTable('Kreis')\n", - "medianOfFreeBedsByKreisTable.reset_index().to_json('../../docs/data/intensivstationen/medianOfFreeBedsByKreisTable.json', orient = \"records\")" + "medianOfFreeBedsByKreisTable = MedianOfFreeBedsByKreisTableFactory(timeSeries).createMedianOfFreeBedsByKreisTable('Kreis')\n", + "medianOfFreeBedsByKreisTable.reset_index().to_json(\n", + " '../../docs/data/intensivstationen/medianOfFreeBedsByKreisTable.json',\n", + " orient = \"records\")" ] }, { "cell_type": "code", - "execution_count": 34, - "id": "396cb4f8", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.812441Z", - "iopub.status.busy": "2022-12-05T13:34:36.811933Z", - "iopub.status.idle": "2022-12-05T13:34:36.864332Z", - "shell.execute_reply": "2022-12-05T13:34:36.863755Z" - } - }, - "outputs": [], - "source": [ - "def createMedianOfFreeBedsByKreisTableForChoroplethMap(medianOfFreeBedsByKreisTableFactory):\n", - " medianOfFreeBedsByKreisTable = medianOfFreeBedsByKreisTableFactory.createMedianOfFreeBedsByKreisTable('gemeindeschluessel').reset_index()\n", - " return ColumnsAdder(kreise).addKreisAndEinwohnerzahlColumns(medianOfFreeBedsByKreisTable)\n", - " \n", - "medianOfFreeBedsByKreisTable = createMedianOfFreeBedsByKreisTableForChoroplethMap(medianOfFreeBedsByKreisTableFactory)" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "id": "b4247571", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.867473Z", - "iopub.status.busy": "2022-12-05T13:34:36.867257Z", - "iopub.status.idle": "2022-12-05T13:34:36.873291Z", - "shell.execute_reply": "2022-12-05T13:34:36.872643Z" - } - }, - "outputs": [], - "source": [ - "import requests\n", - "import json\n", - "\n", - "\n", - "class Datawrapper:\n", - "\n", - " def __init__(self, accessToken):\n", - " self.authHeader = {\"Authorization\": f\"Bearer {accessToken}\"}\n", - "\n", - " def setChartTitle(self, title):\n", - " response = requests.request(\n", - " \"PATCH\",\n", - " \"https://api.datawrapper.de/v3/charts/dYmYb\",\n", - " json={\"title\": title},\n", - " headers={\n", - " \"Accept\": \"*/*\",\n", - " \"Content-Type\": \"application/json\"\n", - " } | self.authHeader)\n", - " return json.loads(response.text)\n", - "\n", - " def uploadChartData(self, data: pd.DataFrame):\n", - " response = requests.request(\n", - " \"PUT\",\n", - " \"https://api.datawrapper.de/v3/charts/dYmYb/data\",\n", - " data=data.to_csv(\n", - " index=False,\n", - " columns=['gemeindeschluessel', 'median_free_beds_in_percent', 'Kreis']).encode(\"utf-8\"),\n", - " headers={\n", - " \"Accept\": \"*/*\",\n", - " \"Content-Type\": \"text/csv\"\n", - " } | self.authHeader)\n", - " return response.text\n", - "\n", - " def fetchChartData(self):\n", - " response = requests.request(\n", - " \"GET\",\n", - " \"https://api.datawrapper.de/v3/charts/dYmYb/data\",\n", - " headers={\n", - " \"Accept\": \"text/csv\"\n", - " } | self.authHeader)\n", - "\n", - " return response.text\n", - "\n", - " def publishChart(self):\n", - " response = requests.request(\n", - " \"POST\",\n", - " \"https://api.datawrapper.de/v3/charts/dYmYb/publish\",\n", - " headers={\n", - " \"Accept\": \"*/*\"\n", - " } | self.authHeader)\n", - " return json.loads(response.text)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 36, + "execution_count": 10, "id": "d1b75357", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.876234Z", - "iopub.status.busy": "2022-12-05T13:34:36.875963Z", - "iopub.status.idle": "2022-12-05T13:34:36.879930Z", - "shell.execute_reply": "2022-12-05T13:34:36.879224Z" + "iopub.execute_input": "2023-01-17T14:25:22.569080Z", + "iopub.status.busy": "2023-01-17T14:25:22.568625Z", + "iopub.status.idle": "2023-01-17T14:25:22.572139Z", + "shell.execute_reply": "2023-01-17T14:25:22.571452Z" } }, "outputs": [], @@ -5171,210 +326,41 @@ }, { "cell_type": "code", - "execution_count": 37, - "id": "9de2f34e", + "execution_count": 11, + "id": "8b392b34", "metadata": { "execution": { - "iopub.execute_input": "2022-12-05T13:34:36.882759Z", - "iopub.status.busy": "2022-12-05T13:34:36.882520Z", - "iopub.status.idle": "2022-12-05T13:34:40.380031Z", - "shell.execute_reply": "2022-12-05T13:34:40.377515Z" + "iopub.execute_input": "2023-01-17T14:25:22.574445Z", + "iopub.status.busy": "2023-01-17T14:25:22.574160Z", + "iopub.status.idle": "2023-01-17T14:25:22.587195Z", + "shell.execute_reply": "2023-01-17T14:25:22.586634Z" } }, "outputs": [ { - "data": { - "text/plain": [ - "{'data': {'publicId': 'dYmYb',\n", - " 'language': 'de-DE',\n", - " 'theme': 'datawrapper',\n", - " 'id': 'dYmYb',\n", - " 'type': 'd3-maps-choropleth',\n", - " 'title': 'Median freier Intensivbetten im Zeitraum 24.04.2020 bis 05.12.2022',\n", - " 'lastEditStep': 5,\n", - " 'publishedAt': '2022-12-05T13:34:40.155Z',\n", - " 'publicUrl': 'https://datawrapper.dwcdn.net/dYmYb/273/',\n", - " 'publicVersion': 273,\n", - " 'deleted': False,\n", - " 'deletedAt': None,\n", - " 'forkable': True,\n", - " 'isFork': False,\n", - " 'metadata': {'data': {'changes': [],\n", - " 'transpose': False,\n", - " 'vertical-header': True,\n", - " 'horizontal-header': True,\n", - " 'column-format': {'ags': {'type': 'text'},\n", - " 'Kreis': {'type': 'text'},\n", - " 'Einwohnerzahl': {'type': 'number',\n", - " 'number-append': '',\n", - " 'number-format': 'auto',\n", - " 'number-divisor': 0,\n", - " 'number-prepend': ''},\n", - " 'gemeindeschluessel': {'type': 'text'},\n", - " 'median_free_beds_in_percent': {'type': 'number'}},\n", - " 'upload-method': 'upload'},\n", - " 'describe': {'source-name': 'Landkreis-Daten',\n", - " 'source-url': 'https://www.intensivregister.de/#/aktuelle-lage/downloads',\n", - " 'intro': '',\n", - " 'byline': '',\n", - " 'aria-description': '',\n", - " 'number-format': '-',\n", - " 'number-divisor': 0,\n", - " 'number-append': '',\n", - " 'number-prepend': '',\n", - " 'hide-title': False},\n", - " 'visualize': {'dark-mode-invert': True,\n", - " 'highlighted-series': [],\n", - " 'highlighted-values': [],\n", - " 'sharing': {'enabled': False, 'auto': True},\n", - " 'labels': {'max': 33, 'type': 'places', 'places': [], 'enabled': False},\n", - " 'legend': {'size': 170,\n", - " 'title': '',\n", - " 'labels': 'ranges',\n", - " 'enabled': True,\n", - " 'reverse': True,\n", - " 'labelMax': 'high',\n", - " 'labelMin': 'low',\n", - " 'position': 'mt',\n", - " 'hideItems': [],\n", - " 'offsetTop': 0,\n", - " 'offsetLeft': 0,\n", - " 'interactive': True,\n", - " 'labelCenter': 'medium',\n", - " 'labelFormat': '0%',\n", - " 'orientation': 'horizontal',\n", - " 'customLabels': ['Group A', 'Group B', 'Group C']},\n", - " 'basemap': 'germany-kreise-2021',\n", - " 'tooltip': {'body': 'Median freier Intensivbetten: {{ FORMAT(median_free_beds_in_percent, \"0.0%\") }}\\n\\n',\n", - " 'title': '{{ kreis }}',\n", - " 'sticky': True,\n", - " 'enabled': True},\n", - " 'zoomable': True,\n", - " 'map-align': 'center',\n", - " 'colorscale': {'map': [],\n", - " 'mode': 'discrete',\n", - " 'stops': 'custom',\n", - " 'colors': [{'color': '#F03B20', 'position': 0},\n", - " {'color': '#FEB24C', 'position': 0.5},\n", - " {'color': '#38A800', 'position': 1}],\n", - " 'palette': 0,\n", - " 'rangeMax': '100',\n", - " 'rangeMin': '0',\n", - " 'stopCount': 3,\n", - " 'customStops': [None, '10', '25', None, 45.5, 56.1, None],\n", - " 'rangeCenter': '',\n", - " 'categoryOrder': [],\n", - " 'interpolation': 'equidistant',\n", - " 'categoryLabels': []},\n", - " 'max-height': 650,\n", - " 'map-padding': 0,\n", - " 'map-key-attr': 'ags',\n", - " 'map-type-set': True,\n", - " 'chart-type-set': True,\n", - " 'max-map-height': 650,\n", - " 'min-label-zoom': 1,\n", - " 'zoom-button-pos': 'br',\n", - " 'map-label-format': '0,0.[00]',\n", - " 'text-annotations': [],\n", - " 'hide-empty-regions': False,\n", - " 'avoid-label-overlap': True},\n", - " 'axes': {'keys': 'gemeindeschluessel',\n", - " 'values': 'median_free_beds_in_percent'},\n", - " 'publish': {'embed-width': 600,\n", - " 'embed-height': 785,\n", - " 'blocks': {'logo': {'enabled': False},\n", - " 'embed': True,\n", - " 'download-pdf': False,\n", - " 'download-svg': False,\n", - " 'get-the-data': True,\n", - " 'download-image': True},\n", - " 'export-pdf': {},\n", - " 'embed-codes': {'embed-method-responsive': '',\n", - " 'embed-method-iframe': ''},\n", - " 'chart-height': 673.13330078125},\n", - " 'annotate': {'notes': ''},\n", - " 'custom': {},\n", - " 'json_error': None},\n", - " 'externalData': '',\n", - " 'utf8': False,\n", - " 'createdAt': '2022-03-25T16:27:58.000Z',\n", - " 'lastModifiedAt': '2022-12-05T13:34:40.155Z',\n", - " 'forkedFrom': None,\n", - " 'organizationId': None,\n", - " 'authorId': 433861,\n", - " 'folderId': None},\n", - " 'version': 273,\n", - " 'url': 'https://datawrapper.dwcdn.net/dYmYb/273/'}" - ] - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" + "ename": "NameError", + "evalue": "name 'createMedianOfFreeBedsByKreisChart' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\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(\n\u001b[1;32m 2\u001b[0m timeSeries,\n\u001b[1;32m 3\u001b[0m chartTitle \u001b[38;5;241m=\u001b[39m getChartTitle(\n\u001b[1;32m 4\u001b[0m dateStart\u001b[38;5;241m=\u001b[39mtimeSeries[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdate\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mmin(),\n\u001b[1;32m 5\u001b[0m dateEnd\u001b[38;5;241m=\u001b[39mtimeSeries[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdate\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mmax()))\n", + "\u001b[0;31mNameError\u001b[0m: name 'createMedianOfFreeBedsByKreisChart' is not defined" + ] } ], "source": [ - "from decouple import AutoConfig\n", - "\n", - "config = AutoConfig(search_path='../..')\n", - "dataWrapper = Datawrapper(config('DATAWRAPPER_API_TOKEN'))\n", - "dataWrapper.setChartTitle(\n", - " getChartTitle(\n", + "createMedianOfFreeBedsByKreisChart(\n", + " timeSeries,\n", + " chartTitle = getChartTitle(\n", " dateStart=timeSeries['date'].min(),\n", - " dateEnd=timeSeries['date'].max()))\n", - "dataWrapper.uploadChartData(medianOfFreeBedsByKreisTable)\n", - "dataWrapper.publishChart()\n" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "id": "0218cdb4", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:40.389248Z", - "iopub.status.busy": "2022-12-05T13:34:40.388449Z", - "iopub.status.idle": "2022-12-05T13:34:40.401978Z", - "shell.execute_reply": "2022-12-05T13:34:40.400480Z" - } - }, - "outputs": [], - "source": [ - "def publishGitHubPages():\n", - " %cd /home/frankknoll/Dokumente/Corona/projects/HowBadIsMyBatch-pages\n", - " ! git add -A\n", - " ! git commit -m \"updating data for Intensivstationen\"\n", - " ! git push" - ] - }, - { - "cell_type": "markdown", - "id": "a1e83b07", - "metadata": {}, - "source": [ - "### see https://knollfrank.github.io/HowBadIsMyBatch/intensivstationen.html" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "id": "5f173c2b", - "metadata": { - "execution": { - "iopub.execute_input": "2022-12-05T13:34:40.407363Z", - "iopub.status.busy": "2022-12-05T13:34:40.406933Z", - "iopub.status.idle": "2022-12-05T13:34:40.411533Z", - "shell.execute_reply": "2022-12-05T13:34:40.410663Z" - } - }, - "outputs": [], - "source": [ - "# publishGitHubPages()" + " dateEnd=timeSeries['date'].max()))" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3.10.8 ('howbadismybatch-venv')", + "display_name": "howbadismybatch-venv", "language": "python", "name": "python3" }, @@ -5388,7 +374,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0]" + "version": "3.10.8" }, "vscode": { "interpreter": {