Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Commit 4d5406a

Browse files
committed
Support upstream changes
This commit also removes all no longer reported fields. Issue: #35 WIP
1 parent a104275 commit 4d5406a

9 files changed

+2567
-2718
lines changed

README.md

-24
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,15 @@ As of 2021-02-11, this repository also provides [data on vaccine orders being de
2222

2323
Usually, the spreadsheets containing the statistics for day `X` are published on day `X + 1`, but there have been exceptions where the stats got published on the same day. In case multiple spreadsheets are released containing data for the same `date`, we only consider the latest version.
2424

25-
### `initialDoses*` vs. `finalDoses*`
26-
27-
- Any columns with the `initialDoses` prefix refer exclusively to first doses of vaccines that require two doses in total (i.e. Pfizer/BioNTech, Moderna, or Oxford/AstraZeneca).
28-
- Any columns with the `finalDoses` prefix refer exclusively to
29-
- second doses of vaccines that require two doses in total (i.e. Pfizer/BioNTech, Moderna, or Oxford/AstraZeneca), and
30-
- doses of vaccines that only require a single dose (i.e. Johnson & Johnson).
31-
3225
### Partially vs. fully vaccinated
3326

3427
There’s been [some confusion](https://github.com/mathiasbynens/covid-19-vaccinations-germany/issues/27#issuecomment-829299315) about what “partial” vaccination means. Given that there are multiple potentially interesting metrics that RKI does not report directly, we derive and expose the following additional columns:
3528

36-
- `onlyPartiallyVaccinatedCumulative`: the number of people who are partially vaccinated but still need a second shot. (They received exactly 1 dose of Pfizer/BioNTech, Moderna, Oxford/AstraZeneca, and still need a second dose to become fully vaccinated.)
37-
- `onlyPartiallyVaccinatedPercent`
3829
- `atLeastPartiallyVaccinatedCumulative`: the number of people who received at least one vaccination. (They received at least 1 dose of Pfizer/BioNTech, Moderna, Oxford/AstraZeneca, or Johnson & Johnson. This includes people who received 2 doses of Pfizer/BioNTech, Moderna, or Oxford/AstraZeneca.)
3930
- `atLeastPartiallyVaccinatedPercent`
4031
- `fullyVaccinatedCumulative`: the number of people who received either 1 dose of Johnson & Johnson; or 2 doses of Pfizer/BioNTech, Moderna, or Oxford/AstraZeneca.
4132
- `fullyVaccinatedPercent`
4233

43-
### Deprecated columns
44-
45-
As of 2021-04-08, RKI stopped reporting the following data points:
46-
47-
- `initialDosesDueToAge`
48-
- `initialDosesDueToProfession`
49-
- `initialDosesDueToMedicalReasons`
50-
- `initialDosesToNursingHomeResidents`
51-
- `finalDosesDueToAge`
52-
- `finalDosesDueToProfession`
53-
- `finalDosesDueToMedicalReasons`
54-
- `finalDosesToNursingHomeResidents`
55-
56-
These columns are still included in the CSV as they contain potentially useful data for prior dates.
57-
5834
### Anomalies in the data
5935

6036
Cumulative vaccination metrics cannot decrease over time, yet sometimes the reported data contains such a “drop” (as reflected in [the charts](https://mathiasbynens.github.io/covid-19-vaccinations-germany/)). These anomalies match the data reported by the RKI, which sometimes overreports statistics and then corrects the numbers for the next day, or vice versa. (Sadly, the RKI doesn’t publish corrected numbers for the previous day, else we could retroactively correct our data.)

build-chart.js

+22-56
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,9 @@ let maxCount = 0;
5252
let oldestDate = '9001-12-31';
5353
let latestDate = '1970-01-01';
5454
let latestPubDate = '1970-01-01';
55-
for (const {date, pubDate, state, onlyPartiallyVaccinatedCumulative, onlyPartiallyVaccinatedPercent, atLeastPartiallyVaccinatedCumulative, atLeastPartiallyVaccinatedPercent, fullyVaccinatedCumulative, fullyVaccinatedPercent, totalDosesCumulative, initialDosesCumulative, finalDosesCumulative, initialDosesPercent, finalDosesPercent, initialDosesCumulativeBioNTech, finalDosesCumulativeBioNTech, initialDosesCumulativeModerna, finalDosesCumulativeModerna, initialDosesCumulativeAstraZeneca, finalDosesCumulativeAstraZeneca, finalDosesCumulativeJohnsonAndJohnson} of records) {
55+
for (const {date, pubDate, state, atLeastPartiallyVaccinatedCumulative, atLeastPartiallyVaccinatedPercent, atLeastPartiallyVaccinatedCumulativeBioNTech, atLeastPartiallyVaccinatedCumulativeModerna, atLeastPartiallyVaccinatedCumulativeAstraZeneca, fullyVaccinatedCumulative, fullyVaccinatedPercent, fullyVaccinatedCumulativeBioNTech, fullyVaccinatedCumulativeModerna, fullyVaccinatedCumulativeAstraZeneca, fullyVaccinatedCumulativeJohnsonAndJohnson, totalDosesCumulative} of records) {
5656
if (state !== BUNDESWEHR) states.add(state);
57-
const countInitialDoses = Number(initialDosesCumulative);
58-
const countFinalDoses = Number(finalDosesCumulative);
5957
const countTotal = Number(totalDosesCumulative);
60-
const countBioNTech = Number(initialDosesCumulativeBioNTech) + Number(finalDosesCumulativeBioNTech);
61-
const countModerna = Number(initialDosesCumulativeModerna) + Number(finalDosesCumulativeModerna);
62-
const countAstraZeneca = Number(initialDosesCumulativeAstraZeneca) + Number(finalDosesCumulativeAstraZeneca);
63-
const countJohnsonAndJohnson = Number(finalDosesCumulativeJohnsonAndJohnson);
6458
if (countTotal > maxCount) {
6559
maxCount = countTotal;
6660
}
@@ -73,25 +67,24 @@ for (const {date, pubDate, state, onlyPartiallyVaccinatedCumulative, onlyPartial
7367
if (pubDate > latestPubDate) {
7468
latestPubDate = pubDate;
7569
}
76-
const percentInitialDose = Number(initialDosesPercent);
77-
const percentFinalDose = Number(finalDosesPercent);
70+
const percentInitialDose = Number(atLeastPartiallyVaccinatedPercent);
71+
const percentFinalDose = Number(fullyVaccinatedPercent);
7872
if (!map.has(date)) {
7973
map.set(date, new Map());
8074
}
8175
map.get(date).set(state, {
8276
cumulativeTotal: countTotal,
83-
cumulativeInitial: countInitialDoses,
84-
cumulativeFinal: countFinalDoses,
85-
cumulativeTotalBioNTech: countBioNTech,
86-
cumulativeTotalModerna: countModerna,
87-
cumulativeTotalAstraZeneca: countAstraZeneca,
88-
cumulativeTotalJohnsonAndJohnson: countJohnsonAndJohnson,
89-
onlyPartiallyVaccinatedCumulative: Number(onlyPartiallyVaccinatedCumulative),
90-
onlyPartiallyVaccinatedPercent: Number(onlyPartiallyVaccinatedPercent),
77+
cumulativeFinal: Number(fullyVaccinatedCumulative),
78+
// TODO: This might be wrong, depending on whether `atLeastPartiallyVaccinatedCumulative*` includes people who received a second dose as well.
79+
cumulativeTotalBioNTech: Number(atLeastPartiallyVaccinatedCumulativeBioNTech) + Number(fullyVaccinatedCumulativeBioNTech),
80+
cumulativeTotalModerna: Number(atLeastPartiallyVaccinatedCumulativeModerna) + Number(fullyVaccinatedCumulativeModerna),
81+
cumulativeTotalAstraZeneca: Number(atLeastPartiallyVaccinatedCumulativeAstraZeneca) + Number(fullyVaccinatedCumulativeAstraZeneca),
82+
cumulativeTotalJohnsonAndJohnson: Number(fullyVaccinatedCumulativeJohnsonAndJohnson),
9183
atLeastPartiallyVaccinatedCumulative: Number(atLeastPartiallyVaccinatedCumulative),
9284
atLeastPartiallyVaccinatedPercent: Number(atLeastPartiallyVaccinatedPercent),
9385
fullyVaccinatedCumulative: Number(fullyVaccinatedCumulative),
9486
fullyVaccinatedPercent: Number(fullyVaccinatedPercent),
87+
// TODO: This now possibly includes 2nd doses, since it’s atLeastPartiallyVaccinatedPercent. Rename.
9588
percentInitialDose: percentInitialDose,
9689
percentFinalDose: percentFinalDose,
9790
});
@@ -146,17 +139,6 @@ const percentFormatter = new Intl.NumberFormat('en', {
146139
minimumFractionDigits: 2,
147140
maximumFractionDigits: 2,
148141
});
149-
function percentOnlyPartiallyVaccinated(state) {
150-
if (state) {
151-
const latestEntries = sortedMap.get(latestDate);
152-
const latestStateEntries = latestEntries.get(state);
153-
const percent = latestStateEntries.onlyPartiallyVaccinatedPercent;
154-
return percentFormatter.format(percent);
155-
}
156-
const percent = nationalCumulativeOnlyPartiallyVaccinated /
157-
POPULATION_GERMANY * 100;
158-
return percentFormatter.format(percent);
159-
}
160142
function percentAtLeastPartiallyVaccinated(state) {
161143
if (state) {
162144
const latestEntries = sortedMap.get(latestDate);
@@ -184,12 +166,6 @@ const intFormatter = new Intl.NumberFormat('en', {
184166
minimumFractionDigits: 0,
185167
maximumFractionDigits: 0,
186168
});
187-
function onlyPartiallyVaccinated(state) {
188-
const current = state ?
189-
map.get(latestDate).get(state).onlyPartiallyVaccinatedCumulative :
190-
nationalCumulativeOnlyPartiallyVaccinated;
191-
return intFormatter.format(current);
192-
}
193169
function atLeastPartiallyVaccinated(state) {
194170
const current = state ?
195171
map.get(latestDate).get(state).atLeastPartiallyVaccinatedCumulative :
@@ -288,7 +264,6 @@ function sevenDayAverageDosesAsPercentage(state) {
288264
}
289265

290266
let nationalCumulativeTotal = 0;
291-
let nationalCumulativeOnlyPartiallyVaccinated = 0;
292267
let nationalCumulativeAtLeastPartiallyVaccinated = 0;
293268
let nationalCumulativeFullyVaccinated = 0;
294269
let nationalCumulativeTotalInitialDose = 0;
@@ -309,36 +284,28 @@ function generateNationalData() {
309284
];
310285

311286
const countsTotal = [];
312-
const countsInitialDose = [];
313287
const countsFinalDose = [];
314288
const countsAvailable = [];
315289
for (const [date, entry] of sortedMap) {
316-
let onlyPartiallyVaccinated = 0;
317290
let atLeastPartiallyVaccinated = 0;
318291
let fullyVaccinated = 0;
319292
let totalDoses = 0;
320-
let initialDoses = 0;
321293
let finalDoses = 0;
322294
let availableDoses = 0;
323295
for (const data of entry.values()) {
324-
onlyPartiallyVaccinated += data.onlyPartiallyVaccinatedCumulative;
325296
atLeastPartiallyVaccinated += data.atLeastPartiallyVaccinatedCumulative;
326297
fullyVaccinated += data.fullyVaccinatedCumulative;
327298
totalDoses += data.cumulativeTotal;
328-
initialDoses += data.cumulativeInitial;
329299
finalDoses += data.cumulativeFinal;
330300
availableDoses = cumulativeDeliveryMap.get(date).get('Total');
331301
}
332302
if (date === latestDate) {
333-
nationalCumulativeOnlyPartiallyVaccinated = onlyPartiallyVaccinated;
334303
nationalCumulativeAtLeastPartiallyVaccinated = atLeastPartiallyVaccinated;
335304
nationalCumulativeFullyVaccinated = fullyVaccinated;
336305
nationalCumulativeTotal = totalDoses;
337-
nationalCumulativeTotalInitialDose = initialDoses;
338306
nationalCumulativeTotalFinalDose = finalDoses;
339307
}
340308
countsTotal.push(totalDoses);
341-
countsInitialDose.push(initialDoses);
342309
countsFinalDose.push(finalDoses);
343310
countsAvailable.push(availableDoses);
344311
}
@@ -353,11 +320,12 @@ function generateNationalData() {
353320
chartType: 'line',
354321
values: countsTotal,
355322
},
356-
{
357-
name: 'Initial doses',
358-
chartType: 'line',
359-
values: countsInitialDose,
360-
},
323+
// TODO: Replace with atLeastPartiallyVaccinatedCumulative?
324+
// {
325+
// name: 'Initial doses',
326+
// chartType: 'line',
327+
// values: countsInitialDose,
328+
// },
361329
{
362330
name: 'Final doses',
363331
chartType: 'line',
@@ -689,14 +657,14 @@ function generateStateData(desiredState) {
689657
];
690658

691659
const countsTotal = [];
692-
const countsInitialDose = [];
693-
const countsFinalDose = [];
660+
const countsAtLeastPartiallyVaccinated = [];
661+
const countsFullyVaccinated = [];
694662
const countsAvailable = [];
695663
for (const [date, entry] of sortedMap) {
696664
const data = entry.get(desiredState);
697665
countsTotal.push(data.cumulativeTotal);
698-
countsInitialDose.push(data.cumulativeInitial);
699-
countsFinalDose.push(data.cumulativeFinal);
666+
countsAtLeastPartiallyVaccinated.push(data.atLeastPartiallyVaccinatedCumulative);
667+
countsFullyVaccinated.push(data.cumulativeFinal);
700668
const availableDoses = cumulativeDeliveryMap.get(date).get(desiredState);
701669
countsAvailable.push(availableDoses);
702670
}
@@ -714,12 +682,12 @@ function generateStateData(desiredState) {
714682
{
715683
name: 'Initial doses',
716684
chartType: 'line',
717-
values: countsInitialDose,
685+
values: countsAtLeastPartiallyVaccinated,
718686
},
719687
{
720688
name: 'Final doses',
721689
chartType: 'line',
722-
values: countsFinalDose,
690+
values: countsFullyVaccinated,
723691
},
724692
);
725693

@@ -784,10 +752,8 @@ const createHtml = template(HTML_TEMPLATE, {
784752
dataAnomalyWarning,
785753
isDeliveryDataDefinitelyOutdated,
786754
population,
787-
percentOnlyPartiallyVaccinated,
788755
percentAtLeastPartiallyVaccinated,
789756
percentFullyVaccinated,
790-
onlyPartiallyVaccinated,
791757
atLeastPartiallyVaccinated,
792758
fullyVaccinated,
793759
sevenDayAverageDoses,

0 commit comments

Comments
 (0)