Merge branch 'main' into pages
This commit is contained in:
@@ -45,14 +45,6 @@ jobs:
|
||||
# jupyter nbconvert --to html HowBadIsMyBatch.nbconvert.ipynb
|
||||
git add -A
|
||||
git diff-index --quiet HEAD || git commit -m "updating data for batch codes"
|
||||
- name: Executing Intensivstationen.ipynb
|
||||
shell: bash -el {0}
|
||||
run: |
|
||||
cd src/intensivstationen
|
||||
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 diff-index --quiet HEAD || git commit -m "updating data for Intensivstationen"
|
||||
- name: Pushing changes to GitHub Pages
|
||||
shell: bash -el {0}
|
||||
run: |
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
src/VAERS/
|
||||
src/intensivstationen/zeitreihe-tagesdaten.csv
|
||||
src/intensivstationen/geckodriver.log
|
||||
src/intensivstationen/Intensivstationen.nbconvert.html
|
||||
.ipynb_checkpoints/
|
||||
.history/
|
||||
src/tmp/
|
||||
@@ -12,7 +9,6 @@ docs/data/*.html
|
||||
src/captchaImage.jpeg
|
||||
src/HowBadIsMyBatch.nbconvert.html
|
||||
src/__pycache__/
|
||||
src/intensivstationen/__pycache__/
|
||||
google-chrome-stable_current_amd64*
|
||||
src/captcha/__pycache__
|
||||
src/GoogleAnalytics/__pycache__
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
class FreeBedsChartView {
|
||||
|
||||
#canvas;
|
||||
#chart;
|
||||
|
||||
constructor(canvas) {
|
||||
this.#canvas = canvas;
|
||||
}
|
||||
|
||||
displayChart({ data, title }) {
|
||||
if (this.#chart != null) {
|
||||
this.#chart.destroy();
|
||||
}
|
||||
const label = 'freie Betten';
|
||||
this.#chart = new Chart(
|
||||
this.#canvas,
|
||||
{
|
||||
type: 'line',
|
||||
data: this.#getData(data, label),
|
||||
options: this.#getOptions(title, label),
|
||||
plugins: [this.#getBackgroundTrafficLightsPlugin()]
|
||||
});
|
||||
}
|
||||
|
||||
#getBackgroundTrafficLightsPlugin() {
|
||||
function fillRect({ chart, startInPercent, endInPercent, color }) {
|
||||
const ctx = chart.ctx;
|
||||
const chartArea = chart.chartArea;
|
||||
const chartWidth = chartArea.right - chartArea.left;
|
||||
const chartHeight = chartArea.bottom - chartArea.top
|
||||
const y = chartArea.bottom - chartHeight * endInPercent / 100;
|
||||
const height = chartHeight * (endInPercent - startInPercent) / 100;
|
||||
ctx.fillStyle = color;
|
||||
ctx.fillRect(chartArea.left, y, chartWidth, height);
|
||||
}
|
||||
|
||||
function drawTrafficLights(chart) {
|
||||
const RED = 'rgba(240, 59, 32, 0.75)'; // #F03B20
|
||||
const YELLOW = 'rgba(254, 178, 76, 0.75)'; // #FEB24C
|
||||
const GREEN = 'rgba(56, 168, 0, 0.75)'; // #38A800
|
||||
chart.ctx.save();
|
||||
fillRect({ chart: chart, startInPercent: 0, endInPercent: 10, color: RED });
|
||||
fillRect({ chart: chart, startInPercent: 10, endInPercent: 25, color: YELLOW });
|
||||
fillRect({ chart: chart, startInPercent: 25, endInPercent: 100, color: GREEN });
|
||||
chart.ctx.restore();
|
||||
}
|
||||
|
||||
return { beforeDraw: drawTrafficLights };
|
||||
}
|
||||
|
||||
setData(data) {
|
||||
this.#chart.config.data.datasets[0].data = data;
|
||||
this.#chart.config.data.datasets[1].data = data;
|
||||
this.#chart.update();
|
||||
}
|
||||
|
||||
#getData(data, label) {
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: label,
|
||||
data: data,
|
||||
parsing: {
|
||||
yAxisKey: 'free_beds_divided_by_all_beds_in_percent'
|
||||
},
|
||||
backgroundColor: 'rgba(0, 0, 150, 1)'
|
||||
},
|
||||
{
|
||||
label: 'Median freier Betten',
|
||||
data: data,
|
||||
parsing: {
|
||||
yAxisKey: 'median_free_beds_in_percent'
|
||||
},
|
||||
backgroundColor: 'rgba(0, 150, 150, 1)'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
#getOptions(title, label) {
|
||||
return {
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: title
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: UIUtils.getYLabelWithPercent
|
||||
}
|
||||
}
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
x: {
|
||||
type: 'time',
|
||||
time: {
|
||||
tooltipFormat: 'DD.MM.YYYY',
|
||||
unit: 'month',
|
||||
displayFormats: {
|
||||
'month': 'MMM YYYY'
|
||||
}
|
||||
}
|
||||
},
|
||||
y: UIUtils.getPercentageScale(label)
|
||||
},
|
||||
parsing: {
|
||||
xAxisKey: 'date'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
class IntensiveCareCapacitiesChartView {
|
||||
|
||||
#canvas;
|
||||
#chart;
|
||||
|
||||
constructor(canvas) {
|
||||
this.#canvas = canvas;
|
||||
}
|
||||
|
||||
displayChart({ data, title }) {
|
||||
if (this.#chart != null) {
|
||||
this.#chart.destroy();
|
||||
}
|
||||
this.#chart = new Chart(
|
||||
this.#canvas,
|
||||
{
|
||||
type: 'bar',
|
||||
data: this.#getData(data),
|
||||
options: this.#getOptions(title)
|
||||
});
|
||||
}
|
||||
|
||||
setData(data) {
|
||||
this.#chart.config.data.datasets[0].data = data;
|
||||
this.#chart.config.data.datasets[1].data = data;
|
||||
this.#chart.update();
|
||||
}
|
||||
|
||||
#getData(data) {
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: 'Belegte Betten',
|
||||
data: data,
|
||||
parsing: {
|
||||
yAxisKey: 'betten_belegt'
|
||||
},
|
||||
backgroundColor: 'rgba(255, 0, 0, 1)'
|
||||
},
|
||||
{
|
||||
label: 'Freie Betten',
|
||||
data: data,
|
||||
parsing: {
|
||||
yAxisKey: 'betten_frei'
|
||||
},
|
||||
backgroundColor: 'rgba(0, 255, 0, 1)'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
#getOptions(title) {
|
||||
return {
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: title
|
||||
},
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
x: {
|
||||
stacked: true,
|
||||
type: 'time',
|
||||
time: {
|
||||
tooltipFormat: 'DD.MM.YYYY',
|
||||
unit: 'month',
|
||||
displayFormats: {
|
||||
'month': 'MMM YYYY'
|
||||
}
|
||||
}
|
||||
},
|
||||
y: {
|
||||
stacked: true
|
||||
}
|
||||
},
|
||||
parsing: {
|
||||
xAxisKey: 'date'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
class MedianOfFreeBedsByKreisChartView {
|
||||
|
||||
#canvas;
|
||||
#chart;
|
||||
|
||||
constructor(canvas) {
|
||||
this.#canvas = canvas;
|
||||
}
|
||||
|
||||
displayChart(data) {
|
||||
if (this.#chart != null) {
|
||||
this.#chart.destroy();
|
||||
}
|
||||
const label = 'Median freier Betten';
|
||||
this.#chart = new Chart(
|
||||
this.#canvas,
|
||||
{
|
||||
type: 'bar',
|
||||
data: this.#getData(data, label),
|
||||
options: this.#getOptions(label)
|
||||
});
|
||||
}
|
||||
|
||||
setData(data) {
|
||||
this.#chart.config.data.datasets[0].data = data;
|
||||
this.#chart.update();
|
||||
}
|
||||
|
||||
#getData(data, label) {
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: label,
|
||||
data: data,
|
||||
parsing: {
|
||||
xAxisKey: 'median_free_beds_in_percent'
|
||||
},
|
||||
backgroundColor: 'rgba(0, 255, 0, 1)'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
#getOptions(label) {
|
||||
return {
|
||||
indexAxis: 'y',
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: label
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: UIUtils.getXLabelWithPercent
|
||||
}
|
||||
}
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
y: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Landkreis'
|
||||
}
|
||||
},
|
||||
x: UIUtils.getPercentageScale(label)
|
||||
},
|
||||
parsing: {
|
||||
yAxisKey: 'Kreis'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user