From 6038a6758c477efb544ed99e98c49a204ff74c49 Mon Sep 17 00:00:00 2001 From: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Mon, 21 Nov 2022 17:31:06 +0100 Subject: [PATCH 01/32] feat(booster): remove and remame booster data from existing schemas (#4499) --- packages/app/schema/gm/__index.json | 6 +-- ...> booster_coverage_archived_20220904.json} | 4 +- .../gm/vaccine_coverage_per_age_group.json | 2 - .../vaccine_coverage_per_age_group.json | 9 ---- packages/app/schema/nl/__index.json | 12 ++--- ...> booster_coverage_archived_20220904.json} | 4 +- ..._shot_administered_archived_20220904.json} | 4 +- .../nl/vaccine_coverage_per_age_group.json | 8 ---- packages/app/schema/vr/__index.json | 6 +-- ...> booster_coverage_archived_20220904.json} | 4 +- .../vr/vaccine_coverage_per_age_group.json | 2 - .../vaccine_coverage_per_age_group.json | 9 ---- .../src/pages/gemeente/[code]/vaccinaties.tsx | 20 ++++---- .../app/src/pages/landelijk/vaccinaties.tsx | 46 +++++++++--------- .../veiligheidsregio/[code]/vaccinaties.tsx | 20 ++++---- packages/common/src/types/data.ts | 48 ++++++++----------- 16 files changed, 84 insertions(+), 120 deletions(-) rename packages/app/schema/gm/{booster_coverage.json => booster_coverage_archived_20220904.json} (89%) rename packages/app/schema/nl/{booster_coverage.json => booster_coverage_archived_20220904.json} (88%) rename packages/app/schema/nl/{booster_shot_administered.json => booster_shot_administered_archived_20220904.json} (88%) rename packages/app/schema/vr/{booster_coverage.json => booster_coverage_archived_20220904.json} (89%) diff --git a/packages/app/schema/gm/__index.json b/packages/app/schema/gm/__index.json index 015b7d3f4a..f90da3e170 100644 --- a/packages/app/schema/gm/__index.json +++ b/packages/app/schema/gm/__index.json @@ -17,7 +17,7 @@ "vaccine_coverage_per_age_group", "vaccine_coverage_per_age_group_archived", "vaccine_coverage_per_age_group_archived_20220908", - "booster_coverage" + "booster_coverage_archived_20220904" ], "properties": { "last_generated": { @@ -62,8 +62,8 @@ "vaccine_coverage_per_age_group_archived_20220908": { "$ref": "vaccine_coverage_per_age_group_archived_20220908.json" }, - "booster_coverage": { - "$ref": "booster_coverage.json" + "booster_coverage_archived_20220904": { + "$ref": "booster_coverage_archived_20220904.json" } }, "$defs": { diff --git a/packages/app/schema/gm/booster_coverage.json b/packages/app/schema/gm/booster_coverage_archived_20220904.json similarity index 89% rename from packages/app/schema/gm/booster_coverage.json rename to packages/app/schema/gm/booster_coverage_archived_20220904.json index eaee06edc9..43cf6de9a7 100644 --- a/packages/app/schema/gm/booster_coverage.json +++ b/packages/app/schema/gm/booster_coverage_archived_20220904.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "gm_booster_coverage", + "title": "gm_booster_coverage_archived_20220904", "type": "object", "properties": { "values": { @@ -16,7 +16,7 @@ "additionalProperties": false, "definitions": { "value": { - "title": "gm_booster_coverage_value", + "title": "gm_booster_coverage_archived_20220904_value", "type": "object", "properties": { "age_group": { diff --git a/packages/app/schema/gm/vaccine_coverage_per_age_group.json b/packages/app/schema/gm/vaccine_coverage_per_age_group.json index c77865c4db..91a5a31820 100644 --- a/packages/app/schema/gm/vaccine_coverage_per_age_group.json +++ b/packages/app/schema/gm/vaccine_coverage_per_age_group.json @@ -21,10 +21,8 @@ "age_group_range", "autumn_2022_vaccinated_percentage", "fully_vaccinated_percentage", - "booster_shot_percentage", "autumn_2022_vaccinated_percentage_label", "fully_vaccinated_percentage_label", - "booster_shot_percentage_label", "birthyear_range", "date_of_insertion_unix", "date_unix" diff --git a/packages/app/schema/gm_collection/vaccine_coverage_per_age_group.json b/packages/app/schema/gm_collection/vaccine_coverage_per_age_group.json index 8a98d9edbd..fcf937c108 100644 --- a/packages/app/schema/gm_collection/vaccine_coverage_per_age_group.json +++ b/packages/app/schema/gm_collection/vaccine_coverage_per_age_group.json @@ -11,8 +11,6 @@ "autumn_2022_vaccinated_percentage_label", "fully_vaccinated_percentage", "fully_vaccinated_percentage_label", - "booster_shot_percentage", - "booster_shot_percentage_label", "date_of_insertion_unix", "date_unix" ], @@ -31,9 +29,6 @@ "fully_vaccinated_percentage": { "type": ["integer", "null"] }, - "booster_shot_percentage": { - "type": ["integer", "null"] - }, "birthyear_range": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{4}$|^-[0-9]{4}$|^[0-9]{4}-$" @@ -46,10 +41,6 @@ "type": ["string", "null"], "pattern": "^([><][=][0-9]{1,2})$" }, - "booster_shot_percentage_label": { - "type": ["string", "null"], - "pattern": "^([><][=][0-9]{1,2})$" - }, "date_unix": { "type": "integer" }, diff --git a/packages/app/schema/nl/__index.json b/packages/app/schema/nl/__index.json index 5ee9f640dc..b955224bdd 100644 --- a/packages/app/schema/nl/__index.json +++ b/packages/app/schema/nl/__index.json @@ -5,9 +5,9 @@ "required": [ "behavior", "behavior_annotations", - "booster_shot_administered", + "booster_shot_administered_archived_20220904", "repeating_shot_administered", - "booster_coverage", + "booster_coverage_archived_20220904", "code", "corona_melder_app_download", "corona_melder_app_warning", @@ -80,14 +80,14 @@ "named_difference": { "$ref": "__named_difference.json" }, - "booster_shot_administered": { - "$ref": "booster_shot_administered.json" + "booster_shot_administered_archived_20220904": { + "$ref": "booster_shot_administered_archived_20220904.json" }, "repeating_shot_administered": { "$ref": "repeating_shot_administered.json" }, - "booster_coverage": { - "$ref": "booster_coverage.json" + "booster_coverage_archived_20220904": { + "$ref": "booster_coverage_archived_20220904.json" }, "doctor": { "$ref": "doctor.json" diff --git a/packages/app/schema/nl/booster_coverage.json b/packages/app/schema/nl/booster_coverage_archived_20220904.json similarity index 88% rename from packages/app/schema/nl/booster_coverage.json rename to packages/app/schema/nl/booster_coverage_archived_20220904.json index f4b5cfff2f..b4e5eed9d7 100644 --- a/packages/app/schema/nl/booster_coverage.json +++ b/packages/app/schema/nl/booster_coverage_archived_20220904.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "nl_booster_coverage", + "title": "nl_booster_coverage_archived_20220904", "type": "object", "properties": { "values": { @@ -16,7 +16,7 @@ "additionalProperties": false, "definitions": { "value": { - "title": "nl_booster_coverage_value", + "title": "nl_booster_coverage_archived_20220904_value", "type": "object", "properties": { "age_group": { diff --git a/packages/app/schema/nl/booster_shot_administered.json b/packages/app/schema/nl/booster_shot_administered_archived_20220904.json similarity index 88% rename from packages/app/schema/nl/booster_shot_administered.json rename to packages/app/schema/nl/booster_shot_administered_archived_20220904.json index 5f6326eeea..995d274b89 100644 --- a/packages/app/schema/nl/booster_shot_administered.json +++ b/packages/app/schema/nl/booster_shot_administered_archived_20220904.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "nl_booster_shot_administered", + "title": "nl_booster_shot_administered_archived_20220904", "type": "object", "properties": { "values": { @@ -19,7 +19,7 @@ "additionalProperties": false, "definitions": { "value": { - "title": "nl_booster_shot_administered_value", + "title": "nl_booster_shot_administered_archived_20220904_value", "type": "object", "properties": { "administered_total": { diff --git a/packages/app/schema/nl/vaccine_coverage_per_age_group.json b/packages/app/schema/nl/vaccine_coverage_per_age_group.json index b0fd6482d5..b9d8acd305 100644 --- a/packages/app/schema/nl/vaccine_coverage_per_age_group.json +++ b/packages/app/schema/nl/vaccine_coverage_per_age_group.json @@ -22,10 +22,8 @@ "age_group_range", "age_group_total", "autumn_2022_vaccinated", - "booster_shot", "autumn_2022_vaccinated_percentage", "fully_vaccinated_percentage", - "booster_shot_percentage", "date_of_insertion_unix", "date_unix", "date_of_report_unix", @@ -59,18 +57,12 @@ "fully_vaccinated": { "type": "integer" }, - "booster_shot": { - "type": ["integer", "null"] - }, "autumn_2022_vaccinated_percentage": { "type": ["integer", "null"] }, "fully_vaccinated_percentage": { "type": "number" }, - "booster_shot_percentage": { - "type": ["number", "null"] - }, "date_unix": { "type": "integer" }, diff --git a/packages/app/schema/vr/__index.json b/packages/app/schema/vr/__index.json index 88a856d288..026e0ed88d 100644 --- a/packages/app/schema/vr/__index.json +++ b/packages/app/schema/vr/__index.json @@ -27,7 +27,7 @@ "vaccine_coverage_per_age_group", "vaccine_coverage_per_age_group_archived", "vaccine_coverage_per_age_group_archived_20220908", - "booster_coverage" + "booster_coverage_archived_20220904" ], "additionalProperties": false, "properties": { @@ -106,8 +106,8 @@ "vaccine_coverage_per_age_group_archived_20220908": { "$ref": "vaccine_coverage_per_age_group_archived_20220908.json" }, - "booster_coverage": { - "$ref": "booster_coverage.json" + "booster_coverage_archived_20220904": { + "$ref": "booster_coverage_archived_20220904.json" } }, "$defs": { diff --git a/packages/app/schema/vr/booster_coverage.json b/packages/app/schema/vr/booster_coverage_archived_20220904.json similarity index 89% rename from packages/app/schema/vr/booster_coverage.json rename to packages/app/schema/vr/booster_coverage_archived_20220904.json index d07b6435de..565ba114c4 100644 --- a/packages/app/schema/vr/booster_coverage.json +++ b/packages/app/schema/vr/booster_coverage_archived_20220904.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "vr_booster_coverage", + "title": "vr_booster_coverage_archived_20220904", "type": "object", "properties": { "values": { @@ -16,7 +16,7 @@ "additionalProperties": false, "definitions": { "value": { - "title": "vr_booster_coverage_value", + "title": "vr_booster_coverage_archived_20220904_value", "type": "object", "properties": { "age_group": { diff --git a/packages/app/schema/vr/vaccine_coverage_per_age_group.json b/packages/app/schema/vr/vaccine_coverage_per_age_group.json index 05e0de9d45..5175980c38 100644 --- a/packages/app/schema/vr/vaccine_coverage_per_age_group.json +++ b/packages/app/schema/vr/vaccine_coverage_per_age_group.json @@ -21,10 +21,8 @@ "age_group_range", "autumn_2022_vaccinated_percentage", "fully_vaccinated_percentage", - "booster_shot_percentage", "autumn_2022_vaccinated_percentage_label", "fully_vaccinated_percentage_label", - "booster_shot_percentage_label", "birthyear_range", "date_of_insertion_unix", "date_unix" diff --git a/packages/app/schema/vr_collection/vaccine_coverage_per_age_group.json b/packages/app/schema/vr_collection/vaccine_coverage_per_age_group.json index a9aaeddaa0..5d16ae1613 100644 --- a/packages/app/schema/vr_collection/vaccine_coverage_per_age_group.json +++ b/packages/app/schema/vr_collection/vaccine_coverage_per_age_group.json @@ -11,8 +11,6 @@ "autumn_2022_vaccinated_percentage_label", "fully_vaccinated_percentage_label", "fully_vaccinated_percentage", - "booster_shot_percentage", - "booster_shot_percentage_label", "date_of_insertion_unix", "date_unix" ], @@ -31,9 +29,6 @@ "fully_vaccinated_percentage": { "type": ["integer", "null"] }, - "booster_shot_percentage": { - "type": ["integer", "null"] - }, "birthyear_range": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{4}$|^-[0-9]{4}$|^[0-9]{4}-$" @@ -46,10 +41,6 @@ "type": ["string", "null"], "pattern": "^([><][=][0-9]{1,2})$" }, - "booster_shot_percentage_label": { - "type": ["string", "null"], - "pattern": "^([><][=][0-9]{1,2})$" - }, "date_unix": { "type": "integer" }, diff --git a/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx b/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx index 0feae720d3..b729c0e9a2 100644 --- a/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx +++ b/packages/app/src/pages/gemeente/[code]/vaccinaties.tsx @@ -24,7 +24,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'; -const pageMetrics = ['vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'booster_coverage']; +const pageMetrics = ['vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'booster_coverage_archived_20220904']; const selectLokalizeTexts = (siteText: SiteText) => ({ textGm: siteText.pages.vaccinations_page.gm, @@ -39,7 +39,7 @@ export { getStaticPaths } from '~/static-paths/gm'; export const getStaticProps = createGetStaticProps( ({ locale }: { locale: keyof Languages }) => getLokalizeTexts(selectLokalizeTexts, locale), getLastGeneratedDate, - selectGmData('code', 'vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'vaccine_coverage_per_age_group_archived_20220908', 'booster_coverage'), + selectGmData('code', 'vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'vaccine_coverage_per_age_group_archived_20220908', 'booster_coverage_archived_20220904'), createGetChoroplethData({ gm: ({ vaccine_coverage_per_age_group }, ctx) => { if (!isDefined(vaccine_coverage_per_age_group)) { @@ -117,8 +117,8 @@ export const VaccinationsGmPage = (props: StaticProps) => const filteredArchivedAgeGroup12Plus = data.vaccine_coverage_per_age_group_archived_20220908.values.find((x) => x.age_group_range === '12+'); - const boosterCoverage18PlusValue = data.booster_coverage?.values?.find((v) => v.age_group === '18+'); - const boosterCoverage12PlusValue = data.booster_coverage?.values?.find((v) => v.age_group === '12+'); + 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+'); assert(filteredAgeGroup60Plus, `[${VaccinationsGmPage.name}] Could not find data for the vaccine coverage per age group for the age 60+`); @@ -301,9 +301,9 @@ export const VaccinationsGmPage = (props: StaticProps) => birthyear: filteredArchivedAgeGroup18Plus.birthyear_range, fully_vaccinated_label: filteredArchivedAgeGroup18Plus.fully_vaccinated_percentage_label, has_one_shot_label: filteredArchivedAgeGroup18Plus.has_one_shot_percentage_label, - boostered: formatPercentageAsNumber(`${boosterCoverage18PlusValue?.percentage}`), - boostered_label: boosterCoverage18PlusValue?.percentage_label, - dateUnixBoostered: boosterCoverage18PlusValue?.date_unix, + boostered: formatPercentageAsNumber(`${boosterCoverage18PlusArchivedValue?.percentage}`), + boostered_label: boosterCoverage18PlusArchivedValue?.percentage_label, + dateUnixBoostered: boosterCoverage18PlusArchivedValue?.date_unix, }} age12Plus={{ fully_vaccinated: filteredArchivedAgeGroup12Plus.fully_vaccinated_percentage, @@ -311,9 +311,9 @@ export const VaccinationsGmPage = (props: StaticProps) => birthyear: filteredArchivedAgeGroup12Plus.birthyear_range, fully_vaccinated_label: filteredArchivedAgeGroup12Plus.fully_vaccinated_percentage_label, has_one_shot_label: filteredArchivedAgeGroup12Plus.has_one_shot_percentage_label, - boostered: formatPercentageAsNumber(`${boosterCoverage12PlusValue?.percentage}`), - boostered_label: boosterCoverage12PlusValue?.percentage_label, - dateUnixBoostered: boosterCoverage12PlusValue?.date_unix, + boostered: formatPercentageAsNumber(`${boosterCoverage12PlusArchivedValue?.percentage}`), + boostered_label: boosterCoverage12PlusArchivedValue?.percentage_label, + dateUnixBoostered: boosterCoverage12PlusArchivedValue?.date_unix, }} age12PlusToggleText={textGm.vaccination_grade_toggle_tile.age_12_plus} age18PlusToggleText={textGm.vaccination_grade_toggle_tile.age_18_plus} diff --git a/packages/app/src/pages/landelijk/vaccinaties.tsx b/packages/app/src/pages/landelijk/vaccinaties.tsx index a7f3366f5e..dcd6a7dc69 100644 --- a/packages/app/src/pages/landelijk/vaccinaties.tsx +++ b/packages/app/src/pages/landelijk/vaccinaties.tsx @@ -50,8 +50,8 @@ const pageMetrics = [ 'vaccine_coverage_per_age_group_estimated_autumn_2022', 'vaccine_campaigns', 'vaccine_planned', - 'booster_coverage', - 'booster_shot_administered', + 'booster_coverage_archived_20220904', + 'booster_shot_administered_archived_20220904', 'repeating_shot_administered', ]; @@ -86,8 +86,8 @@ export const getStaticProps = createGetStaticProps( 'vaccine_campaigns_archived_20220908', 'vaccine_planned', 'vaccine_planned_archived_20220908', - 'booster_coverage', - 'booster_shot_administered', + 'booster_coverage_archived_20220904', + 'booster_shot_administered_archived_20220904', 'repeating_shot_administered' ), () => selectAdministrationData(getNlData().data.vaccine_administered), @@ -150,13 +150,13 @@ function VaccinationPage(props: StaticProps) { const vaccineCoverageEstimatedArchivedLastValue = data.vaccine_coverage_per_age_group_estimated_archived_20220908.last_value; - const boosterShotAdministeredLastValue = data.booster_shot_administered.last_value; + const boosterShotAdministeredArchivedLastValue = data.booster_shot_administered_archived_20220904.last_value; - const boosterCoverage18PlusValue = data.booster_coverage.values.find((v) => v.age_group === '18+'); - const boosterCoverage12PlusValue = data.booster_coverage.values.find((v) => v.age_group === '12+'); + 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+'); - assert(boosterCoverage18PlusValue, `[${VaccinationPage.name}] Missing value for booster_coverage 18+`); - assert(boosterCoverage12PlusValue, `[${VaccinationPage.name}] Missing value for booster_coverage 12+`); + assert(boosterCoverage18PlusArchivedValue, `[${VaccinationPage.name}] Missing value for booster_coverage 18+`); + assert(boosterCoverage12PlusArchivedValue, `[${VaccinationPage.name}] Missing value for booster_coverage 12+`); const repeatingShotAdministeredLastValue = data.repeating_shot_administered?.last_value; @@ -313,16 +313,16 @@ function VaccinationPage(props: StaticProps) { age18Plus={{ fully_vaccinated: vaccineCoverageEstimatedArchivedLastValue.age_18_plus_fully_vaccinated, has_one_shot: vaccineCoverageEstimatedArchivedLastValue.age_18_plus_has_one_shot, - boostered: formatPercentageAsNumber(`${boosterCoverage18PlusValue.percentage}`), + boostered: formatPercentageAsNumber(`${boosterCoverage18PlusArchivedValue.percentage}`), birthyear: vaccineCoverageEstimatedArchivedLastValue.age_18_plus_birthyear, - dateUnixBoostered: boosterCoverage18PlusValue.date_unix, + dateUnixBoostered: boosterCoverage18PlusArchivedValue.date_unix, }} age12Plus={{ fully_vaccinated: vaccineCoverageEstimatedArchivedLastValue.age_12_plus_fully_vaccinated, has_one_shot: vaccineCoverageEstimatedArchivedLastValue.age_12_plus_has_one_shot, - boostered: formatPercentageAsNumber(`${boosterCoverage12PlusValue.percentage}`), + boostered: formatPercentageAsNumber(`${boosterCoverage12PlusArchivedValue.percentage}`), birthyear: vaccineCoverageEstimatedArchivedLastValue.age_12_plus_birthyear, - dateUnixBoostered: boosterCoverage12PlusValue.date_unix, + dateUnixBoostered: boosterCoverage12PlusArchivedValue.date_unix, }} numFractionDigits={1} age12PlusToggleText={textNl.vaccination_grade_toggle_tile.age_12_plus} @@ -345,8 +345,8 @@ function VaccinationPage(props: StaticProps) { /> ) { ({ textNl: siteText.pages.vaccinations_page.nl, @@ -40,7 +40,7 @@ export { getStaticPaths } from '~/static-paths/vr'; export const getStaticProps = createGetStaticProps( ({ locale }: { locale: keyof Languages }) => getLokalizeTexts(selectLokalizeTexts, locale), getLastGeneratedDate, - selectVrData('vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'vaccine_coverage_per_age_group_archived_20220908', 'booster_coverage'), + selectVrData('vaccine_coverage_per_age_group', 'vaccine_coverage_per_age_group_archived', 'vaccine_coverage_per_age_group_archived_20220908', 'booster_coverage_archived_20220904'), createGetChoroplethData({ gm: ({ vaccine_coverage_per_age_group }, ctx) => { if (!isDefined(vaccine_coverage_per_age_group)) { @@ -125,8 +125,8 @@ export const VaccinationsVrPage = (props: StaticProps) => const filteredAgeGroup12PlusArchived = data.vaccine_coverage_per_age_group_archived_20220908.values.find((item) => item.age_group_range === '12+'); - const boosterCoverage18PlusValue = data.booster_coverage.values.find((v) => v.age_group === '18+'); - const boosterCoverage12PlusValue = data.booster_coverage.values.find((v) => v.age_group === '12+'); + 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+'); assert(filteredAgeGroup60Plus, `[${VaccinationsVrPage.name}] Could not find data for the vaccine coverage per age group for the age 18+`); @@ -305,9 +305,9 @@ export const VaccinationsVrPage = (props: StaticProps) => birthyear: filteredAgeGroup18PlusArchived.birthyear_range, fully_vaccinated_label: filteredAgeGroup18PlusArchived.fully_vaccinated_percentage_label, has_one_shot_label: filteredAgeGroup18PlusArchived.has_one_shot_percentage_label, - boostered: formatPercentageAsNumber(`${boosterCoverage18PlusValue?.percentage}`), - boostered_label: boosterCoverage18PlusValue?.percentage_label, - dateUnixBoostered: boosterCoverage18PlusValue?.date_unix, + boostered: formatPercentageAsNumber(`${boosterCoverage18PlusArchivedValue?.percentage}`), + boostered_label: boosterCoverage18PlusArchivedValue?.percentage_label, + dateUnixBoostered: boosterCoverage18PlusArchivedValue?.date_unix, }} age12Plus={{ fully_vaccinated: filteredAgeGroup12PlusArchived.fully_vaccinated_percentage, @@ -315,9 +315,9 @@ export const VaccinationsVrPage = (props: StaticProps) => birthyear: filteredAgeGroup12PlusArchived.birthyear_range, fully_vaccinated_label: filteredAgeGroup12PlusArchived.fully_vaccinated_percentage_label, has_one_shot_label: filteredAgeGroup12PlusArchived.has_one_shot_percentage_label, - boostered: formatPercentageAsNumber(`${boosterCoverage12PlusValue?.percentage}`), - boostered_label: boosterCoverage12PlusValue?.percentage_label, - dateUnixBoostered: boosterCoverage12PlusValue?.date_unix, + boostered: formatPercentageAsNumber(`${boosterCoverage12PlusArchivedValue?.percentage}`), + boostered_label: boosterCoverage12PlusArchivedValue?.percentage_label, + dateUnixBoostered: boosterCoverage12PlusArchivedValue?.date_unix, }} age12PlusToggleText={textVr.vaccination_grade_toggle_tile.age_12_plus} age18PlusToggleText={textVr.vaccination_grade_toggle_tile.age_18_plus} diff --git a/packages/common/src/types/data.ts b/packages/common/src/types/data.ts index 132ca2a3ce..a280fa5126 100644 --- a/packages/common/src/types/data.ts +++ b/packages/common/src/types/data.ts @@ -21,7 +21,7 @@ export interface Gm { vaccine_coverage_per_age_group: GmVaccineCoveragePerAgeGroup; vaccine_coverage_per_age_group_archived: GmVaccineCoveragePerAgeGroupArchived; vaccine_coverage_per_age_group_archived_20220908: GmVaccineCoveragePerAgeGroupArchived_20220908; - booster_coverage: GmBoosterCoverage; + booster_coverage_archived_20220904: GmBoosterCoverageArchived_20220904; } export interface GmStaticValues { population_count: number; @@ -114,11 +114,11 @@ export interface GmVaccineCoveragePerAgeGroupValue { age_group_range: "12+" | "18+" | "60+"; autumn_2022_vaccinated_percentage: number | null; fully_vaccinated_percentage: number | null; - booster_shot_percentage: number | null; + booster_shot_percentage?: number | null; birthyear_range: string; autumn_2022_vaccinated_percentage_label: string | null; fully_vaccinated_percentage_label: string | null; - booster_shot_percentage_label: string | null; + booster_shot_percentage_label?: string | null; date_unix: number; date_of_insertion_unix: number; } @@ -150,10 +150,10 @@ export interface GmVaccineCoveragePerAgeGroupArchived_20220908Value { date_unix: number; date_of_insertion_unix: number; } -export interface GmBoosterCoverage { - values: GmBoosterCoverageValue[]; +export interface GmBoosterCoverageArchived_20220904 { + values: GmBoosterCoverageArchived_20220904Value[]; } -export interface GmBoosterCoverageValue { +export interface GmBoosterCoverageArchived_20220904Value { age_group?: "12+" | "18+"; percentage: number; percentage_label: string | null; @@ -202,11 +202,9 @@ export interface GmCollectionVaccineCoveragePerAgeGroup { age_group_range: "12+" | "18+" | "60+"; autumn_2022_vaccinated_percentage: number | null; fully_vaccinated_percentage: number | null; - booster_shot_percentage: number | null; birthyear_range: string; autumn_2022_vaccinated_percentage_label: string | null; fully_vaccinated_percentage_label: string | null; - booster_shot_percentage_label: string | null; date_unix: number; date_of_insertion_unix: number; } @@ -220,9 +218,9 @@ export interface Nl { code: NlId; difference: NlDifference; named_difference: NlNamedDifference; - booster_shot_administered: NlBoosterShotAdministered; + booster_shot_administered_archived_20220904: NlBoosterShotAdministeredArchived_20220904; repeating_shot_administered: NlRepeatingShotAdministered; - booster_coverage: NlBoosterCoverage; + booster_coverage_archived_20220904: NlBoosterCoverageArchived_20220904; doctor: NlDoctor; g_number: NlGNumber; infectious_people: NlInfectiousPeople; @@ -343,11 +341,11 @@ export interface NamedDifferenceDecimal { old_date_unix: number; new_date_unix: number; } -export interface NlBoosterShotAdministered { - values: NlBoosterShotAdministeredValue[]; - last_value: NlBoosterShotAdministeredValue; +export interface NlBoosterShotAdministeredArchived_20220904 { + values: NlBoosterShotAdministeredArchived_20220904Value[]; + last_value: NlBoosterShotAdministeredArchived_20220904Value; } -export interface NlBoosterShotAdministeredValue { +export interface NlBoosterShotAdministeredArchived_20220904Value { administered_total: number; ggd_administered_total: number; others_administered_total: number; @@ -363,10 +361,10 @@ export interface NlRepeatingShotAdministeredValue { date_unix: number; date_of_insertion_unix: number; } -export interface NlBoosterCoverage { - values: NlBoosterCoverageValue[]; +export interface NlBoosterCoverageArchived_20220904 { + values: NlBoosterCoverageArchived_20220904Value[]; } -export interface NlBoosterCoverageValue { +export interface NlBoosterCoverageArchived_20220904Value { age_group?: "12+" | "18+"; percentage: number; date_unix: number; @@ -984,10 +982,8 @@ export interface NlVaccineCoveragePerAgeGroupValue { age_group_total: number; autumn_2022_vaccinated: number | null; fully_vaccinated: number; - booster_shot: number | null; autumn_2022_vaccinated_percentage: number | null; fully_vaccinated_percentage: number; - booster_shot_percentage: number | null; date_unix: number; date_of_insertion_unix: number; date_of_report_unix: number; @@ -1352,7 +1348,7 @@ export interface Vr { vaccine_coverage_per_age_group: VrVaccineCoveragePerAgeGroup; vaccine_coverage_per_age_group_archived: VrVaccineCoveragePerAgeGroupArchived; vaccine_coverage_per_age_group_archived_20220908: VrVaccineCoveragePerAgeGroupArchived_20220908; - booster_coverage: VrBoosterCoverage; + booster_coverage_archived_20220904: VrBoosterCoverageArchived_20220904; } export interface VrStaticValues { population_count: number; @@ -1637,11 +1633,11 @@ export interface VrVaccineCoveragePerAgeGroupValue { age_group_range: "12+" | "18+" | "60+"; autumn_2022_vaccinated_percentage: number | null; fully_vaccinated_percentage: number | null; - booster_shot_percentage: number | null; + booster_shot_percentage?: number | null; birthyear_range: string; autumn_2022_vaccinated_percentage_label: string | null; fully_vaccinated_percentage_label: string | null; - booster_shot_percentage_label: string | null; + booster_shot_percentage_label?: string | null; date_unix: number; date_of_insertion_unix: number; } @@ -1673,10 +1669,10 @@ export interface VrVaccineCoveragePerAgeGroupArchived_20220908Value { date_unix: number; date_of_insertion_unix: number; } -export interface VrBoosterCoverage { - values: VrBoosterCoverageValue[]; +export interface VrBoosterCoverageArchived_20220904 { + values: VrBoosterCoverageArchived_20220904Value[]; } -export interface VrBoosterCoverageValue { +export interface VrBoosterCoverageArchived_20220904Value { age_group?: "12+" | "18+"; percentage: number; percentage_label: string | null; @@ -1814,11 +1810,9 @@ export interface VrCollectionVaccineCoveragePerAgeGroup { age_group_range: "12+" | "18+" | "60+"; autumn_2022_vaccinated_percentage: number | null; fully_vaccinated_percentage: number | null; - booster_shot_percentage: number | null; birthyear_range: string; autumn_2022_vaccinated_percentage_label: string | null; fully_vaccinated_percentage_label: string | null; - booster_shot_percentage_label: string | null; date_unix: number; date_of_insertion_unix: number; } From f19a5b241b0230ff367525ce432db115fb2cb71f Mon Sep 17 00:00:00 2001 From: AP <116002914+VWSCoronaDashboard28@users.noreply.github.com> Date: Tue, 22 Nov 2022 16:56:41 +0100 Subject: [PATCH 02/32] Feature/COR-1170-rioolwaterpagina-verbetering-choropletenkaart-nl (#4493) * feat(sewer-choropleth): Implement tooltip notification for outdated data * feat(sewer-choropleth): Implement yellow color on map when data for that area is outdated * feat(sewer-choropleth): Implements new legend item for outdated data, exports font-sizes. * feat(sewer-choropleth): Cleanup and finalize outdated data tooltip addition. * feat(sewer-choropleth): Adjust tooltip to account for different data in VR and GM datapoints. * feat(sewer-choropleth): Adds new outdated data property to schema for GM and VR collections. * feat(sewer-choropleth): New sanity keys and data types. * feat(sewer-choropleth): PR feedback round 1, and a few other fixes/refactoring. * feat(sewer-choropleth): PR feedback round 2 - Add content for assistive technologies (screenreaders). * feat(sewer-choropleth): PR feedback - Change condition for assigning outdated data variables. * feat(sewer-choropleth): Based on new info from backend, adding data_is_outdated property to sewer.json each GM and VR area * feat(sewer-choropleth): generate data types for new properties --- packages/app/schema/gm/sewer.json | 6 +- packages/app/schema/gm_collection/sewer.json | 6 +- packages/app/schema/vr/sewer.json | 5 +- packages/app/schema/vr_collection/sewer.json | 5 +- .../app/src/components/choropleth-legenda.tsx | 54 +- .../app/src/components/choropleth-tile.tsx | 51 +- .../choropleth/logic/use-fill-color.ts | 83 +- .../tooltips/choropleth-tooltip.tsx | 96 +- .../choropleth/tooltips/tooltip-content.tsx | 18 +- .../tooltips/tooltip-notification.tsx | 28 + .../choropleth/tooltips/tooltip-subject.tsx | 21 +- .../choropleth/tooltips/tooltip.tsx | 46 +- packages/app/src/domain/measures/types.ts | 4 +- .../src/pages/gemeente/[code]/vaccinaties.tsx | 8 +- .../app/src/pages/landelijk/rioolwater.tsx | 67 +- .../veiligheidsregio/[code]/vaccinaties.tsx | 7 +- packages/app/src/types/cms.d.ts | 10 +- packages/cms/src/data/data-structure.ts | 988 ++++++++---------- packages/cms/src/lokalize/key-mutations.csv | 7 + packages/cms/src/schemas/measures/measures.ts | 2 +- packages/cms/src/schemas/schema.ts | 4 +- packages/cms/src/schemas/topical/index.ts | 6 +- .../topical/measure-tile-collection.ts | 1 - .../cms/src/schemas/topical/measure-tile.ts | 2 +- .../cms/src/schemas/topical/thermometer.ts | 4 +- .../topical/weekly-summary-collection.ts | 1 - .../schemas/topical/weekly-summary-item.ts | 2 +- packages/cms/src/validation/index.ts | 3 +- packages/common/src/types/data.ts | 572 +++++----- 29 files changed, 936 insertions(+), 1171 deletions(-) create mode 100644 packages/app/src/components/choropleth/tooltips/tooltip-notification.tsx diff --git a/packages/app/schema/gm/sewer.json b/packages/app/schema/gm/sewer.json index 00e925cffe..02c4ae016b 100644 --- a/packages/app/schema/gm/sewer.json +++ b/packages/app/schema/gm/sewer.json @@ -11,7 +11,8 @@ "total_number_of_samples", "sampled_installation_count", "total_installation_count", - "date_of_insertion_unix" + "date_of_insertion_unix", + "data_is_outdated" ], "properties": { "date_start_unix": { @@ -34,6 +35,9 @@ }, "date_of_insertion_unix": { "type": "integer" + }, + "data_is_outdated": { + "type": "boolean" } } } diff --git a/packages/app/schema/gm_collection/sewer.json b/packages/app/schema/gm_collection/sewer.json index 87326bccf0..7cd18a9855 100644 --- a/packages/app/schema/gm_collection/sewer.json +++ b/packages/app/schema/gm_collection/sewer.json @@ -9,7 +9,8 @@ "gmcode", "average", "total_installation_count", - "date_of_insertion_unix" + "date_of_insertion_unix", + "data_is_outdated" ], "properties": { "date_start_unix": { @@ -30,6 +31,9 @@ }, "date_of_insertion_unix": { "type": "integer" + }, + "data_is_outdated": { + "type": "boolean" } } } diff --git a/packages/app/schema/vr/sewer.json b/packages/app/schema/vr/sewer.json index 55764ef52a..2b87d3e818 100644 --- a/packages/app/schema/vr/sewer.json +++ b/packages/app/schema/vr/sewer.json @@ -4,7 +4,7 @@ "title": "vr_sewer_value", "type": "object", "additionalProperties": false, - "required": ["date_unix", "average", "date_of_insertion_unix"], + "required": ["date_unix", "average", "date_of_insertion_unix", "data_is_outdated"], "properties": { "date_unix": { "type": "integer" @@ -14,6 +14,9 @@ }, "date_of_insertion_unix": { "type": "integer" + }, + "data_is_outdated": { + "type": "boolean" } } } diff --git a/packages/app/schema/vr_collection/sewer.json b/packages/app/schema/vr_collection/sewer.json index 7ea55377af..649f779eaf 100644 --- a/packages/app/schema/vr_collection/sewer.json +++ b/packages/app/schema/vr_collection/sewer.json @@ -3,7 +3,7 @@ "title": "vr_collection_sewer", "type": "object", "additionalProperties": false, - "required": ["date_unix", "vrcode", "average", "date_of_insertion_unix"], + "required": ["date_unix", "vrcode", "average", "date_of_insertion_unix", "data_is_outdated"], "properties": { "date_unix": { "type": "integer" @@ -17,6 +17,9 @@ }, "date_of_insertion_unix": { "type": "integer" + }, + "data_is_outdated": { + "type": "boolean" } } } diff --git a/packages/app/src/components/choropleth-legenda.tsx b/packages/app/src/components/choropleth-legenda.tsx index 75efeb0ce8..faeaa0b1c0 100644 --- a/packages/app/src/components/choropleth-legenda.tsx +++ b/packages/app/src/components/choropleth-legenda.tsx @@ -1,28 +1,26 @@ -import { ChoroplethThresholdsValue } from '@corona-dashboard/common'; +import { ChoroplethThresholdsValue, colors } from '@corona-dashboard/common'; import { css, SystemStyleObject } from '@styled-system/css'; import styled from 'styled-components'; import { ValueAnnotation } from '~/components/value-annotation'; import { useIntl } from '~/intl'; +import { space, fontSizes } from '~/style/theme'; import { replaceVariablesInText } from '~/utils'; import { useBreakpoints } from '~/utils/use-breakpoints'; import { useResizeObserver } from '~/utils/use-resize-observer'; import { Box } from './base'; import { Legend, LegendItem } from './legend'; -import { Text } from './typography'; +import { InlineText, Text } from './typography'; interface ChoroplethLegendaProps { title: string; thresholds: ChoroplethThresholdsValue[]; valueAnnotation?: string; type?: 'default' | 'bar'; + pageType?: string; + outdatedDataLabel?: string; } -export function ChoroplethLegenda({ - title, - thresholds, - valueAnnotation, - type = 'bar', -}: ChoroplethLegendaProps) { +export function ChoroplethLegenda({ title, thresholds, valueAnnotation, type = 'bar', pageType, outdatedDataLabel }: ChoroplethLegendaProps) { const [itemRef, itemSize] = useResizeObserver(); const [endLabelRef, endLabelSize] = useResizeObserver(); const { commonTexts, formatNumber } = useIntl(); @@ -44,13 +42,18 @@ export function ChoroplethLegenda({ ); return ( -