diff --git a/.github/workflows/buildAndDeployWebsite.yml b/.github/workflows/buildAndDeployWebsite.yml index b48ad357844..e538857c44e 100644 --- a/.github/workflows/buildAndDeployWebsite.yml +++ b/.github/workflows/buildAndDeployWebsite.yml @@ -47,7 +47,7 @@ jobs: shell: bash -el {0} run: | cd src/intensivstationen - jupyter nbconvert --ExecutePreprocessor.kernel_name="howbadismybatch-venv-kernel" --to notebook --allow-errors --execute Intensivstationen.ipynb + DATAWRAPPER_API_TOKEN=${{ secrets.DATAWRAPPER_API_TOKEN }} jupyter nbconvert --ExecutePreprocessor.kernel_name="howbadismybatch-venv-kernel" --to notebook --allow-errors --execute Intensivstationen.ipynb jupyter nbconvert --to html Intensivstationen.nbconvert.ipynb git add -A git commit -m "updating data for Intensivstationen" diff --git a/src/intensivstationen/Chart.py b/src/intensivstationen/Chart.py index ae5ef09c89a..04d7f96d311 100644 --- a/src/intensivstationen/Chart.py +++ b/src/intensivstationen/Chart.py @@ -1,15 +1,15 @@ -from decouple import AutoConfig from Datawrapper import Datawrapper from ColumnsAdder import ColumnsAdder from KreiseReader import readKreise from MedianOfFreeBedsByKreisTableFactory import MedianOfFreeBedsByKreisTableFactory -def createMedianOfFreeBedsByKreisChart(timeSeries, chartTitle): - dataWrapper = Datawrapper(AutoConfig(search_path='../..')('DATAWRAPPER_API_TOKEN')) +def createMedianOfFreeBedsByKreisChart(timeSeries, chartTitle, accessToken): + dataWrapper = Datawrapper(accessToken) dataWrapper.setChartTitle(chartTitle) dataWrapper.uploadChartData(data = _createMedianOfFreeBedsByKreisTableForChoroplethMap(timeSeries)) - dataWrapper.publishChart() + publishChartResult = dataWrapper.publishChart() + print('publishChart:', publishChartResult) def _createMedianOfFreeBedsByKreisTableForChoroplethMap(timeSeries): medianOfFreeBedsByKreisTableFactory = MedianOfFreeBedsByKreisTableFactory(timeSeries) diff --git a/src/intensivstationen/Intensivstationen.ipynb b/src/intensivstationen/Intensivstationen.ipynb index 1deaca4ef1c..2fe083be95e 100644 --- a/src/intensivstationen/Intensivstationen.ipynb +++ b/src/intensivstationen/Intensivstationen.ipynb @@ -147,11 +147,14 @@ "metadata": {}, "outputs": [], "source": [ + "import os\n", + "\n", "createMedianOfFreeBedsByKreisChart(\n", " timeSeries,\n", " chartTitle = getChartTitle(\n", " dateStart=timeSeries['date'].min(),\n", - " dateEnd=timeSeries['date'].max()))" + " dateEnd=timeSeries['date'].max()),\n", + " accessToken = os.environ['DATAWRAPPER_API_TOKEN'])" ] } ],