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

feature/COR-1684-archive-reproduction-number #4809

Merged
merged 5 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions packages/app/schema/archived_nl/__difference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "archived_nl_difference",
"type": "object",
"properties": {
"reproduction__index_average_archived_20230711": {
"$ref": "#/definitions/diff_decimal"
}
},
"required": ["reproduction__index_average_archived_20230711"],
"additionalProperties": false,
"definitions": {
"diff_integer": {
"title": "difference_integer",
"type": "object",
"properties": {
"old_value": {
"type": "integer"
},
"difference": {
"type": "integer"
},
"old_date_unix": {
"type": "integer"
},
"new_date_unix": {
"type": "integer"
}
},
"required": ["old_value", "difference", "old_date_unix", "new_date_unix"],
"additionalProperties": false
},
"diff_decimal": {
"title": "difference_decimal",
"type": "object",
"properties": {
"old_value": {
"type": "number"
},
"difference": {
"type": "number"
},
"old_date_unix": {
"type": "integer"
},
"new_date_unix": {
"type": "integer"
}
},
"required": ["old_value", "difference", "old_date_unix", "new_date_unix"],
"additionalProperties": false
}
}
}
10 changes: 9 additions & 1 deletion packages/app/schema/archived_nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
"proto_name",
"name",
"code",
"difference",
"behavior_archived_20230411",
"behavior_annotations_archived_20230412",
"behavior_per_age_group_archived_20230411",
"doctor_archived_20210903",
"sewer_archived_20230623"
"sewer_archived_20230623",
"reproduction_archived_20230711"
],
"additionalProperties": false,
"properties": {
Expand All @@ -27,6 +29,9 @@
"code": {
"$ref": "#/$defs/archived_nl_id"
},
"difference": {
"$ref": "__difference.json"
},
"behavior_archived_20230411": {
"$ref": "behavior/behavior.json"
},
Expand All @@ -41,6 +46,9 @@
},
"sewer_archived_20230623": {
"$ref": "sewer.json"
},
"reproduction_archived_20230711": {
"$ref": "reproduction.json"
}
},
"$defs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
"title": "nl_reproduction_value",
"type": "object",
"additionalProperties": false,
"required": [
"index_low",
"index_average",
"index_high",
"date_unix",
"date_of_insertion_unix"
],
"required": ["index_low", "index_average", "index_high", "date_unix", "date_of_insertion_unix"],
"properties": {
"index_low": {
"type": ["number", "null"],
Expand Down
4 changes: 0 additions & 4 deletions packages/app/schema/nl/__difference.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
"vulnerable_hospital_admissions": {
"$ref": "#/definitions/diff_integer"
},
"reproduction__index_average": {
"$ref": "#/definitions/diff_decimal"
},
"deceased_rivm__covid_daily_archived_20221231": {
"$ref": "#/definitions/diff_integer"
}
Expand All @@ -62,7 +59,6 @@
"hospital_lcps__beds_occupied_covid",
"tested_ggd__tested_total_moving_average",
"tested_ggd__infected_percentage_moving_average",
"reproduction__index_average",
"infectious_people__estimate",
"intensive_care_nice__admissions_on_date_of_reporting_moving_average",
"intensive_care_lcps__beds_occupied_covid",
Expand Down
4 changes: 0 additions & 4 deletions packages/app/schema/nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"vulnerable_tested_per_age_group",
"vulnerable_hospital_admissions",
"proto_name",
"reproduction",
"self_test_overall",
"sewer",
"tested_ggd",
Expand Down Expand Up @@ -107,9 +106,6 @@
"tested_per_age_group": {
"$ref": "tested_per_age_group.json"
},
"reproduction": {
"$ref": "reproduction.json"
},
"sewer": {
"$ref": "sewer.json"
},
Expand Down
7 changes: 5 additions & 2 deletions packages/app/src/domain/layout/nl-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ export function NlLayout(props: NlLayoutProps) {
const items = useSidebar({
layout: 'nl',
map: [
['development_of_the_virus', ['sewage_measurement', 'tests', 'reproduction_number', 'variants', 'mortality']],
['development_of_the_virus', ['sewage_measurement', 'tests', 'variants', 'mortality']],
['consequences_for_healthcare', ['hospitals_and_care', 'patients', 'nursing_home_care']],
['actions_to_take', ['vaccinations']],
['archived_metrics', ['compliance', 'positive_tests', 'disabled_care', 'elderly_at_home', 'coronamelder_app', 'infectious_people', 'general_practitioner_suspicions']],
[
'archived_metrics',
['reproduction_number', 'compliance', 'positive_tests', 'disabled_care', 'elderly_at_home', 'coronamelder_app', 'infectious_people', 'general_practitioner_suspicions'],
],
],
});

Expand Down
32 changes: 19 additions & 13 deletions packages/app/src/pages/landelijk/reproductiegetal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { PageInformationBlock } from '~/components/page-information-block';
import { PageKpi } from '~/components/page-kpi';
import { TileList } from '~/components/tile-list';
import { TwoKpiSection } from '~/components/two-kpi-section';
import { WarningTile } from '~/components/warning-tile';
import { Layout } from '~/domain/layout/layout';
import { NlLayout } from '~/domain/layout/nl-layout';
import { ReproductionChartTile } from '~/domain/tested/reproduction-chart-tile';
Expand All @@ -18,13 +19,13 @@ 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 { StaticProps, createGetStaticProps } from '~/static-props/create-get-static-props';
import { createGetContent, getLastGeneratedDate, getLokalizeTexts, selectNlData } from '~/static-props/get-data';
import { 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 { getLastInsertionDateOfPage } from '~/utils/get-last-insertion-date-of-page';
import { getPageInformationHeaderContent } from '~/utils/get-page-information-header-content';

const pageMetrics = ['reproduction'];
const pageMetrics = ['reproduction_archived_20230711'];

const selectLokalizeTexts = (siteText: SiteText) => ({
metadataTexts: siteText.pages.topical_page.nl.nationaal_metadata,
Expand All @@ -36,7 +37,7 @@ type LokalizeTexts = ReturnType<typeof selectLokalizeTexts>;
export const getStaticProps = createGetStaticProps(
({ locale }: { locale: keyof Languages }) => getLokalizeTexts(selectLokalizeTexts, locale),
getLastGeneratedDate,
selectNlData('reproduction', 'difference.reproduction__index_average'),
selectArchivedNlData('reproduction_archived_20230711', 'difference.reproduction__index_average_archived_20230711'),
async (context: GetStaticPropsContext) => {
const { content } = await createGetContent<{
parts: PagePartQueryResult<ArticleParts>;
Expand All @@ -45,7 +46,7 @@ export const getStaticProps = createGetStaticProps(
const { locale } = context;
return `{
"parts": ${getPagePartsQuery('reproduction_page')},
"elements": ${getElementsQuery('nl', ['reproduction'], locale)}
"elements": ${getElementsQuery('nl', ['reproduction_archived_20230711'], locale)}
}`;
})(context);

Expand All @@ -61,9 +62,10 @@ export const getStaticProps = createGetStaticProps(
);

const ReproductionIndex = (props: StaticProps<typeof getStaticProps>) => {
const { pageText, selectedNlData: data, content, lastGenerated } = props;
const { pageText, selectedArchivedNlData: data, content, lastGenerated } = props;

const lastFilledValue = getLastFilledValue(data.reproduction);
const reproductionLastValue = getLastFilledValue(data.reproduction_archived_20230711);
const reproductionValues = data.reproduction_archived_20230711;

const { commonTexts } = useIntl();
const { metadataTexts, textNl } = useDynamicLokalizeTexts<LokalizeTexts>(pageText, selectLokalizeTexts);
Expand All @@ -76,19 +78,21 @@ const ReproductionIndex = (props: StaticProps<typeof getStaticProps>) => {

const lastInsertionDateOfPage = getLastInsertionDateOfPage(data, pageMetrics);

const hasActiveWarningTile = !!textNl.belangrijk_bericht;

return (
<Layout {...metadata} lastGenerated={lastGenerated}>
<NlLayout>
<TileList>
<PageInformationBlock
category={commonTexts.sidebar.categories.development_of_the_virus.title}
category={commonTexts.sidebar.categories.archived_metrics.title}
screenReaderCategory={commonTexts.sidebar.metrics.reproduction_number.title}
title={textNl.titel}
icon={<Reproductiegetal aria-hidden="true" />}
description={textNl.pagina_toelichting}
metadata={{
datumsText: textNl.datums,
dateOrRange: lastFilledValue.date_unix,
dateOrRange: reproductionLastValue.date_unix,
dateOfInsertionUnix: lastInsertionDateOfPage,
dataSources: [textNl.bronnen.rivm],
}}
Expand All @@ -98,13 +102,15 @@ const ReproductionIndex = (props: StaticProps<typeof getStaticProps>) => {
})}
/>

{hasActiveWarningTile && <WarningTile isFullWidth message={textNl.belangrijk_bericht} variant="informational" />}

<TwoKpiSection>
<KpiWithIllustrationTile
title={textNl.barscale_titel}
metadata={{
date: lastFilledValue.date_unix,
date: reproductionLastValue.date_unix,
source: textNl.bronnen.rivm,
obtainedAt: lastFilledValue.date_of_insertion_unix,
obtainedAt: reproductionLastValue.date_of_insertion_unix,
}}
illustration={{
image: '/images/reproductie-explainer.svg',
Expand All @@ -114,9 +120,9 @@ const ReproductionIndex = (props: StaticProps<typeof getStaticProps>) => {
>
<PageKpi
data={data}
metricName="reproduction"
metricName="reproduction_archived_20230711"
metricProperty="index_average"
differenceKey="reproduction__index_average"
differenceKey="reproduction__index_average_archived_20230711"
differenceFractionDigits={2}
showOldDateUnix
isAmount={false}
Expand All @@ -125,7 +131,7 @@ const ReproductionIndex = (props: StaticProps<typeof getStaticProps>) => {
</KpiWithIllustrationTile>
</TwoKpiSection>

<ReproductionChartTile data={data.reproduction} timelineEvents={getTimelineEvents(content.elements.timeSeries, 'reproduction')} text={textNl} />
<ReproductionChartTile data={reproductionValues} timelineEvents={getTimelineEvents(content.elements.timeSeries, 'reproduction_archived_20230711')} text={textNl} />
APW26 marked this conversation as resolved.
Show resolved Hide resolved

{content.faqs && content.faqs.questions?.length > 0 && <PageFaqTile questions={content.faqs.questions} title={content.faqs.sectionTitle} />}

Expand Down
2 changes: 1 addition & 1 deletion packages/cms-v2/src/elements/schemas/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const titleByMetricName: Partial<Record<MetricName, string>> = {
sewer: 'Rioolwater metingen',
hospital_nice: 'Ziekenhuisopnames',
intensive_care_nice: 'IC-opnames',
reproduction: 'Reproduciegetal',
reproduction_archived_20230711: 'Reproductiegetal',
vaccine_coverage_per_age_group: 'Vaccinatiegraad (per leeftijd)',
vaccine_administered: 'Gezette prikken',
vaccine_coverage: 'Vaccinatiegraad',
Expand Down
1 change: 1 addition & 0 deletions packages/cms/src/lokalize/key-mutations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ 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-06T12:30:58.494Z,add,pages.reproduction_page.nl.belangrijk_bericht,EtXaM3Nx0Z98KZ15CIkYiB,__
2 changes: 1 addition & 1 deletion packages/cms/src/studio/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const titleByMetricName: Partial<Record<MetricName, string>> = {
named_difference: 'Verschil',
nursing_home_archived_20230126: 'Verpleeghuizen',
repeating_shot_administered: 'Gezette herhaalprikken',
reproduction: 'Reproduciegetal',
reproduction_archived_20230711: 'Reproductiegetal',
self_test_overall: 'Zelfgerapporteerde positieve coronatestuitslagen',
sewer_per_installation: 'Virusdeeltjes in rioolwater',
sewer: 'Rioolwater metingen',
Expand Down
35 changes: 22 additions & 13 deletions packages/common/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,22 @@ export interface ArchivedNl {
proto_name: ArchivedNlId;
name: ArchivedNlId;
code: ArchivedNlId;
difference: ArchivedNlDifference;
behavior_archived_20230411: NlBehavior;
behavior_annotations_archived_20230412: NlBehaviorAnnotations;
behavior_per_age_group_archived_20230411: NlBehaviorPerAgeGroup;
doctor_archived_20210903: NlDoctor;
sewer_archived_20230623: NlSewer;
reproduction_archived_20230711: NlReproduction;
}
export interface ArchivedNlDifference {
reproduction__index_average_archived_20230711: DifferenceDecimal;
}
export interface DifferenceDecimal {
old_value: number;
difference: number;
old_date_unix: number;
new_date_unix: number;
}
export interface NlBehavior {
values: NlBehaviorValue[];
Expand Down Expand Up @@ -199,6 +210,17 @@ export interface NlSewerValue {
date_of_insertion_unix: number;
date_unix: number;
}
export interface NlReproduction {
values: NlReproductionValue[];
last_value: NlReproductionValue;
}
export interface NlReproductionValue {
index_low: number | null;
index_average: number | null;
index_high: number | null;
date_unix: number;
date_of_insertion_unix: number;
}

export type GmCode = string;

Expand Down Expand Up @@ -437,7 +459,6 @@ export interface Nl {
intensive_care_nice_per_age_group: NlIntensiveCareNicePerAgeGroup;
tested_overall: NlTestedOverall;
tested_per_age_group: NlTestedPerAgeGroup;
reproduction: NlReproduction;
sewer: NlSewer;
hospital_nice: NlHospitalNice;
hospital_nice_per_age_group: NlHospitalNicePerAgeGroup;
Expand Down Expand Up @@ -497,7 +518,6 @@ export interface NlDifference {
nursing_home__deceased_daily_archived_20230126: DifferenceInteger;
vulnerable_tested_per_age_group: DifferenceInteger;
vulnerable_hospital_admissions: DifferenceInteger;
reproduction__index_average: DifferenceDecimal;
deceased_rivm__covid_daily_archived_20221231: DifferenceInteger;
}
export interface DifferenceDecimal {
Expand Down Expand Up @@ -634,17 +654,6 @@ export interface NlTestedPerAgeGroupValue {
date_unix: number;
date_of_insertion_unix: number;
}
export interface NlReproduction {
values: NlReproductionValue[];
last_value: NlReproductionValue;
}
export interface NlReproductionValue {
index_low: number | null;
index_average: number | null;
index_high: number | null;
date_unix: number;
date_of_insertion_unix: number;
}
export interface NlSewer {
values: NlSewerValue[];
last_value: NlSewerValue;
Expand Down