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

Commit

Permalink
COR-1895: archive vaccine keys (#4970)
Browse files Browse the repository at this point in the history
* move over vaccine_administered_last_timeframe and vaccine_campaigns to vaccine_administered_last_timeframe_archived_20241701 and vaccine_campaigns_archived_20241701

* change cms constant

* feature(COR-1895): PR comment resolution

* feature (COR_1895): remove selectNlData
  • Loading branch information
yorickdevries authored Jan 19, 2024
1 parent 608e7f0 commit afd3bee
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 62 deletions.
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 @@ -51,7 +51,9 @@
"repeating_shot_administered_20220713",
"corona_melder_app_warning_archived_20220421",
"corona_melder_app_download_archived_20220421",
"infectious_people_archived_20210709"
"infectious_people_archived_20210709",
"vaccine_campaigns_archived_20240117",
"vaccine_administered_last_timeframe_archived_20240117"
],
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -201,6 +203,12 @@
},
"infectious_people_archived_20210709": {
"$ref": "infectious_people.json"
},
"vaccine_administered_last_timeframe_archived_20240117": {
"$ref": "vaccine_administered_last_timeframe.json"
},
"vaccine_campaigns_archived_20240117": {
"$ref": "vaccine_campaigns.json"
}
},
"$defs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
},
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "nl_vaccine_administered_last_timeframe",
"title": "archived_nl_vaccine_administered_last_timeframe",
"type": "object",
"required": ["vaccine_types", "date_unix", "date_start_unix", "date_end_unix", "date_of_insertion_unix"],
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"definitions": {
"vaccine_campaign": {
"title": "nl_vaccine_campaigns",
"title": "archived_nl_vaccine_campaigns",
"type": "object",
"required": ["vaccine_campaign_order", "vaccine_campaign_name_nl", "vaccine_campaign_name_en", "vaccine_administered_total", "vaccine_administered_last_timeframe"],
"additionalProperties": false,
Expand All @@ -25,7 +25,7 @@
}
},
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "nl_vaccine_campaign",
"title": "archived_nl_vaccine_campaign",
"type": "object",
"required": ["vaccine_campaigns", "date_unix", "date_start_unix", "date_end_unix", "date_of_insertion_unix"],
"additionalProperties": false,
Expand Down
8 changes: 0 additions & 8 deletions packages/app/schema/nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"self_test_overall",
"infectionradar_symptoms_trend_per_age_group_weekly",
"sewer",
"vaccine_campaigns",
"vaccine_administered_last_timeframe",
"variants"
],
"additionalProperties": false,
Expand Down Expand Up @@ -67,12 +65,6 @@
"deceased_cbs": {
"$ref": "deceased_cbs.json"
},
"vaccine_administered_last_timeframe": {
"$ref": "vaccine_administered_last_timeframe.json"
},
"vaccine_campaigns": {
"$ref": "vaccine_campaigns.json"
},
"variants": {
"$ref": "variants.json"
},
Expand Down
40 changes: 18 additions & 22 deletions packages/app/src/pages/landelijk/de-coronaprik.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,7 @@ import { Languages, SiteText } from '~/locale';
import { ElementsQueryResult, getElementsQuery, getTimelineEvents } from '~/queries/get-elements-query';
import { getArticleParts, getDataExplainedParts, getFaqParts, getLinkParts, getPagePartsQuery, getRichTextParts } from '~/queries/get-page-parts-query';
import { StaticProps, createGetStaticProps } from '~/static-props/create-get-static-props';
import {
createGetArchivedChoroplethData,
createGetContent,
getArchivedNlData,
getLastGeneratedDate,
getLokalizeTexts,
selectArchivedNlData,
selectNlData,
} from '~/static-props/get-data';
import { createGetArchivedChoroplethData, createGetContent, getArchivedNlData, getLastGeneratedDate, getLokalizeTexts, selectArchivedNlData } from '~/static-props/get-data';
import { ArticleParts, LinkParts, PagePartQueryResult, RichTextParts } from '~/types/cms';
import { replaceVariablesInText, useFormatLokalizePercentage } from '~/utils';
import { useDynamicLokalizeTexts } from '~/utils/cms/use-dynamic-lokalize-texts';
Expand All @@ -57,25 +49,24 @@ const pageMetrics = [
'vaccine_administered_hospitals_and_care_institutions',
'vaccine_administered_planned_archived_20231004',
'vaccine_administered_total_archived_20220324',
'vaccine_administered_last_timeframe',
'vaccine_coverage_per_age_group',
'vaccine_coverage_archived_20220518',
'vaccine_delivery_per_supplier_archived_20211101',
'vaccine_stock_archived_20211024',
'vaccine_vaccinated_or_support_archived_20230411',
'vaccine_coverage_per_age_group_estimated_fully_vaccinated',
'vaccine_coverage_per_age_group_estimated_autumn_2022',
'vaccine_campaigns',
'vaccine_planned_archived_20220908',
'booster_coverage_archived_20220904',
'booster_shot_administered_archived_20220904',
'repeating_shot_administered_20220713',
'vaccine_administered_last_timeframe_archived_20240117',
'vaccine_campaigns_archived_20240117',
];

export const getStaticProps = createGetStaticProps(
({ locale }: { locale: keyof Languages }) => getLokalizeTexts(selectLokalizeTexts, locale),
getLastGeneratedDate,
selectNlData('vaccine_administered_last_timeframe', 'vaccine_campaigns'),
selectArchivedNlData(
'vaccine_administered_doctors_archived_20220324',
'vaccine_administered_hospitals_and_care_institutions_archived_20220324',
Expand All @@ -96,7 +87,9 @@ export const getStaticProps = createGetStaticProps(
'vaccine_coverage_archived_20220518',
'vaccine_delivery_per_supplier_archived_20211101',
'vaccine_stock_archived_20211024',
'vaccine_vaccinated_or_support_archived_20230411'
'vaccine_vaccinated_or_support_archived_20230411',
'vaccine_administered_last_timeframe_archived_20240117',
'vaccine_campaigns_archived_20240117'
),
() => selectAdministrationData(getArchivedNlData().data.vaccine_administered_archived_20220914),
async (context: GetStaticPropsContext) => {
Expand Down Expand Up @@ -138,7 +131,7 @@ const selectLokalizeTexts = (siteText: SiteText) => ({
type LokalizeTexts = ReturnType<typeof selectLokalizeTexts>;

function VaccinationPage(props: StaticProps<typeof getStaticProps>) {
const { content, archivedChoropleth, selectedNlData: currentData, selectedArchivedNlData: archivedData, lastGenerated, administrationData } = props;
const { content, archivedChoropleth, selectedArchivedNlData: archivedData, lastGenerated, administrationData } = props;
const { commonTexts } = useIntl();
const reverseRouter = useReverseRouter();

Expand Down Expand Up @@ -169,7 +162,7 @@ function VaccinationPage(props: StaticProps<typeof getStaticProps>) {

const hasActiveWarningTile = textNl.belangrijk_bericht && !isEmpty(textNl.belangrijk_bericht);

const lastInsertionDateOfPage = getLastInsertionDateOfPage(currentData, pageMetrics);
const lastInsertionDateOfPage = getLastInsertionDateOfPage(archivedData, pageMetrics);

return (
<Layout {...metadata} lastGenerated={lastGenerated}>
Expand Down Expand Up @@ -200,15 +193,15 @@ function VaccinationPage(props: StaticProps<typeof getStaticProps>) {
{
title: textNl.kpi_vaccinaties_de_coronaprik.tile_amount_administered_last_timeframe.title,
description: textNl.kpi_vaccinaties_de_coronaprik.tile_amount_administered_last_timeframe.omschrijving,
value: currentData.vaccine_campaigns.vaccine_campaigns[0].vaccine_administered_last_timeframe,
dateOrRange: { start: currentData.vaccine_campaigns.date_start_unix, end: currentData.vaccine_campaigns.date_end_unix },
value: archivedData.vaccine_campaigns_archived_20240117.vaccine_campaigns[0].vaccine_administered_last_timeframe,
dateOrRange: { start: archivedData.vaccine_campaigns_archived_20240117.date_start_unix, end: archivedData.vaccine_campaigns_archived_20240117.date_end_unix },
source: textShared.bronnen.rivm,
},
{
title: textNl.kpi_vaccinaties_de_coronaprik.tile_amount_administered_total.title,
description: textNl.kpi_vaccinaties_de_coronaprik.tile_amount_administered_total.omschrijving,
value: currentData.vaccine_campaigns.vaccine_campaigns[0].vaccine_administered_total,
dateOrRange: currentData.vaccine_campaigns.date_unix,
value: archivedData.vaccine_campaigns_archived_20240117.vaccine_campaigns[0].vaccine_administered_total,
dateOrRange: archivedData.vaccine_campaigns_archived_20240117.date_unix,
source: textShared.bronnen.rivm,
},
]}
Expand All @@ -217,11 +210,14 @@ function VaccinationPage(props: StaticProps<typeof getStaticProps>) {
<VaccinationsPerSupplierOverLastTimeframeTile
title={textNl.vaccinations_per_supplier_over_last_timeframe.title}
description={textNl.vaccinations_per_supplier_over_last_timeframe.description}
data={currentData.vaccine_administered_last_timeframe.vaccine_types}
data={archivedData.vaccine_administered_last_timeframe_archived_20240117.vaccine_types}
metadata={{
source: textShared.bronnen.rivm,
date: { start: currentData.vaccine_administered_last_timeframe.date_start_unix, end: currentData.vaccine_administered_last_timeframe.date_end_unix },
obtainedAt: currentData.vaccine_administered_last_timeframe.date_of_insertion_unix,
date: {
start: archivedData.vaccine_administered_last_timeframe_archived_20240117.date_start_unix,
end: archivedData.vaccine_administered_last_timeframe_archived_20240117.date_end_unix,
},
obtainedAt: archivedData.vaccine_administered_last_timeframe_archived_20240117.date_of_insertion_unix,
}}
/>

Expand Down
2 changes: 1 addition & 1 deletion packages/cms/src/studio/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const titleByMetricName: Partial<Record<MetricName, string>> = {
vaccine_administered_total_archived_20220324: 'Totaal aantal gezette prikken',
vaccine_administered_archived_20220914: 'Gezette prikken',
vaccine_campaigns_archived_20220908: 'Vaccinatie campagnes (archief per 08-09-2022)',
vaccine_campaigns: 'Vaccinatie campagnes',
vaccine_campaigns_archived_20240117: 'Vaccinatie campagnes',
vaccine_coverage_per_age_group_archived_20220908: 'Vaccinatiegraad (per leeftijd) (archief per 08-09-2022)',
vaccine_coverage_per_age_group_archived_20220622: 'Vaccinatiegraad (per leeftijd) (archief)',
vaccine_coverage_per_age_group_estimated_archived_20220908: 'Vaccinatiegraad berekend (per leeftijd) (archief 08-09-2022)',
Expand Down
54 changes: 27 additions & 27 deletions packages/common/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ export interface ArchivedNl {
corona_melder_app_warning_archived_20220421: ArchivedNlCoronaMelderAppWarning;
corona_melder_app_download_archived_20220421: ArchivedNlCoronaMelderAppDownload;
infectious_people_archived_20210709: ArchivedNlInfectiousPeople;
vaccine_administered_last_timeframe_archived_20240117: ArchivedNlVaccineAdministeredLastTimeframe;
vaccine_campaigns_archived_20240117: ArchivedNlVaccineCampaign;
}
export interface ArchivedNlDifference {
deceased_rivm__covid_daily_archived_20221231: DifferenceInteger;
Expand Down Expand Up @@ -892,6 +894,31 @@ export interface ArchivedNlInfectiousPeopleValue {
date_unix: number;
date_of_insertion_unix: number;
}
export interface ArchivedNlVaccineAdministeredLastTimeframe {
vaccine_types: NlVaccineType[];
date_unix: number;
date_start_unix: number;
date_end_unix: number;
date_of_insertion_unix: number;
}
export interface NlVaccineType {
vaccine_type_name: string;
vaccine_type_value: number;
}
export interface ArchivedNlVaccineCampaign {
vaccine_campaigns: ArchivedNlVaccineCampaigns[];
date_unix: number;
date_start_unix: number;
date_end_unix: number;
date_of_insertion_unix: number;
}
export interface ArchivedNlVaccineCampaigns {
vaccine_campaign_order: number;
vaccine_campaign_name_nl: string;
vaccine_campaign_name_en: string;
vaccine_administered_total: number | null;
vaccine_administered_last_timeframe: number;
}

export type ArchivedVrCollectionId = 'VR_COLLECTION';

Expand Down Expand Up @@ -1050,8 +1077,6 @@ export interface Nl {
hospital_lcps: NlHospitalLcps;
intensive_care_lcps: NlIntensiveCareLcps;
deceased_cbs: NlDeceasedCbs;
vaccine_administered_last_timeframe: NlVaccineAdministeredLastTimeframe;
vaccine_campaigns: NlVaccineCampaign;
variants: NlVariants;
self_test_overall: NlSelfTestOverall;
infectionradar_symptoms_trend_per_age_group_weekly: NlInfectionradarSymptomsTrendPerAgeGroupWeekly;
Expand Down Expand Up @@ -1199,31 +1224,6 @@ export interface NlDeceasedCbsValue {
date_end_unix: number;
date_of_insertion_unix: number;
}
export interface NlVaccineAdministeredLastTimeframe {
vaccine_types: NlVaccineType[];
date_unix: number;
date_start_unix: number;
date_end_unix: number;
date_of_insertion_unix: number;
}
export interface NlVaccineType {
vaccine_type_name: string;
vaccine_type_value: number;
}
export interface NlVaccineCampaign {
vaccine_campaigns: NlVaccineCampaigns[];
date_unix: number;
date_start_unix: number;
date_end_unix: number;
date_of_insertion_unix: number;
}
export interface NlVaccineCampaigns {
vaccine_campaign_order: number;
vaccine_campaign_name_nl: string;
vaccine_campaign_name_en: string;
vaccine_administered_total: number | null;
vaccine_administered_last_timeframe: number;
}
export interface NlVariants {
values: NlVariantsVariant[];
}
Expand Down

0 comments on commit afd3bee

Please sign in to comment.