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

Task/add archive vr collection #4831

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
33 changes: 32 additions & 1 deletion packages/app/schema/archived_nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@
"behavior_archived_20230411",
"behavior_annotations_archived_20230412",
"behavior_per_age_group_archived_20230411",
"repeating_shot_administered_20220713",
"corona_melder_app_warning_archived_20220421",
"corona_melder_app_download_archived_20220421",
"doctor_archived_20210903",
"nursing_home_archived_20230126",
"infectious_people_archived_20210709",
"sewer_archived_20230623",
"vulnerable_hospital_admissions_archived_20230711",
"vulnerable_nursing_home_archived_20230711",
"reproduction_archived_20230711"
"reproduction_archived_20230711",
"vaccine_delivery_per_supplier_archived_20211101",
"vaccine_stock_archived_20211024",
"vaccine_vaccinated_or_support_archived_20230411"
],
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -44,12 +51,24 @@
"behavior_per_age_group_archived_20230411": {
"$ref": "behavior/behavior_per_age_group.json"
},
"repeating_shot_administered_20220713": {
"$ref": "repeating_shot_administered.json"
},
"corona_melder_app_warning_archived_20220421": {
"$ref": "corona_melder_app_warning.json"
},
"corona_melder_app_download_archived_20220421": {
"$ref": "corona_melder_app_download.json"
},
"doctor_archived_20210903": {
"$ref": "doctor.json"
},
"nursing_home_archived_20230126": {
"$ref": "nursing_home.json"
},
"infectious_people_archived_20210709": {
"$ref": "infectious_people.json"
},
"sewer_archived_20230623": {
"$ref": "sewer.json"
},
Expand All @@ -61,6 +80,18 @@
},
"reproduction_archived_20230711": {
"$ref": "reproduction.json"
},
"vaccine_coverage_archived_20220518": {
"$ref": "vaccine_coverage.json"
},
"vaccine_delivery_per_supplier_archived_20211101": {
"$ref": "vaccine_delivery_per_supplier.json"
},
"vaccine_stock_archived_20211024": {
"$ref": "vaccine_stock.json"
},
"vaccine_vaccinated_or_support_archived_20230411": {
"$ref": "vaccine_vaccinated_or_support.json"
}
},
"$defs": {
Expand Down
37 changes: 37 additions & 0 deletions packages/app/schema/archived_vr_collection/__index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "archived_vr_collection",
"additionalProperties": false,
"required": [
"vulnerable_nursing_home_archived_20230711"
],
"properties": {
"last_generated": {
"type": "string"
},
"proto_name": {
"$ref": "#/$defs/archived_vr_collection_id"
},
"name": {
"$ref": "#/$defs/archived_vr_collection_id"
},
"code": {
"$ref": "#/$defs/archived_vr_collection_id"
},
"vulnerable_nursing_home_archived_20230711": {
"type": "array",
"minItems": 25,
"maxItems": 25,
"items": {
"$ref": "vulnerable_nursing_home.json"
}
}
},
"$defs": {
"archived_vr_collection_id": {
"type": "string",
"enum": ["ARCHIVED_VR_COLLECTION"]
}
}
}
12 changes: 2 additions & 10 deletions packages/app/schema/gm_collection/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "object",
"title": "gm_collection",
"additionalProperties": false,
"required": ["last_generated", "proto_name", "name", "code", "hospital_nice", "hospital_nice_choropleth", "tested_overall", "sewer", "vaccine_coverage_per_age_group"],
"required": ["last_generated", "proto_name", "name", "code", "hospital_nice_choropleth", "tested_overall", "sewer", "vaccine_coverage_per_age_group"],
"properties": {
"last_generated": {
"type": "string"
Expand All @@ -17,20 +17,12 @@
"code": {
"$ref": "#/$defs/gm_collection_id"
},
"hospital_nice": {
"type": "array",
"minItems": 342,
"maxItems": 342,
"items": {
"$ref": "hospital_nice.json"
}
},
"hospital_nice_choropleth": {
"type": "array",
"minItems": 342,
"maxItems": 342,
"items": {
"$ref": "hospital_nice.json"
"$ref": "hospital_nice_choropleth.json"
}
},
"tested_overall": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "gm_collection_hospital_nice",
"title": "gm_collection_hospital_nice_choropleth",
"additionalProperties": false,
"required": [
"date_unix",
Expand Down
31 changes: 0 additions & 31 deletions packages/app/schema/nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
"title": "nl",
"required": [
"booster_shot_administered_archived_20220904",
"repeating_shot_administered",
"booster_coverage_archived_20220904",
"code",
"corona_melder_app_download",
"corona_melder_app_warning",
"deceased_cbs",
"deceased_rivm_archived_20221231",
"deceased_rivm_per_age_group_archived_20221231",
Expand All @@ -20,7 +17,6 @@
"hospital_lcps",
"hospital_nice",
"hospital_nice_per_age_group",
"infectious_people",
"intensive_care_lcps",
"intensive_care_nice",
"intensive_care_nice_per_age_group",
Expand All @@ -35,7 +31,6 @@
"vaccine_campaigns",
"vaccine_campaigns_archived_20220908",
"vaccine_planned_archived_20220908",
"vaccine_vaccinated_or_support",
"vaccine_administered",
"vaccine_administered_doctors",
"vaccine_administered_ggd_ghor",
Expand All @@ -44,8 +39,6 @@
"vaccine_administered_total",
"vaccine_administered_planned",
"vaccine_administered_last_timeframe",
"vaccine_stock",
"vaccine_delivery_per_supplier",
"vaccine_coverage_per_age_group",
"vaccine_coverage_per_age_group_archived",
"vaccine_coverage_per_age_group_archived_20220908",
Expand Down Expand Up @@ -76,18 +69,12 @@
"booster_shot_administered_archived_20220904": {
"$ref": "booster_shot_administered_archived_20220904.json"
},
"repeating_shot_administered": {
"$ref": "repeating_shot_administered.json"
},
"booster_coverage_archived_20220904": {
"$ref": "booster_coverage_archived_20220904.json"
},
"g_number": {
"$ref": "g_number.json"
},
"infectious_people": {
"$ref": "infectious_people.json"
},
"intensive_care_nice": {
"$ref": "intensive_care_nice.json"
},
Expand Down Expand Up @@ -133,21 +120,6 @@
"elderly_at_home_archived_20230126": {
"$ref": "elderly_at_home_archived_20230126.json"
},
"vaccine_vaccinated_or_support": {
"$ref": "vaccine_vaccinated_or_support.json"
},
"corona_melder_app_download": {
"$ref": "corona_melder_app_download.json"
},
"corona_melder_app_warning": {
"$ref": "corona_melder_app_warning.json"
},
"vaccine_coverage": {
"$ref": "vaccine_coverage.json"
},
"vaccine_delivery_per_supplier": {
"$ref": "vaccine_delivery_per_supplier.json"
},
"vaccine_administered": {
"$ref": "vaccine_administered.json"
},
Expand Down Expand Up @@ -199,9 +171,6 @@
"vaccine_coverage_per_age_group_estimated_archived_20220908": {
"$ref": "vaccine_coverage_per_age_group_estimated_archived_20220908.json"
},
"vaccine_stock": {
"$ref": "vaccine_stock.json"
},
"variants": {
"$ref": "variants.json"
},
Expand Down
10 changes: 1 addition & 9 deletions packages/app/schema/vr_collection/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "object",
"title": "vr_collection",
"additionalProperties": false,
"required": ["last_generated", "proto_name", "name", "code", "disability_care_archived_20230126", "elderly_at_home_archived_20230126", "vulnerable_nursing_home"],
"required": ["last_generated", "proto_name", "name", "code", "disability_care_archived_20230126", "elderly_at_home_archived_20230126"],
"properties": {
"last_generated": {
"type": "string"
Expand Down Expand Up @@ -32,14 +32,6 @@
"items": {
"$ref": "elderly_at_home_archived_20230126.json"
}
},
"vulnerable_nursing_home": {
"type": "array",
"minItems": 25,
"maxItems": 25,
"items": {
"$ref": "vulnerable_nursing_home.json"
}
}
},
"$defs": {
Expand Down
24 changes: 17 additions & 7 deletions packages/app/src/components/choropleth/logic/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type {
GmCollection,
GmCollectionHospitalNice,
GmCollectionHospitalNiceChoropleth,
GmCollectionSewer,
GmCollectionTestedOverall,
GmCollectionVaccineCoveragePerAgeGroup,
VrCollection,
ArchivedVrCollection,
VrCollectionDisabilityCareArchived_20230126,
VrCollectionElderlyAtHomeArchived_20230126,
VrCollectionVulnerableNursingHome,
Expand Down Expand Up @@ -43,18 +44,27 @@ export const mapToCodeType: Record<MapType, CodeProp> = {
vr: 'vrcode',
};

export type ChoroplethCollection = GmCollection | VrCollection;
export type ChoroplethCollection = GmCollection | VrCollection | ArchivedVrCollection;

export type InferedMapType<T extends ChoroplethDataItem> = T extends GmDataItem ? 'gm' : T extends VrDataItem ? 'vr' : never;
export type InferedMapType<T extends ChoroplethDataItem> = T extends GmDataItem ? 'gm' : T extends VrDataItem | ArchivedVrDataItem ? 'vr' : never;

export type InferedDataCollection<T extends ChoroplethDataItem> = T extends GmDataItem ? GmCollection : T extends VrDataItem ? VrCollection : never;
export type InferedDataCollection<T extends ChoroplethDataItem> = T extends GmDataItem
? GmCollection
: T extends VrDataItem
? VrCollection
: T extends ArchivedVrDataItem
? ArchivedVrCollection
: never;

export type VrDataCollection = VrCollectionDisabilityCareArchived_20230126[] | VrCollectionElderlyAtHomeArchived_20230126[] | VrCollectionVulnerableNursingHome[];
export type VrDataCollection = VrCollectionDisabilityCareArchived_20230126[] | VrCollectionElderlyAtHomeArchived_20230126[];
export type VrDataItem = VrDataCollection[number];

export type GmDataCollection = GmCollectionHospitalNice[] | GmCollectionTestedOverall[] | GmCollectionSewer[] | GmCollectionVaccineCoveragePerAgeGroup[];
export type GmDataCollection = GmCollectionHospitalNiceChoropleth[] | GmCollectionTestedOverall[] | GmCollectionSewer[] | GmCollectionVaccineCoveragePerAgeGroup[];
export type GmDataItem = GmDataCollection[number];

export type ArchivedVrDataCollection = VrCollectionVulnerableNursingHome[];
export type ArchivedVrDataItem = ArchivedVrDataCollection[number];

/**
* Here we map a MapType to a corresponding DataCollection type
*/
Expand All @@ -65,7 +75,7 @@ export type MappedDataCollection<T extends MapType> = T extends 'gm' ? GmCollect
*/
export type MappedDataItem<T extends MapType> = T extends 'gm' ? GmDataItem : T extends 'vr' ? VrDataItem : never;

export type ChoroplethDataItem = GmDataItem | VrDataItem;
export type ChoroplethDataItem = GmDataItem | VrDataItem | ArchivedVrDataItem;

export type CodedGeoProperties = {
code: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/pages/gemeente/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { colors, GmCollectionHospitalNice, gmData } from '@corona-dashboard/common';
import { colors, GmCollectionHospitalNiceChoropleth, gmData } from '@corona-dashboard/common';
import { useRouter } from 'next/router';
import { useMemo } from 'react';
import { Box } from '~/components/base';
Expand Down Expand Up @@ -33,12 +33,12 @@ const Municipality = (props: StaticProps<typeof getStaticProps>) => {
};

const data = useMemo(() => {
return gmData.map<GmCollectionHospitalNice>(
return gmData.map<GmCollectionHospitalNiceChoropleth>(
(x) =>
({
gmcode: x.gemcode,
admissions_on_date_of_reporting: null,
} as unknown as GmCollectionHospitalNice)
} as unknown as GmCollectionHospitalNiceChoropleth)
);
}, []);

Expand Down
10 changes: 5 additions & 5 deletions packages/app/src/pages/landelijk/besmettelijke-mensen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useIntl } from '~/intl';
import { Languages, SiteText } from '~/locale';
import { getArticleParts, getDataExplainedParts, getFaqParts, getPagePartsQuery } from '~/queries/get-page-parts-query';
import { createGetStaticProps, StaticProps } 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 { getPageInformationHeaderContent } from '~/utils/get-page-information-header-content';
Expand All @@ -30,7 +30,7 @@ type LokalizeTexts = ReturnType<typeof selectLokalizeTexts>;
export const getStaticProps = createGetStaticProps(
({ locale }: { locale: keyof Languages }) => getLokalizeTexts(selectLokalizeTexts, locale),
getLastGeneratedDate,
selectNlData('infectious_people'),
selectArchivedNlData('infectious_people_archived_20210709'),
async (context: GetStaticPropsContext) => {
const { content } = await createGetContent<PagePartQueryResult<ArticleParts>>(() => getPagePartsQuery('infectious_people_page'))(context);

Expand All @@ -45,11 +45,11 @@ export const getStaticProps = createGetStaticProps(
);

const InfectiousPeople = (props: StaticProps<typeof getStaticProps>) => {
const { pageText, selectedNlData: data, lastGenerated, content } = props;
const { pageText, selectedArchivedNlData: data, lastGenerated, content } = props;
const { commonTexts } = useIntl();
const { metadataTexts, textNl } = useDynamicLokalizeTexts<LokalizeTexts>(pageText, selectLokalizeTexts);

const lastFullValue = getLastFilledValue(data.infectious_people);
const lastFullValue = getLastFilledValue(data.infectious_people_archived_20210709);

const metadata = {
...metadataTexts,
Expand Down Expand Up @@ -89,7 +89,7 @@ const InfectiousPeople = (props: StaticProps<typeof getStaticProps>) => {
key: 'infectious_people_over_time_chart',
}}
tooltipTitle={textNl.linechart_titel}
values={data.infectious_people.values}
values={data.infectious_people_archived_20210709.values}
seriesConfig={[
{
type: 'line',
Expand Down
Loading
Loading