Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat: Added booster coverage for 12+ (#4211)
Browse files Browse the repository at this point in the history
- Updated schemas for VR and GM booster coverage
- Added feature flag to ignore validation of new property
- Added new data to the corresponding pages
  • Loading branch information
hasan-ozaynaci authored Apr 29, 2022
1 parent e0deb45 commit 86480b9
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
5 changes: 5 additions & 0 deletions packages/app/schema/gm/booster_coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"title": "gm_booster_coverage_value",
"type": "object",
"properties": {
"age_group": {
"type": "string",
"enum": ["12+", "18+"]
},
"percentage": {
"type": "number"
},
Expand All @@ -35,6 +39,7 @@
}
},
"required": [
"age_group",
"percentage",
"percentage_label",
"date_unix",
Expand Down
5 changes: 5 additions & 0 deletions packages/app/schema/vr/booster_coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"title": "vr_booster_coverage_value",
"type": "object",
"properties": {
"age_group": {
"type": "string",
"enum": ["12+", "18+"]
},
"percentage": {
"type": "number"
},
Expand All @@ -35,6 +39,7 @@
}
},
"required": [
"age_group",
"percentage",
"percentage_label",
"date_unix",
Expand Down
20 changes: 15 additions & 5 deletions packages/app/src/pages/gemeente/[code]/vaccinaties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ export const VaccinationsGmPage = (
}),
};

const boosterCoverageLastValue = data.booster_coverage?.last_value;

/**
* Filter out only the the 12+ and 18+ for the toggle component.
*/
Expand All @@ -146,6 +144,13 @@ export const VaccinationsGmPage = (
(x) => x.age_group_range === '12+'
);

const boosterCoverage18PlusValue =
data.booster_coverage.values.find((v) => v.age_group === '18+') ||
data.booster_coverage.last_value;
const boosterCoverage12PlusValue =
data.booster_coverage.values.find((v) => v.age_group === '12+') ||
undefined;

assert(
filteredAgeGroup18Plus,
`[${VaccinationsGmPage.name}] Could not find data for the vaccine coverage per age group for the age 18+`
Expand Down Expand Up @@ -198,10 +203,10 @@ export const VaccinationsGmPage = (
has_one_shot_label:
filteredAgeGroup18Plus.has_one_shot_percentage_label,
boostered: formatPercentageAsNumber(
`${boosterCoverageLastValue.percentage}`
`${boosterCoverage18PlusValue?.percentage}`
),
boostered_label: boosterCoverageLastValue.percentage_label,
dateUnixBoostered: boosterCoverageLastValue.date_unix,
boostered_label: boosterCoverage18PlusValue?.percentage_label,
dateUnixBoostered: boosterCoverage18PlusValue?.date_unix,
}}
age12Plus={{
fully_vaccinated:
Expand All @@ -212,6 +217,11 @@ export const VaccinationsGmPage = (
filteredAgeGroup12Plus.fully_vaccinated_percentage_label,
has_one_shot_label:
filteredAgeGroup12Plus.has_one_shot_percentage_label,
boostered: formatPercentageAsNumber(
`${boosterCoverage12PlusValue?.percentage}`
),
boostered_label: boosterCoverage12PlusValue?.percentage_label,
dateUnixBoostered: boosterCoverage12PlusValue?.date_unix,
}}
age12PlusToggleText={
textGm.vaccination_grade_toggle_tile.age_12_plus
Expand Down
20 changes: 15 additions & 5 deletions packages/app/src/pages/veiligheidsregio/[code]/vaccinaties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ export const VaccinationsVrPage = (
const gmCodes = gmCodesByVrCode[router.query.code as string];
const selectedGmCode = gmCodes ? gmCodes[0] : undefined;

const boosterCoverageLastValue = data.booster_coverage?.last_value;

/**
* Filter out only the the 12+ and 18+ for the toggle component.
*/
Expand All @@ -148,6 +146,13 @@ export const VaccinationsVrPage = (
(item) => item.age_group_range === '12+'
);

const boosterCoverage18PlusValue =
data.booster_coverage.values.find((v) => v.age_group === '18+') ||
data.booster_coverage.last_value;
const boosterCoverage12PlusValue =
data.booster_coverage.values.find((v) => v.age_group === '12+') ||
undefined;

assert(
filteredAgeGroup18Plus,
`[${VaccinationsVrPage.name}] Could not find data for the vaccine coverage per age group for the age 18+`
Expand Down Expand Up @@ -200,10 +205,10 @@ export const VaccinationsVrPage = (
has_one_shot_label:
filteredAgeGroup18Plus.has_one_shot_percentage_label,
boostered: formatPercentageAsNumber(
`${boosterCoverageLastValue.percentage}`
`${boosterCoverage18PlusValue?.percentage}`
),
boostered_label: boosterCoverageLastValue.percentage_label,
dateUnixBoostered: boosterCoverageLastValue.date_unix,
boostered_label: boosterCoverage18PlusValue?.percentage_label,
dateUnixBoostered: boosterCoverage18PlusValue?.date_unix,
}}
age12Plus={{
fully_vaccinated:
Expand All @@ -214,6 +219,11 @@ export const VaccinationsVrPage = (
filteredAgeGroup12Plus.fully_vaccinated_percentage_label,
has_one_shot_label:
filteredAgeGroup12Plus.has_one_shot_percentage_label,
boostered: formatPercentageAsNumber(
`${boosterCoverage12PlusValue?.percentage}`
),
boostered_label: boosterCoverage12PlusValue?.percentage_label,
dateUnixBoostered: boosterCoverage12PlusValue?.date_unix,
}}
age12PlusToggleText={
textVr.vaccination_grade_toggle_tile.age_12_plus
Expand Down
7 changes: 7 additions & 0 deletions packages/common/src/feature-flags/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ export const features: Feature[] = [
dataScopes: ['vr', 'gm'],
metricName: 'booster_coverage',
},
{
name: 'boosterCoverageAgeGroup',
isEnabled: false,
dataScopes: ['vr', 'gm'],
metricName: 'booster_coverage',
metricProperties: ['age_group'],
},
{
name: 'riskLevel',
isEnabled: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export interface GmBoosterCoverage {
last_value: GmBoosterCoverageValue;
}
export interface GmBoosterCoverageValue {
age_group: "12+" | "18+";
percentage: number;
percentage_label: string | null;
date_unix: number;
Expand Down Expand Up @@ -1426,6 +1427,7 @@ export interface VrBoosterCoverage {
last_value: VrBoosterCoverageValue;
}
export interface VrBoosterCoverageValue {
age_group: "12+" | "18+";
percentage: number;
percentage_label: string | null;
date_unix: number;
Expand Down

0 comments on commit 86480b9

Please sign in to comment.