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

COR-1489-remove-toggle-view-on-patients-page #4717

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion packages/app/src/components/choropleth/logic/thresholds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ export const thresholds: Thresholds = {
vr: {
infected_per_100k: positiveTestedThresholds,
admissions_on_date_of_admission: vrHospitalAdmissionsThresholds,
admissions_on_date_of_admission_per_100000: hospitalAdmissionsPer100000Thresholds,
infected_locations_percentage: infectedLocationsPercentageThresholds,
average: sewerThresholds,
positive_tested_daily_per_100k: elderlyAtHomeThresholds,
Expand Down
69 changes: 20 additions & 49 deletions packages/app/src/pages/landelijk/patienten-in-beeld.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { colors, GmCollectionHospitalNice, TimeframeOption, TimeframeOptionsList, VrCollectionHospitalNice } from '@corona-dashboard/common';
import { colors, GmCollectionHospitalNice, TimeframeOption, TimeframeOptionsList } from '@corona-dashboard/common';
import { Ziekenhuis } from '@corona-dashboard/icons';
import { last } from 'lodash';
import { GetStaticPropsContext } from 'next';
import { useState } from 'react';
import { RegionControlOption } from '~/components/chart-region-controls';
import { ChartTile } from '~/components/chart-tile';
import { ChartTileToggleItem } from '~/components/chart-tile-toggle';
import { DynamicChoropleth } from '~/components/choropleth';
Expand Down Expand Up @@ -101,10 +99,8 @@ const PatientsPage = (props: StaticProps<typeof getStaticProps>) => {
];

const reverseRouter = useReverseRouter();
const [selectedMap, setSelectedMap] = useState<RegionControlOption>('vr');

const lastValueNice = data.hospital_nice.last_value;
const lastValueNiceChoropleth = (selectedMap === 'gm' ? last(choropleth.gm.hospital_nice_choropleth) : last(choropleth.vr.hospital_nice_choropleth)) || lastValueNice;
const underReportedRange = getBoundaryDateStartUnix(
data.hospital_nice.values,
countTrailingNullValues(data.hospital_nice.values, 'admissions_on_date_of_admission_moving_average')
Expand All @@ -118,7 +114,6 @@ const PatientsPage = (props: StaticProps<typeof getStaticProps>) => {
const lastInsertionDateOfPage = getLastInsertionDateOfPage(data, pageMetrics);

const choroplethDataGm: GmCollectionHospitalNice[] = choropleth.gm.hospital_nice_choropleth;
const choroplethDataVr: VrCollectionHospitalNice[] = choropleth.vr.hospital_nice_choropleth;

return (
<Layout {...metadataTexts} lastGenerated={lastGenerated}>
Expand All @@ -145,56 +140,32 @@ const PatientsPage = (props: StaticProps<typeof getStaticProps>) => {
<ChoroplethTile
title={textNl.choropleth.title}
description={textNl.choropleth.description}
onChartRegionChange={setSelectedMap}
chartRegion={selectedMap}
legend={{
thresholds: selectedMap === 'gm' ? thresholds.gm.admissions_on_date_of_admission_per_100000 : thresholds.gm.admissions_on_date_of_admission_per_100000,
thresholds: thresholds.gm.admissions_on_date_of_admission_per_100000,
title: textNl.choropleth.legend_title,
}}
metadata={{
date: lastValueNiceChoropleth.date_unix,
date: lastValueNice.date_unix,
VWSCoronaDashboard26 marked this conversation as resolved.
Show resolved Hide resolved
source: textNl.sources.nice,
}}
>
{selectedMap === 'gm' && (
<DynamicChoropleth
accessibility={{
key: 'hospital_admissions_municipal_choropleth',
}}
map="gm"
data={choroplethDataGm}
dataConfig={{
metricName: 'hospital_nice_choropleth',
metricProperty: 'admissions_on_date_of_admission_per_100000',
}}
dataOptions={{
getLink: reverseRouter.gm.ziekenhuisopnames,
tooltipVariables: {
patients: commonTexts.choropleth_tooltip.patients,
},
}}
/>
)}
{selectedMap === 'vr' && (
<DynamicChoropleth
accessibility={{
key: 'hospital_admissions_region_choropleth',
}}
map="vr"
thresholdMap="gm"
data={choroplethDataVr}
dataConfig={{
metricName: 'hospital_nice_choropleth',
metricProperty: 'admissions_on_date_of_admission_per_100000',
}}
dataOptions={{
getLink: reverseRouter.vr.ziekenhuisopnames,
tooltipVariables: {
patients: commonTexts.choropleth_tooltip.patients,
},
}}
/>
)}
<DynamicChoropleth
accessibility={{
key: 'hospital_admissions_municipal_choropleth',
}}
map="gm"
data={choroplethDataGm}
dataConfig={{
metricName: 'hospital_nice_choropleth',
metricProperty: 'admissions_on_date_of_admission_per_100000',
}}
dataOptions={{
getLink: reverseRouter.gm.ziekenhuisopnames,
tooltipVariables: {
patients: commonTexts.choropleth_tooltip.patients,
},
}}
/>
</ChoroplethTile>

<InView rootMargin="400px">
Expand Down
2 changes: 2 additions & 0 deletions packages/cms/src/lokalize/key-mutations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ timestamp,action,key,document_id,move_to
2023-03-24T07:45:03.890Z,delete,pages.topical_page.shared.secties.search.title.nl,PGwiP4IwXrA0GfLCLD9Tth,__
2023-03-24T07:45:03.890Z,delete,pages.topical_page.shared.secties.search.title.vr,7nClfXqPlyZyEU7PO2TAAw,__
2023-03-23T08:50:33.174Z,delete,common.nav.links.veiligheidsregio,jF33EuwumlGuwav2FD3VW8,__
2023-03-28T12:52:25.750Z,delete,common.accessibility.charts.hospital_admissions_region_choropleth.description,YzrXb3vQYHnZxtu61Xgzap,__
2023-03-28T12:52:25.751Z,delete,common.accessibility.charts.hospital_admissions_region_choropleth.label,Z3v1SKYekK4CLDpzUPbgJt,__