|
|
|
|
@@ -1,381 +0,0 @@
|
|
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 1,
|
|
|
|
|
"id": "9de5907f-18f5-4cb1-903e-26028ff1fa03",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:44.104995Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:44.104587Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:44.112590Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:44.112137Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"import os\n",
|
|
|
|
|
"import sys\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"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": "640be762",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:44.114631Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:44.114466Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:44.548819Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:44.548300Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"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",
|
|
|
|
|
"\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": "e40d4c8d",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:44.551642Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:44.551210Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:44.554883Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:44.554231Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
|
|
|
|
"12.07.2024, 20:22:44 Uhr\n"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"print(datetime.now().strftime(\"%d.%m.%Y, %H:%M:%S Uhr\"))"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 4,
|
|
|
|
|
"id": "336f56e6",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:44.558117Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:44.557507Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:45.585440Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:45.584763Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
|
|
|
|
" lastUpdated: 2023-02-03 11:49:00\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"ename": "SessionNotCreatedException",
|
|
|
|
|
"evalue": "Message: session not created: Chrome failed to start: exited normally.\n (session not created: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\n#0 0x56276328ac7a <unknown>\n#1 0x562762f6de2c <unknown>\n#2 0x562762fa2d6a <unknown>\n#3 0x562762f9f17b <unknown>\n#4 0x562762fe9c49 <unknown>\n#5 0x562762fdd363 <unknown>\n#6 0x562762fad247 <unknown>\n#7 0x562762fadb9e <unknown>\n#8 0x56276325124b <unknown>\n#9 0x5627632552f1 <unknown>\n#10 0x56276323cafe <unknown>\n#11 0x562763255e52 <unknown>\n#12 0x56276322179f <unknown>\n#13 0x56276327a638 <unknown>\n#14 0x56276327a810 <unknown>\n#15 0x562763289dac <unknown>\n#16 0x7f2fee294ac3 <unknown>\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 \u001b[38;5;28;01mTrue\u001b[39;00m \u001b[38;5;66;03m# dateProvider.needsUpdate()\u001b[39;00m\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:33\u001b[0m, in \u001b[0;36mDateProvider.getLastUpdatedDataSource\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 31\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 32\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---> 33\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 34\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 35\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 options\u001b[38;5;241m.\u001b[39mheadless \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\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-profile\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 44\u001b[0m driver \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_getWebDriver\u001b[49m\u001b[43m(\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~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/DateProvider.py:52\u001b[0m, in \u001b[0;36mDateProvider._getWebDriver\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_getWebDriver\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m---> 52\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwebdriver\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mChrome\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 53\u001b[0m \u001b[43m \u001b[49m\u001b[43mservice\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mChromeService\u001b[49m\u001b[43m(\u001b[49m\u001b[43mexecutable_path\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mChromeDriverManager\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minstall\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 54\u001b[0m \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[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_getOptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:45\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, options, service, keep_alive)\u001b[0m\n\u001b[1;32m 42\u001b[0m service \u001b[38;5;241m=\u001b[39m service \u001b[38;5;28;01mif\u001b[39;00m service \u001b[38;5;28;01melse\u001b[39;00m Service()\n\u001b[1;32m 43\u001b[0m options \u001b[38;5;241m=\u001b[39m options \u001b[38;5;28;01mif\u001b[39;00m options \u001b[38;5;28;01melse\u001b[39;00m Options()\n\u001b[0;32m---> 45\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\n\u001b[1;32m 46\u001b[0m \u001b[43m \u001b[49m\u001b[43mbrowser_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mDesiredCapabilities\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mCHROME\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mbrowserName\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 47\u001b[0m \u001b[43m \u001b[49m\u001b[43mvendor_prefix\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mgoog\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 48\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 49\u001b[0m \u001b[43m \u001b[49m\u001b[43mservice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mservice\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 50\u001b[0m \u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkeep_alive\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 51\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py:61\u001b[0m, in \u001b[0;36mChromiumDriver.__init__\u001b[0;34m(self, browser_name, vendor_prefix, options, service, keep_alive)\u001b[0m\n\u001b[1;32m 52\u001b[0m executor \u001b[38;5;241m=\u001b[39m ChromiumRemoteConnection(\n\u001b[1;32m 53\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,\n\u001b[1;32m 54\u001b[0m browser_name\u001b[38;5;241m=\u001b[39mbrowser_name,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 57\u001b[0m ignore_proxy\u001b[38;5;241m=\u001b[39moptions\u001b[38;5;241m.\u001b[39m_ignore_local_proxy,\n\u001b[1;32m 58\u001b[0m )\n\u001b[1;32m 60\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 61\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\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[1;32m 63\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquit()\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:208\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, command_executor, keep_alive, file_detector, options)\u001b[0m\n\u001b[1;32m 206\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 207\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstart_client()\n\u001b[0;32m--> 208\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\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:292\u001b[0m, in \u001b[0;36mWebDriver.start_session\u001b[0;34m(self, capabilities)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Creates a new session with the desired capabilities.\u001b[39;00m\n\u001b[1;32m 286\u001b[0m \n\u001b[1;32m 287\u001b[0m \u001b[38;5;124;03m:Args:\u001b[39;00m\n\u001b[1;32m 288\u001b[0m \u001b[38;5;124;03m - capabilities - a capabilities dict to start the session with.\u001b[39;00m\n\u001b[1;32m 289\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 291\u001b[0m caps \u001b[38;5;241m=\u001b[39m _create_caps(capabilities)\n\u001b[0;32m--> 292\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[43mcaps\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 293\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msession_id \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msessionId\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcaps \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapabilities\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:347\u001b[0m, in \u001b[0;36mWebDriver.execute\u001b[0;34m(self, driver_command, params)\u001b[0m\n\u001b[1;32m 345\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 346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response:\n\u001b[0;32m--> 347\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 348\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 349\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:229\u001b[0m, in \u001b[0;36mErrorHandler.check_response\u001b[0;34m(self, response)\u001b[0m\n\u001b[1;32m 227\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 228\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--> 229\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exception_class(message, screen, stacktrace)\n",
|
|
|
|
|
"\u001b[0;31mSessionNotCreatedException\u001b[0m: Message: session not created: Chrome failed to start: exited normally.\n (session not created: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\n#0 0x56276328ac7a <unknown>\n#1 0x562762f6de2c <unknown>\n#2 0x562762fa2d6a <unknown>\n#3 0x562762f9f17b <unknown>\n#4 0x562762fe9c49 <unknown>\n#5 0x562762fdd363 <unknown>\n#6 0x562762fad247 <unknown>\n#7 0x562762fadb9e <unknown>\n#8 0x56276325124b <unknown>\n#9 0x5627632552f1 <unknown>\n#10 0x56276323cafe <unknown>\n#11 0x562763255e52 <unknown>\n#12 0x56276322179f <unknown>\n#13 0x56276327a638 <unknown>\n#14 0x56276327a810 <unknown>\n#15 0x562763289dac <unknown>\n#16 0x7f2fee294ac3 <unknown>\n"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"dateProvider = DateProvider()\n",
|
|
|
|
|
"print(' lastUpdated:', dateProvider.getLastUpdated())\n",
|
|
|
|
|
"print('lastUpdatedDataSource:', dateProvider.getLastUpdatedDataSource()) \n",
|
|
|
|
|
"needsUpdate = True # dateProvider.needsUpdate()\n",
|
|
|
|
|
"print('needsUpdate:', needsUpdate)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"id": "63be303c",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:45.593171Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:45.592498Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:45.955191Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:45.954503Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"ename": "SessionNotCreatedException",
|
|
|
|
|
"evalue": "Message: session not created: Chrome failed to start: exited normally.\n (session not created: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\n#0 0x555d82117c7a <unknown>\n#1 0x555d81dfae2c <unknown>\n#2 0x555d81e2fd6a <unknown>\n#3 0x555d81e2c17b <unknown>\n#4 0x555d81e76c49 <unknown>\n#5 0x555d81e6a363 <unknown>\n#6 0x555d81e3a247 <unknown>\n#7 0x555d81e3ab9e <unknown>\n#8 0x555d820de24b <unknown>\n#9 0x555d820e22f1 <unknown>\n#10 0x555d820c9afe <unknown>\n#11 0x555d820e2e52 <unknown>\n#12 0x555d820ae79f <unknown>\n#13 0x555d82107638 <unknown>\n#14 0x555d82107810 <unknown>\n#15 0x555d82116dac <unknown>\n#16 0x7f6743894ac3 <unknown>\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:33\u001b[0m, in \u001b[0;36mDateProvider.getLastUpdatedDataSource\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 31\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 32\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---> 33\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 34\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 35\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 options\u001b[38;5;241m.\u001b[39mheadless \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\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-profile\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 44\u001b[0m driver \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_getWebDriver\u001b[49m\u001b[43m(\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~/work/HowBadIsMyBatch/HowBadIsMyBatch/src/intensivstationen/DateProvider.py:52\u001b[0m, in \u001b[0;36mDateProvider._getWebDriver\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_getWebDriver\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m---> 52\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwebdriver\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mChrome\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 53\u001b[0m \u001b[43m \u001b[49m\u001b[43mservice\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mChromeService\u001b[49m\u001b[43m(\u001b[49m\u001b[43mexecutable_path\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mChromeDriverManager\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minstall\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 54\u001b[0m \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[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_getOptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:45\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, options, service, keep_alive)\u001b[0m\n\u001b[1;32m 42\u001b[0m service \u001b[38;5;241m=\u001b[39m service \u001b[38;5;28;01mif\u001b[39;00m service \u001b[38;5;28;01melse\u001b[39;00m Service()\n\u001b[1;32m 43\u001b[0m options \u001b[38;5;241m=\u001b[39m options \u001b[38;5;28;01mif\u001b[39;00m options \u001b[38;5;28;01melse\u001b[39;00m Options()\n\u001b[0;32m---> 45\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\n\u001b[1;32m 46\u001b[0m \u001b[43m \u001b[49m\u001b[43mbrowser_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mDesiredCapabilities\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mCHROME\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mbrowserName\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 47\u001b[0m \u001b[43m \u001b[49m\u001b[43mvendor_prefix\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mgoog\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 48\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 49\u001b[0m \u001b[43m \u001b[49m\u001b[43mservice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mservice\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 50\u001b[0m \u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkeep_alive\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 51\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py:61\u001b[0m, in \u001b[0;36mChromiumDriver.__init__\u001b[0;34m(self, browser_name, vendor_prefix, options, service, keep_alive)\u001b[0m\n\u001b[1;32m 52\u001b[0m executor \u001b[38;5;241m=\u001b[39m ChromiumRemoteConnection(\n\u001b[1;32m 53\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,\n\u001b[1;32m 54\u001b[0m browser_name\u001b[38;5;241m=\u001b[39mbrowser_name,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 57\u001b[0m ignore_proxy\u001b[38;5;241m=\u001b[39moptions\u001b[38;5;241m.\u001b[39m_ignore_local_proxy,\n\u001b[1;32m 58\u001b[0m )\n\u001b[1;32m 60\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 61\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\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[1;32m 63\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquit()\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:208\u001b[0m, in \u001b[0;36mWebDriver.__init__\u001b[0;34m(self, command_executor, keep_alive, file_detector, options)\u001b[0m\n\u001b[1;32m 206\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 207\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstart_client()\n\u001b[0;32m--> 208\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\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:292\u001b[0m, in \u001b[0;36mWebDriver.start_session\u001b[0;34m(self, capabilities)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Creates a new session with the desired capabilities.\u001b[39;00m\n\u001b[1;32m 286\u001b[0m \n\u001b[1;32m 287\u001b[0m \u001b[38;5;124;03m:Args:\u001b[39;00m\n\u001b[1;32m 288\u001b[0m \u001b[38;5;124;03m - capabilities - a capabilities dict to start the session with.\u001b[39;00m\n\u001b[1;32m 289\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 291\u001b[0m caps \u001b[38;5;241m=\u001b[39m _create_caps(capabilities)\n\u001b[0;32m--> 292\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[43mcaps\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 293\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msession_id \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msessionId\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcaps \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapabilities\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:347\u001b[0m, in \u001b[0;36mWebDriver.execute\u001b[0;34m(self, driver_command, params)\u001b[0m\n\u001b[1;32m 345\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 346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response:\n\u001b[0;32m--> 347\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 348\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 349\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
|
|
|
|
|
"File \u001b[0;32m/usr/share/miniconda/envs/howbadismybatch-venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:229\u001b[0m, in \u001b[0;36mErrorHandler.check_response\u001b[0;34m(self, response)\u001b[0m\n\u001b[1;32m 227\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 228\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--> 229\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exception_class(message, screen, stacktrace)\n",
|
|
|
|
|
"\u001b[0;31mSessionNotCreatedException\u001b[0m: Message: session not created: Chrome failed to start: exited normally.\n (session not created: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\n#0 0x555d82117c7a <unknown>\n#1 0x555d81dfae2c <unknown>\n#2 0x555d81e2fd6a <unknown>\n#3 0x555d81e2c17b <unknown>\n#4 0x555d81e76c49 <unknown>\n#5 0x555d81e6a363 <unknown>\n#6 0x555d81e3a247 <unknown>\n#7 0x555d81e3ab9e <unknown>\n#8 0x555d820de24b <unknown>\n#9 0x555d820e22f1 <unknown>\n#10 0x555d820c9afe <unknown>\n#11 0x555d820e2e52 <unknown>\n#12 0x555d820ae79f <unknown>\n#13 0x555d82107638 <unknown>\n#14 0x555d82107810 <unknown>\n#15 0x555d82116dac <unknown>\n#16 0x7f6743894ac3 <unknown>\n"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"saveLastUpdatedIntensivstationen(\n",
|
|
|
|
|
" dateProvider.getLastUpdatedDataSource(),\n",
|
|
|
|
|
" toHtmlFile = \"../../docs/intensivstationen.html\")"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 6,
|
|
|
|
|
"id": "3f992231",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:45.957916Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:45.957534Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:45.970692Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:45.970200Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"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": [
|
|
|
|
|
"timeSeries = readTimeseries(download = needsUpdate)\n",
|
|
|
|
|
"timeSeries"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 7,
|
|
|
|
|
"id": "356494d3",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:45.972860Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:45.972686Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:45.985785Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:45.985256Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"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)\n",
|
|
|
|
|
"saveKreisOptions(\n",
|
|
|
|
|
" kreisOptions = getKreisOptionsAndAlleLandkreise(kreisValues),\n",
|
|
|
|
|
" toHtmlFile = \"../../docs/intensivstationen.html\")"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 8,
|
|
|
|
|
"id": "349edd73",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:45.988201Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:45.987729Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:45.999773Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:45.999221Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"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[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"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"getAndPersistIntensiveCareBeds4AlleKreise(\n",
|
|
|
|
|
" timeSeries,\n",
|
|
|
|
|
" intensivstationenDataDir = '../../docs/data/intensivstationen',\n",
|
|
|
|
|
" kreisValues = kreisValues)\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 9,
|
|
|
|
|
"id": "f10704f3",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:46.001964Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:46.001658Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:46.015480Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:46.014817Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"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": [
|
|
|
|
|
"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": 10,
|
|
|
|
|
"id": "d1b75357",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:46.017729Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:46.017415Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:46.020708Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:46.020048Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"def getChartTitle(dateStart, dateEnd):\n",
|
|
|
|
|
" def formatDate(date):\n",
|
|
|
|
|
" return date.strftime(\"%d.%m.%Y\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" return f\"Median freier Intensivbetten im Zeitraum {formatDate(dateStart)} bis {formatDate(dateEnd)}\""
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 11,
|
|
|
|
|
"id": "8b392b34",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"execution": {
|
|
|
|
|
"iopub.execute_input": "2024-07-12T20:22:46.023187Z",
|
|
|
|
|
"iopub.status.busy": "2024-07-12T20:22:46.022744Z",
|
|
|
|
|
"iopub.status.idle": "2024-07-12T20:22:46.037599Z",
|
|
|
|
|
"shell.execute_reply": "2024-07-12T20:22:46.037017Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"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[11], line 4\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[1;32m 3\u001b[0m createMedianOfFreeBedsByKreisChart(\n\u001b[0;32m----> 4\u001b[0m \u001b[43mtimeSeries\u001b[49m,\n\u001b[1;32m 5\u001b[0m chartTitle \u001b[38;5;241m=\u001b[39m getChartTitle(\n\u001b[1;32m 6\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 7\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[1;32m 8\u001b[0m accessToken \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDATAWRAPPER_API_TOKEN\u001b[39m\u001b[38;5;124m'\u001b[39m])\n",
|
|
|
|
|
"\u001b[0;31mNameError\u001b[0m: name 'timeSeries' is not defined"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"import os\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"createMedianOfFreeBedsByKreisChart(\n",
|
|
|
|
|
" timeSeries,\n",
|
|
|
|
|
" chartTitle = getChartTitle(\n",
|
|
|
|
|
" dateStart=timeSeries['date'].min(),\n",
|
|
|
|
|
" dateEnd=timeSeries['date'].max()),\n",
|
|
|
|
|
" accessToken = os.environ['DATAWRAPPER_API_TOKEN'])"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"kernelspec": {
|
|
|
|
|
"display_name": "howbadismybatch-venv",
|
|
|
|
|
"language": "python",
|
|
|
|
|
"name": "python3"
|
|
|
|
|
},
|
|
|
|
|
"language_info": {
|
|
|
|
|
"codemirror_mode": {
|
|
|
|
|
"name": "ipython",
|
|
|
|
|
"version": 3
|
|
|
|
|
},
|
|
|
|
|
"file_extension": ".py",
|
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
|
"name": "python",
|
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
|
"version": "3.9.18"
|
|
|
|
|
},
|
|
|
|
|
"vscode": {
|
|
|
|
|
"interpreter": {
|
|
|
|
|
"hash": "1bce2b9b19ce5f16d695ff75ac05095b3e564c169ff454b58b87cb796c0695b8"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|
"nbformat_minor": 5
|
|
|
|
|
}
|