diff --git a/packages/app/schema/gm/booster_coverage_archived_20220904.json b/packages/app/schema/gm/booster_coverage_archived_20220904.json
index 43cf6de9a7..d59085231e 100644
--- a/packages/app/schema/gm/booster_coverage_archived_20220904.json
+++ b/packages/app/schema/gm/booster_coverage_archived_20220904.json
@@ -5,7 +5,6 @@
"properties": {
"values": {
"type": "array",
- "minItems": 1,
"maxItems": 2,
"items": {
"$ref": "#/definitions/value"
diff --git a/packages/app/src/data/gm/vaccinations/empty-coverage-data.ts b/packages/app/src/data/gm/vaccinations/empty-coverage-data.ts
new file mode 100644
index 0000000000..085807a85b
--- /dev/null
+++ b/packages/app/src/data/gm/vaccinations/empty-coverage-data.ts
@@ -0,0 +1,42 @@
+// This file was introduced as part of COR-1226 which covers the municipality reorganisation of 2023.
+// During this reorganisation, three municipalities (GMs) have been merged into a single GM, specifically
+// GM0501, GM0530 and GM0614 became GM1992. This reorganisation resulted in missing coverage data
+// for both booster vaccinations as well as base vaccinations. This file combats the missing data by
+// generating 'empty' data objects with no values.
+
+const emptyBoosterCoverageValue = {
+ percentage: null,
+ percentage_label: null,
+ date_of_insertion_unix: null,
+ date_unix: undefined,
+};
+
+const emptyVaccineCoveragePerAgeGroupValue = {
+ has_one_shot_percentage: null,
+ has_one_shot_percentage_label: null,
+ fully_vaccinated_percentage: null,
+ fully_vaccinated_percentage_label: null,
+ date_of_insertion_unix: null,
+ date_unix: null,
+};
+
+export const emptyCoverageData = {
+ booster_coverage_archived_20220904: {
+ values: [
+ { age_group: '12+', ...emptyBoosterCoverageValue },
+ { age_group: '18+', ...emptyBoosterCoverageValue },
+ ],
+ },
+ vaccine_coverage_per_age_group_archived: {
+ values: [
+ { age_group_range: '18+', birthyear_range: '-2003', ...emptyVaccineCoveragePerAgeGroupValue },
+ { age_group_range: '12+', birthyear_range: '-2009', ...emptyVaccineCoveragePerAgeGroupValue },
+ ],
+ },
+ vaccine_coverage_per_age_group_archived_20220908: {
+ values: [
+ { age_group_range: '18+', birthyear_range: '-2004', ...emptyVaccineCoveragePerAgeGroupValue },
+ { age_group_range: '12+', birthyear_range: '-2010', ...emptyVaccineCoveragePerAgeGroupValue },
+ ],
+ },
+};
diff --git a/packages/app/src/domain/vaccine/vaccine-coverage-toggle-tile.tsx b/packages/app/src/domain/vaccine/vaccine-coverage-toggle-tile.tsx
index b3e291a05f..2b607678c7 100644
--- a/packages/app/src/domain/vaccine/vaccine-coverage-toggle-tile.tsx
+++ b/packages/app/src/domain/vaccine/vaccine-coverage-toggle-tile.tsx
@@ -13,10 +13,7 @@ import { useIntl } from '~/intl';
import { SiteText } from '~/locale';
import { assert } from '~/utils/assert';
import { replaceVariablesInText } from '~/utils/replace-variables-in-text';
-import {
- KeyWithLabel,
- useVaccineCoveragePercentageFormatter,
-} from './logic/use-vaccine-coverage-percentage-formatter';
+import { KeyWithLabel, useVaccineCoveragePercentageFormatter } from './logic/use-vaccine-coverage-percentage-formatter';
type AgeTypes = {
fully_vaccinated: number | null;
@@ -49,7 +46,7 @@ interface VaccineCoverageToggleTileProps {
descriptionFooter: string;
age18Plus: AgeTypes;
age12Plus: AgeTypes;
- dateUnix: number;
+ dateUnix: number | null;
numFractionDigits?: number;
age12PlusToggleText: VaccinationGradeToggleTypes;
age18PlusToggleText: VaccinationGradeToggleTypes;
@@ -71,7 +68,7 @@ export function VaccineCoverageToggleTile({
const [selectedTab, setSelectedTab] = useState(age18PlusToggleText.label);
const metadata: MetadataProps = {
- date: dateUnix,
+ date: dateUnix ?? undefined,
source: source,
};
@@ -104,21 +101,10 @@ export function VaccineCoverageToggleTile({
description={age18PlusToggleText.description_booster_grade}
numFractionDigits={numFractionDigits}
>
- {age18Plus.dateUnixBoostered && (
-
- )}
+ {age18Plus.dateUnixBoostered && }
) : (
-
+
)}
{metadata && }
@@ -145,21 +129,10 @@ export function VaccineCoverageToggleTile({
description={age12PlusToggleText.description_booster_grade}
numFractionDigits={numFractionDigits}
>
- {age12Plus.dateUnixBoostered && (
-
- )}
+ {age12Plus.dateUnixBoostered && }
) : (
-
+
)}
{metadata && }
@@ -195,26 +166,13 @@ interface AgeGroupBlockProps {
children?: React.ReactNode;
}
-function AgeGroupBlock({
- title,
- data,
- property,
- secondProperty,
- description,
- secondDescription,
- numFractionDigits,
- children,
-}: AgeGroupBlockProps) {
+function AgeGroupBlock({ title, data, property, secondProperty, description, secondDescription, numFractionDigits, children }: AgeGroupBlockProps) {
const { commonTexts } = useIntl();
- const formatCoveragePercentage =
- useVaccineCoveragePercentageFormatter(numFractionDigits);
+ const formatCoveragePercentage = useVaccineCoveragePercentageFormatter(numFractionDigits);
const parsedBirthyearRange = parseBirthyearRange(data.birthyear);
- assert(
- parsedBirthyearRange,
- `[${AgeGroupBlock.name}] Something went wrong with parsing the birthyear: ${data.birthyear}`
- );
+ assert(parsedBirthyearRange, `[${AgeGroupBlock.name}] Something went wrong with parsing the birthyear: ${data.birthyear}`);
return (
@@ -228,19 +186,13 @@ function AgeGroupBlock({
{secondDescription && secondProperty && (
diff --git a/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx b/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx
index d92fd82f21..9c366b826b 100644
--- a/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx
+++ b/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx
@@ -18,6 +18,7 @@ import { assert, replaceVariablesInText, useReverseRouter, useFormatLokalizePerc
import { getLastInsertionDateOfPage } from '~/utils/get-last-insertion-date-of-page';
import { useDynamicLokalizeTexts } from '~/utils/cms/use-dynamic-lokalize-texts';
import { VaccineCoverageChoroplethVrAndGm } from '~/domain/vaccine/vaccine-coverage-choropleth_vr_and_gm';
+import { emptyCoverageData } from '~/data/gm/vaccinations/empty-coverage-data';
const pageMetrics = ['vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'booster_coverage_archived_20220904'];
@@ -101,14 +102,17 @@ export const VaccinationsGmPage = (props: StaticProps) =>
assert(filteredVaccination.primarySeries, `[${VaccinationsGmPage.name}] Could not find data for the vaccine coverage per age group for the primary series`);
assert(filteredVaccination.autumn2022, `[${VaccinationsGmPage.name}] Could not find data for the vaccine coverage per age group for the autumn 2022 series`);
- const boosterCoverage18PlusArchivedValue = data.booster_coverage_archived_20220904?.values?.find((v) => v.age_group === '18+');
- const boosterCoverage12PlusArchivedValue = data.booster_coverage_archived_20220904?.values?.find((v) => v.age_group === '12+');
+ const boosterCoverage18PlusArchivedValue =
+ data.booster_coverage_archived_20220904?.values?.find((v) => v.age_group === '18+') || emptyCoverageData.booster_coverage_archived_20220904.values[1];
+ const boosterCoverage12PlusArchivedValue =
+ data.booster_coverage_archived_20220904?.values?.find((v) => v.age_group === '12+') || emptyCoverageData.booster_coverage_archived_20220904.values[0];
- const filteredArchivedAgeGroup18Plus = data.vaccine_coverage_per_age_group_archived_20220908.values.find((x) => x.age_group_range === '18+');
- const filteredArchivedAgeGroup12Plus = data.vaccine_coverage_per_age_group_archived_20220908.values.find((x) => x.age_group_range === '12+');
-
- assert(filteredArchivedAgeGroup18Plus, `[${VaccinationsGmPage.name}] Could not find data for the archived vaccine coverage per age group for the age 18+`);
- assert(filteredArchivedAgeGroup12Plus, `[${VaccinationsGmPage.name}] Could not find data for the archived vaccine coverage per age group for the age 12+`);
+ const filteredArchivedAgeGroup18Plus =
+ data.vaccine_coverage_per_age_group_archived_20220908.values.find((x) => x.age_group_range === '18+') ||
+ emptyCoverageData.vaccine_coverage_per_age_group_archived_20220908.values[0];
+ const filteredArchivedAgeGroup12Plus =
+ data.vaccine_coverage_per_age_group_archived_20220908.values.find((x) => x.age_group_range === '12+') ||
+ emptyCoverageData.vaccine_coverage_per_age_group_archived_20220908.values[1];
const lastInsertionDateOfPage = getLastInsertionDateOfPage(data, pageMetrics);
@@ -253,7 +257,7 @@ export const VaccinationsGmPage = (props: StaticProps) =>
description={textGm.vaccination_coverage.description}
sortingOrder={['18+', '12+']}
metadata={{
- date: data.vaccine_coverage_per_age_group_archived.values[0].date_unix,
+ date: data.vaccine_coverage_per_age_group_archived.values.length ? data.vaccine_coverage_per_age_group_archived.values[0].date_unix : undefined,
source: textGm.vaccination_coverage.bronnen.rivm,
}}
values={data.vaccine_coverage_per_age_group_archived.values}