From 5e9902c9680f8fd037e8c75d789a82a03f1b5c18 Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard27 <111750729+VWSCoronaDashboard27@users.noreply.github.com> Date: Tue, 18 Jul 2023 09:31:59 +0200 Subject: [PATCH] feat/ COR-1468 archived page and archived metrics (#4816) * feat: archived page and archived metrics * fix: removed Page Information Block and divider * fix: protos metrics validation * fix: removing unnecessary title archived suffix * fix: removed unnecessary title suffix --------- Co-authored-by: VWSCoronaDashboard27 --- .../app/schema/archived_nl/__difference.json | 20 +- packages/app/schema/archived_nl/__index.json | 12 + .../nursing_home.json} | 2 +- .../vulnerable_hospital_admissions.json | 0 .../vulnerable_nursing_home.json | 0 packages/app/schema/nl/__difference.json | 16 +- packages/app/schema/nl/__index.json | 12 - packages/app/src/domain/layout/nl-layout.tsx | 14 +- .../kwetsbare-groepen-70-plussers.tsx | 295 +++++++++--------- packages/cms/src/lokalize/key-mutations.csv | 2 + packages/cms/src/studio/constants.ts | 4 +- .../cms/src/studio/data/data-structure.ts | 20 +- packages/common/src/types/data.ts | 86 ++--- 13 files changed, 249 insertions(+), 234 deletions(-) rename packages/app/schema/{nl/nursing_home_archived_20230126.json => archived_nl/nursing_home.json} (97%) rename packages/app/schema/{nl => archived_nl}/vulnerable_hospital_admissions.json (100%) rename packages/app/schema/{nl => archived_nl}/vulnerable_nursing_home.json (100%) diff --git a/packages/app/schema/archived_nl/__difference.json b/packages/app/schema/archived_nl/__difference.json index 8e8453ba51..185c9bb6b5 100644 --- a/packages/app/schema/archived_nl/__difference.json +++ b/packages/app/schema/archived_nl/__difference.json @@ -3,11 +3,29 @@ "title": "archived_nl_difference", "type": "object", "properties": { + "nursing_home__deceased_daily_archived_20230126": { + "$ref": "#/definitions/diff_integer" + }, + "vulnerable_nursing_home__infected_locations_total_archived_20230711": { + "$ref": "#/definitions/diff_integer" + }, + "nursing_home__newly_infected_people_archived_20230126": { + "$ref": "#/definitions/diff_integer" + }, + "vulnerable_hospital_admissions_archived_20230711": { + "$ref": "#/definitions/diff_integer" + }, "reproduction__index_average_archived_20230711": { "$ref": "#/definitions/diff_decimal" } }, - "required": ["reproduction__index_average_archived_20230711"], + "required": [ + "nursing_home__deceased_daily_archived_20230126", + "vulnerable_nursing_home__infected_locations_total_archived_20230711", + "nursing_home__newly_infected_people_archived_20230126", + "vulnerable_hospital_admissions_archived_20230711", + "reproduction__index_average_archived_20230711" + ], "additionalProperties": false, "definitions": { "diff_integer": { diff --git a/packages/app/schema/archived_nl/__index.json b/packages/app/schema/archived_nl/__index.json index ec47154966..64adc6fd48 100644 --- a/packages/app/schema/archived_nl/__index.json +++ b/packages/app/schema/archived_nl/__index.json @@ -12,7 +12,10 @@ "behavior_annotations_archived_20230412", "behavior_per_age_group_archived_20230411", "doctor_archived_20210903", + "nursing_home_archived_20230126", "sewer_archived_20230623", + "vulnerable_hospital_admissions_archived_20230711", + "vulnerable_nursing_home_archived_20230711", "reproduction_archived_20230711" ], "additionalProperties": false, @@ -44,9 +47,18 @@ "doctor_archived_20210903": { "$ref": "doctor.json" }, + "nursing_home_archived_20230126": { + "$ref": "nursing_home.json" + }, "sewer_archived_20230623": { "$ref": "sewer.json" }, + "vulnerable_nursing_home_archived_20230711": { + "$ref": "vulnerable_nursing_home.json" + }, + "vulnerable_hospital_admissions_archived_20230711": { + "$ref": "vulnerable_hospital_admissions.json" + }, "reproduction_archived_20230711": { "$ref": "reproduction.json" } diff --git a/packages/app/schema/nl/nursing_home_archived_20230126.json b/packages/app/schema/archived_nl/nursing_home.json similarity index 97% rename from packages/app/schema/nl/nursing_home_archived_20230126.json rename to packages/app/schema/archived_nl/nursing_home.json index 30065e51d6..83ff2041cb 100644 --- a/packages/app/schema/nl/nursing_home_archived_20230126.json +++ b/packages/app/schema/archived_nl/nursing_home.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "nl_nursing_home_archived_20230126", + "title": "nl_nursing_home", "type": "object", "properties": { "values": { diff --git a/packages/app/schema/nl/vulnerable_hospital_admissions.json b/packages/app/schema/archived_nl/vulnerable_hospital_admissions.json similarity index 100% rename from packages/app/schema/nl/vulnerable_hospital_admissions.json rename to packages/app/schema/archived_nl/vulnerable_hospital_admissions.json diff --git a/packages/app/schema/nl/vulnerable_nursing_home.json b/packages/app/schema/archived_nl/vulnerable_nursing_home.json similarity index 100% rename from packages/app/schema/nl/vulnerable_nursing_home.json rename to packages/app/schema/archived_nl/vulnerable_nursing_home.json diff --git a/packages/app/schema/nl/__difference.json b/packages/app/schema/nl/__difference.json index 14379afd24..8035f1d789 100644 --- a/packages/app/schema/nl/__difference.json +++ b/packages/app/schema/nl/__difference.json @@ -33,18 +33,12 @@ "sewer__average": { "$ref": "#/definitions/diff_integer" }, - "vulnerable_nursing_home__infected_locations_total": { - "$ref": "#/definitions/diff_integer" - }, - "nursing_home__newly_infected_people_archived_20230126": { - "$ref": "#/definitions/diff_integer" - }, - "nursing_home__deceased_daily_archived_20230126": { - "$ref": "#/definitions/diff_integer" - }, "vulnerable_tested_per_age_group": { "$ref": "#/definitions/diff_integer" }, + "reproduction__index_average": { + "$ref": "#/definitions/diff_decimal" + }, "vulnerable_hospital_admissions": { "$ref": "#/definitions/diff_integer" }, @@ -63,11 +57,7 @@ "intensive_care_nice__admissions_on_date_of_reporting_moving_average", "intensive_care_lcps__beds_occupied_covid", "sewer__average", - "nursing_home__newly_infected_people_archived_20230126", - "nursing_home__deceased_daily_archived_20230126", - "vulnerable_nursing_home__infected_locations_total", "vulnerable_tested_per_age_group", - "vulnerable_hospital_admissions", "deceased_rivm__covid_daily_archived_20221231" ], "additionalProperties": false, diff --git a/packages/app/schema/nl/__index.json b/packages/app/schema/nl/__index.json index 6c5287daf3..4433b65d2a 100644 --- a/packages/app/schema/nl/__index.json +++ b/packages/app/schema/nl/__index.json @@ -26,10 +26,7 @@ "intensive_care_nice_per_age_group", "last_generated", "name", - "vulnerable_nursing_home", - "nursing_home_archived_20230126", "vulnerable_tested_per_age_group", - "vulnerable_hospital_admissions", "proto_name", "self_test_overall", "sewer", @@ -127,18 +124,9 @@ "tested_ggd_archived": { "$ref": "tested_ggd_archived.json" }, - "nursing_home_archived_20230126": { - "$ref": "nursing_home_archived_20230126.json" - }, - "vulnerable_nursing_home": { - "$ref": "vulnerable_nursing_home.json" - }, "vulnerable_tested_per_age_group": { "$ref": "vulnerable_tested_per_age_group.json" }, - "vulnerable_hospital_admissions": { - "$ref": "vulnerable_hospital_admissions.json" - }, "disability_care_archived_20230126": { "$ref": "disability_care_archived_20230126.json" }, diff --git a/packages/app/src/domain/layout/nl-layout.tsx b/packages/app/src/domain/layout/nl-layout.tsx index 5035e0b612..d8ad7522fc 100644 --- a/packages/app/src/domain/layout/nl-layout.tsx +++ b/packages/app/src/domain/layout/nl-layout.tsx @@ -38,11 +38,21 @@ export function NlLayout(props: NlLayoutProps) { layout: 'nl', map: [ ['development_of_the_virus', ['sewage_measurement', 'tests', 'variants', 'mortality']], - ['consequences_for_healthcare', ['hospitals_and_care', 'patients', 'nursing_home_care']], + ['consequences_for_healthcare', ['hospitals_and_care', 'patients']], ['actions_to_take', ['vaccinations']], [ 'archived_metrics', - ['reproduction_number', 'compliance', 'positive_tests', 'disabled_care', 'elderly_at_home', 'coronamelder_app', 'infectious_people', 'general_practitioner_suspicions'], + [ + 'nursing_home_care', + 'reproduction_number', + 'compliance', + 'positive_tests', + 'disabled_care', + 'elderly_at_home', + 'coronamelder_app', + 'infectious_people', + 'general_practitioner_suspicions', + ], ], ], }); diff --git a/packages/app/src/pages/landelijk/kwetsbare-groepen-70-plussers.tsx b/packages/app/src/pages/landelijk/kwetsbare-groepen-70-plussers.tsx index e823cf05a8..ff3c4c58d0 100644 --- a/packages/app/src/pages/landelijk/kwetsbare-groepen-70-plussers.tsx +++ b/packages/app/src/pages/landelijk/kwetsbare-groepen-70-plussers.tsx @@ -27,7 +27,7 @@ import { Languages, SiteText } from '~/locale'; import { ElementsQueryResult, getElementsQuery, getTimelineEvents } from '~/queries/get-elements-query'; import { getArticleParts, getDataExplainedParts, getFaqParts, getPagePartsQuery } from '~/queries/get-page-parts-query'; import { createGetStaticProps, StaticProps } from '~/static-props/create-get-static-props'; -import { createGetChoroplethData, createGetContent, getLastGeneratedDate, getLokalizeTexts, selectNlData } from '~/static-props/get-data'; +import { createGetChoroplethData, createGetContent, getLastGeneratedDate, getLokalizeTexts, selectArchivedNlData } from '~/static-props/get-data'; import { ArticleParts, PagePartQueryResult } from '~/types/cms'; import { useDynamicLokalizeTexts } from '~/utils/cms/use-dynamic-lokalize-texts'; import { getBoundaryDateStartUnix } from '~/utils/get-boundary-date-start-unix'; @@ -36,12 +36,12 @@ import { getPageInformationHeaderContent } from '~/utils/get-page-information-he const pageMetrics = [ 'difference.nursing_home__deceased_daily_archived_20230126', - 'difference.vulnerable_nursing_home__infected_locations_total', + 'difference.vulnerable_nursing_home__infected_locations_total_archived_20230711', 'difference.nursing_home__newly_infected_people_archived_20230126', - 'difference.vulnerable_hospital_admissions', - 'vulnerable_nursing_home', + 'difference.vulnerable_hospital_admissions_archived_20230711', + 'vulnerable_nursing_home_archived_20230711', 'nursing_home_archived_20230126', - 'vulnerable_hospital_admissions', + 'vulnerable_hospital_admissions_archived_20230711', ]; const selectLokalizeTexts = (siteText: SiteText) => ({ @@ -54,14 +54,14 @@ type LokalizeTexts = ReturnType; export const getStaticProps = createGetStaticProps( ({ locale }: { locale: keyof Languages }) => getLokalizeTexts(selectLokalizeTexts, locale), getLastGeneratedDate, - selectNlData( + selectArchivedNlData( 'difference.nursing_home__deceased_daily_archived_20230126', - 'difference.vulnerable_nursing_home__infected_locations_total', + 'difference.vulnerable_nursing_home__infected_locations_total_archived_20230711', 'difference.nursing_home__newly_infected_people_archived_20230126', - 'difference.vulnerable_hospital_admissions', - 'vulnerable_nursing_home', + 'difference.vulnerable_hospital_admissions_archived_20230711', + 'vulnerable_nursing_home_archived_20230711', 'nursing_home_archived_20230126', - 'vulnerable_hospital_admissions' + 'vulnerable_hospital_admissions_archived_20230711' ), createGetChoroplethData({ vr: ({ vulnerable_nursing_home }) => ({ vulnerable_nursing_home }), @@ -90,7 +90,7 @@ export const getStaticProps = createGetStaticProps( ); function VulnerableGroups(props: StaticProps) { - const { pageText, selectedNlData: data, choropleth, lastGenerated, content } = props; + const { pageText, selectedArchivedNlData: data, choropleth, lastGenerated, content } = props; const [nursingHomeConfirmedCasesTimeframe, setNursingHomeConfirmedCasesTimeframe] = useState(TimeframeOption.ALL); @@ -98,18 +98,16 @@ function VulnerableGroups(props: StaticProps) { const [nursingHomeDeceasedTimeframe, setNursingHomeDeceasedTimeframe] = useState(TimeframeOption.ALL); - const [isArchivedContentShown, setIsArchivedContentShown] = useState(false); - const nursinghomeDataLastValue = data.nursing_home_archived_20230126.last_value; - const nusingHomeArchivedUnderReportedDateStart = getBoundaryDateStartUnix(data.nursing_home_archived_20230126.values, 7); + const nursingHomeArchivedUnderReportedDateStart = getBoundaryDateStartUnix(data.nursing_home_archived_20230126.values, 7); const { commonTexts, formatNumber } = useIntl(); const { metadataTexts, textNl } = useDynamicLokalizeTexts(pageText, selectLokalizeTexts); const infectedLocationsText = textNl.verpleeghuis_besmette_locaties; const positiveTestedPeopleText = textNl.verpleeghuis_positief_geteste_personen; - const vulnerableNursingHomeDataLastValue = data.vulnerable_nursing_home.last_value; - const vulnerableHospitalAdmissionsData = data.vulnerable_hospital_admissions; + const vulnerableNursingHomeDataLastValue = data.vulnerable_nursing_home_archived_20230711.last_value; + const vulnerableHospitalAdmissionsData = data.vulnerable_hospital_admissions_archived_20230711; const ElderlyPeopleText = textNl['70_plussers']; @@ -119,7 +117,7 @@ function VulnerableGroups(props: StaticProps) { description: infectedLocationsText.metadata.description, }; - const hasActiveWarningTile = textNl.osiris_archiving_notification; + const hasActiveWarningTile = !!textNl.belangrijk_bericht; const lastInsertionDateOfPage = getLastInsertionDateOfPage(data, pageMetrics); @@ -128,7 +126,7 @@ function VulnerableGroups(props: StaticProps) { diff --git a/packages/cms/src/lokalize/key-mutations.csv b/packages/cms/src/lokalize/key-mutations.csv index 587d8d5510..f2357f2503 100644 --- a/packages/cms/src/lokalize/key-mutations.csv +++ b/packages/cms/src/lokalize/key-mutations.csv @@ -14,4 +14,6 @@ timestamp,action,key,document_id,move_to 2023-06-28T11:28:27.381Z,add,common.article_teaser.read_more,posbL87hXRea8MK3Cj6fYl,__ 2023-06-28T14:26:47.680Z,add,common.article_list.title,OFLiaClUFOlqnxmWMBQD0u,__ 2023-06-28T14:26:49.003Z,add,common.faq.title,OFLiaClUFOlqnxmWMBQDuu,__ +2023-07-10T13:42:50.679Z,add,pages.nursing_home_page.nl.belangrijk_bericht,fMgALacIAkVBeKUDlK02dF,__ +2023-07-10T13:42:50.682Z,delete,pages.nursing_home_page.nl.osiris_archiving_notification,AE5jpq5sZWNgXeEUc3jkhb,__ 2023-07-06T12:30:58.494Z,add,pages.reproduction_page.nl.belangrijk_bericht,EtXaM3Nx0Z98KZ15CIkYiB,__ diff --git a/packages/cms/src/studio/constants.ts b/packages/cms/src/studio/constants.ts index 681c9d029f..4265a6c744 100644 --- a/packages/cms/src/studio/constants.ts +++ b/packages/cms/src/studio/constants.ts @@ -59,8 +59,8 @@ export const titleByMetricName: Partial> = { vaccine_stock: 'Vaccinvoorraad', vaccine_vaccinated_or_support: 'Vaccinatiebereidheid of reeds gevaccineerd', variants: 'Varianten van het virus', - vulnerable_hospital_admissions: 'Kwetsbare groepen - Ziekenhuisopnames', - vulnerable_nursing_home: 'Kwetsbare groepen - Verpleeg- en verzorgingshuizen', + vulnerable_hospital_admissions_archived_20230711: 'Kwetsbare groepen - Ziekenhuisopnames', + vulnerable_nursing_home_archived_20230711: 'Kwetsbare groepen - Verpleeg- en verzorgingshuizen', vulnerable_tested_per_age_group: 'Kwetsbare groepen - Positieve testen (per leeftijd)', }; diff --git a/packages/cms/src/studio/data/data-structure.ts b/packages/cms/src/studio/data/data-structure.ts index ff3e05de76..66c6f728a8 100644 --- a/packages/cms/src/studio/data/data-structure.ts +++ b/packages/cms/src/studio/data/data-structure.ts @@ -67,7 +67,17 @@ export const dataStructure = { ], behavior_annotations_archived_20230412: ['behavior_indicator', 'message_title_nl', 'message_title_en', 'message_desc_nl', 'message_desc_en'], doctor_archived_20210903: ['covid_symptoms_per_100k', 'covid_symptoms'], + nursing_home_archived_20230126: [ + 'newly_infected_people', + 'newly_infected_people_moving_average', + 'deceased_daily', + 'deceased_daily_moving_average', + 'newly_infected_locations', + 'infected_locations_total', + 'infected_locations_percentage', + ], sewer_archived_20230623: ['average'], + vulnerable_nursing_home_archived_20230711: ['newly_infected_locations', 'infected_locations_total', 'infected_locations_percentage'], }, gm: { deceased_rivm_archived_20221231: ['covid_daily', 'covid_daily_moving_average', 'covid_total'], @@ -199,16 +209,6 @@ export const dataStructure = { 'tested_total_moving_average_rounded', ], tested_ggd_archived: ['infected_percentage', 'infected_percentage_moving_average'], - nursing_home_archived_20230126: [ - 'newly_infected_people', - 'newly_infected_people_moving_average', - 'deceased_daily', - 'deceased_daily_moving_average', - 'newly_infected_locations', - 'infected_locations_total', - 'infected_locations_percentage', - ], - vulnerable_nursing_home: ['newly_infected_locations', 'infected_locations_total', 'infected_locations_percentage'], disability_care_archived_20230126: [ 'newly_infected_people', 'newly_infected_people_moving_average', diff --git a/packages/common/src/types/data.ts b/packages/common/src/types/data.ts index d36e254c2e..3b155c26a8 100644 --- a/packages/common/src/types/data.ts +++ b/packages/common/src/types/data.ts @@ -59,12 +59,25 @@ export interface ArchivedNl { behavior_annotations_archived_20230412: NlBehaviorAnnotations; behavior_per_age_group_archived_20230411: NlBehaviorPerAgeGroup; doctor_archived_20210903: NlDoctor; + nursing_home_archived_20230126: NlNursingHome; sewer_archived_20230623: NlSewer; + vulnerable_nursing_home_archived_20230711: NlVulnerableNursingHome; + vulnerable_hospital_admissions_archived_20230711: NlVulnerableHospitalAdmissions; reproduction_archived_20230711: NlReproduction; } export interface ArchivedNlDifference { + nursing_home__deceased_daily_archived_20230126: DifferenceInteger; + vulnerable_nursing_home__infected_locations_total_archived_20230711: DifferenceInteger; + nursing_home__newly_infected_people_archived_20230126: DifferenceInteger; + vulnerable_hospital_admissions_archived_20230711: DifferenceInteger; reproduction__index_average_archived_20230711: DifferenceDecimal; } +export interface DifferenceInteger { + old_value: number; + difference: number; + old_date_unix: number; + new_date_unix: number; +} export interface DifferenceDecimal { old_value: number; difference: number; @@ -201,6 +214,21 @@ export interface NlDoctorValue { covid_symptoms: number; date_of_insertion_unix: number; } +export interface NlNursingHome { + values: NlNursingHomeArchived_20230126Value[]; + last_value: NlNursingHomeArchived_20230126Value; +} +export interface NlNursingHomeArchived_20230126Value { + newly_infected_people: number; + newly_infected_people_moving_average: number | null; + deceased_daily: number; + deceased_daily_moving_average: number | null; + newly_infected_locations: number; + infected_locations_total: number; + infected_locations_percentage: number; + date_unix: number; + date_of_insertion_unix: number; +} export interface NlSewer { values: NlSewerValue[]; last_value: NlSewerValue; @@ -210,6 +238,23 @@ export interface NlSewerValue { date_of_insertion_unix: number; date_unix: number; } +export interface NlVulnerableNursingHome { + values: NlVulnerableNursingHomeValue[]; + last_value: NlVulnerableNursingHomeValue; +} +export interface NlVulnerableNursingHomeValue { + newly_infected_locations: number; + infected_locations_total: number; + infected_locations_percentage: number; + date_unix: number; + date_of_insertion_unix: number; +} +export interface NlVulnerableHospitalAdmissions { + admissions_age_70_plus: number; + date_start_unix: number; + date_end_unix: number; + date_of_insertion_unix: number; +} export interface NlReproduction { values: NlReproductionValue[]; last_value: NlReproductionValue; @@ -466,10 +511,7 @@ export interface Nl { intensive_care_lcps: NlIntensiveCareLcps; tested_ggd: NlTestedGgd; tested_ggd_archived: NlTestedGgdArchived; - nursing_home_archived_20230126: NlNursingHomeArchived_20230126; - vulnerable_nursing_home: NlVulnerableNursingHome; vulnerable_tested_per_age_group: NlVulnerableTestedPerAgeGroup; - vulnerable_hospital_admissions: NlVulnerableHospitalAdmissions; disability_care_archived_20230126: NlDisabilityCareArchived_20230126; deceased_rivm_archived_20221231: NlDeceasedRivmArchived_20221231; deceased_rivm_per_age_group_archived_20221231: NlDeceasedRivmPerAgeGroupArchived_20221231; @@ -513,11 +555,9 @@ export interface NlDifference { intensive_care_nice__admissions_on_date_of_reporting_moving_average: DifferenceDecimal; intensive_care_lcps__beds_occupied_covid: DifferenceInteger; sewer__average: DifferenceInteger; - vulnerable_nursing_home__infected_locations_total: DifferenceInteger; - nursing_home__newly_infected_people_archived_20230126: DifferenceInteger; - nursing_home__deceased_daily_archived_20230126: DifferenceInteger; vulnerable_tested_per_age_group: DifferenceInteger; - vulnerable_hospital_admissions: DifferenceInteger; + reproduction__index_average?: DifferenceDecimal; + vulnerable_hospital_admissions?: DifferenceInteger; deceased_rivm__covid_daily_archived_20221231: DifferenceInteger; } export interface DifferenceDecimal { @@ -742,43 +782,11 @@ export interface NlTestedGgdArchivedValue { date_unix: number; date_of_insertion_unix: number; } -export interface NlNursingHomeArchived_20230126 { - values: NlNursingHomeArchived_20230126Value[]; - last_value: NlNursingHomeArchived_20230126Value; -} -export interface NlNursingHomeArchived_20230126Value { - newly_infected_people: number; - newly_infected_people_moving_average: number | null; - deceased_daily: number; - deceased_daily_moving_average: number | null; - newly_infected_locations: number; - infected_locations_total: number; - infected_locations_percentage: number; - date_unix: number; - date_of_insertion_unix: number; -} -export interface NlVulnerableNursingHome { - values: NlVulnerableNursingHomeValue[]; - last_value: NlVulnerableNursingHomeValue; -} -export interface NlVulnerableNursingHomeValue { - newly_infected_locations: number; - infected_locations_total: number; - infected_locations_percentage: number; - date_unix: number; - date_of_insertion_unix: number; -} export interface NlVulnerableTestedPerAgeGroup { infected_age_70_plus: number; date_unix: number; date_of_insertion_unix: number; } -export interface NlVulnerableHospitalAdmissions { - admissions_age_70_plus: number; - date_start_unix: number; - date_end_unix: number; - date_of_insertion_unix: number; -} export interface NlDisabilityCareArchived_20230126 { values: NlDisabilityCareArchived_20230126Value[]; last_value: NlDisabilityCareArchived_20230126Value;