@@ -52,9 +52,15 @@ let maxCount = 0;
52
52
let oldestDate = '9001-12-31' ;
53
53
let latestDate = '1970-01-01' ;
54
54
let latestPubDate = '1970-01-01' ;
55
- for ( const { date, pubDate, state, atLeastPartiallyVaccinatedCumulative, atLeastPartiallyVaccinatedPercent, atLeastPartiallyVaccinatedCumulativeBioNTech , atLeastPartiallyVaccinatedCumulativeModerna , atLeastPartiallyVaccinatedCumulativeAstraZeneca , fullyVaccinatedCumulative , fullyVaccinatedPercent , fullyVaccinatedCumulativeBioNTech , fullyVaccinatedCumulativeModerna , fullyVaccinatedCumulativeAstraZeneca , fullyVaccinatedCumulativeJohnsonAndJohnson , totalDosesCumulative } of records ) {
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 ) {
56
56
if ( state !== BUNDESWEHR ) states . add ( state ) ;
57
+ const countInitialDoses = Number ( initialDosesCumulative ) ;
58
+ const countFinalDoses = Number ( finalDosesCumulative ) ;
57
59
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 ) ;
58
64
if ( countTotal > maxCount ) {
59
65
maxCount = countTotal ;
60
66
}
@@ -74,17 +80,18 @@ for (const {date, pubDate, state, atLeastPartiallyVaccinatedCumulative, atLeastP
74
80
}
75
81
map . get ( date ) . set ( state , {
76
82
cumulativeTotal : countTotal ,
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 ) ,
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 ) ,
83
91
atLeastPartiallyVaccinatedCumulative : Number ( atLeastPartiallyVaccinatedCumulative ) ,
84
92
atLeastPartiallyVaccinatedPercent : Number ( atLeastPartiallyVaccinatedPercent ) ,
85
93
fullyVaccinatedCumulative : Number ( fullyVaccinatedCumulative ) ,
86
94
fullyVaccinatedPercent : Number ( fullyVaccinatedPercent ) ,
87
- // TODO: This now possibly includes 2nd doses, since it’s atLeastPartiallyVaccinatedPercent. Rename.
88
95
percentInitialDose : percentInitialDose ,
89
96
percentFinalDose : percentFinalDose ,
90
97
} ) ;
@@ -139,6 +146,17 @@ const percentFormatter = new Intl.NumberFormat('en', {
139
146
minimumFractionDigits : 2 ,
140
147
maximumFractionDigits : 2 ,
141
148
} ) ;
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
+ }
142
160
function percentAtLeastPartiallyVaccinated ( state ) {
143
161
if ( state ) {
144
162
const latestEntries = sortedMap . get ( latestDate ) ;
@@ -166,6 +184,12 @@ const intFormatter = new Intl.NumberFormat('en', {
166
184
minimumFractionDigits : 0 ,
167
185
maximumFractionDigits : 0 ,
168
186
} ) ;
187
+ function onlyPartiallyVaccinated ( state ) {
188
+ const current = state ?
189
+ map . get ( latestDate ) . get ( state ) . onlyPartiallyVaccinatedCumulative :
190
+ nationalCumulativeOnlyPartiallyVaccinated ;
191
+ return intFormatter . format ( current ) ;
192
+ }
169
193
function atLeastPartiallyVaccinated ( state ) {
170
194
const current = state ?
171
195
map . get ( latestDate ) . get ( state ) . atLeastPartiallyVaccinatedCumulative :
@@ -264,6 +288,7 @@ function sevenDayAverageDosesAsPercentage(state) {
264
288
}
265
289
266
290
let nationalCumulativeTotal = 0 ;
291
+ let nationalCumulativeOnlyPartiallyVaccinated = 0 ;
267
292
let nationalCumulativeAtLeastPartiallyVaccinated = 0 ;
268
293
let nationalCumulativeFullyVaccinated = 0 ;
269
294
let nationalCumulativeTotalInitialDose = 0 ;
@@ -284,28 +309,36 @@ function generateNationalData() {
284
309
] ;
285
310
286
311
const countsTotal = [ ] ;
312
+ const countsInitialDose = [ ] ;
287
313
const countsFinalDose = [ ] ;
288
314
const countsAvailable = [ ] ;
289
315
for ( const [ date , entry ] of sortedMap ) {
316
+ let onlyPartiallyVaccinated = 0 ;
290
317
let atLeastPartiallyVaccinated = 0 ;
291
318
let fullyVaccinated = 0 ;
292
319
let totalDoses = 0 ;
320
+ let initialDoses = 0 ;
293
321
let finalDoses = 0 ;
294
322
let availableDoses = 0 ;
295
323
for ( const data of entry . values ( ) ) {
324
+ onlyPartiallyVaccinated += data . onlyPartiallyVaccinatedCumulative ;
296
325
atLeastPartiallyVaccinated += data . atLeastPartiallyVaccinatedCumulative ;
297
326
fullyVaccinated += data . fullyVaccinatedCumulative ;
298
327
totalDoses += data . cumulativeTotal ;
328
+ initialDoses += data . cumulativeInitial ;
299
329
finalDoses += data . cumulativeFinal ;
300
330
availableDoses = cumulativeDeliveryMap . get ( date ) . get ( 'Total' ) ;
301
331
}
302
332
if ( date === latestDate ) {
333
+ nationalCumulativeOnlyPartiallyVaccinated = onlyPartiallyVaccinated ;
303
334
nationalCumulativeAtLeastPartiallyVaccinated = atLeastPartiallyVaccinated ;
304
335
nationalCumulativeFullyVaccinated = fullyVaccinated ;
305
336
nationalCumulativeTotal = totalDoses ;
337
+ nationalCumulativeTotalInitialDose = initialDoses ;
306
338
nationalCumulativeTotalFinalDose = finalDoses ;
307
339
}
308
340
countsTotal . push ( totalDoses ) ;
341
+ countsInitialDose . push ( initialDoses ) ;
309
342
countsFinalDose . push ( finalDoses ) ;
310
343
countsAvailable . push ( availableDoses ) ;
311
344
}
@@ -320,12 +353,11 @@ function generateNationalData() {
320
353
chartType : 'line' ,
321
354
values : countsTotal ,
322
355
} ,
323
- // TODO: Replace with atLeastPartiallyVaccinatedCumulative?
324
- // {
325
- // name: 'Initial doses',
326
- // chartType: 'line',
327
- // values: countsInitialDose,
328
- // },
356
+ {
357
+ name : 'Initial doses' ,
358
+ chartType : 'line' ,
359
+ values : countsInitialDose ,
360
+ } ,
329
361
{
330
362
name : 'Final doses' ,
331
363
chartType : 'line' ,
@@ -657,14 +689,14 @@ function generateStateData(desiredState) {
657
689
] ;
658
690
659
691
const countsTotal = [ ] ;
660
- const countsAtLeastPartiallyVaccinated = [ ] ;
661
- const countsFullyVaccinated = [ ] ;
692
+ const countsInitialDose = [ ] ;
693
+ const countsFinalDose = [ ] ;
662
694
const countsAvailable = [ ] ;
663
695
for ( const [ date , entry ] of sortedMap ) {
664
696
const data = entry . get ( desiredState ) ;
665
697
countsTotal . push ( data . cumulativeTotal ) ;
666
- countsAtLeastPartiallyVaccinated . push ( data . atLeastPartiallyVaccinatedCumulative ) ;
667
- countsFullyVaccinated . push ( data . cumulativeFinal ) ;
698
+ countsInitialDose . push ( data . cumulativeInitial ) ;
699
+ countsFinalDose . push ( data . cumulativeFinal ) ;
668
700
const availableDoses = cumulativeDeliveryMap . get ( date ) . get ( desiredState ) ;
669
701
countsAvailable . push ( availableDoses ) ;
670
702
}
@@ -682,12 +714,12 @@ function generateStateData(desiredState) {
682
714
{
683
715
name : 'Initial doses' ,
684
716
chartType : 'line' ,
685
- values : countsAtLeastPartiallyVaccinated ,
717
+ values : countsInitialDose ,
686
718
} ,
687
719
{
688
720
name : 'Final doses' ,
689
721
chartType : 'line' ,
690
- values : countsFullyVaccinated ,
722
+ values : countsFinalDose ,
691
723
} ,
692
724
) ;
693
725
@@ -752,8 +784,10 @@ const createHtml = template(HTML_TEMPLATE, {
752
784
dataAnomalyWarning,
753
785
isDeliveryDataDefinitelyOutdated,
754
786
population,
787
+ percentOnlyPartiallyVaccinated,
755
788
percentAtLeastPartiallyVaccinated,
756
789
percentFullyVaccinated,
790
+ onlyPartiallyVaccinated,
757
791
atLeastPartiallyVaccinated,
758
792
fullyVaccinated,
759
793
sevenDayAverageDoses,
0 commit comments