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

Commit

Permalink
feature/COR-1772_adjusted-KPIs-for-hospital-admissions-per-municipali…
Browse files Browse the repository at this point in the history
…ty (#4852)

* feat(COR-1772): patienten-in-beeld part almost complete

* feat(COR-1772): lokalize keys corrected mistake

* feat(COR-1772): Added if statement checker for new pageType

* feat(COR-1772): Added lokalize key

* feat(COR-1772): commit to validate protos

* feat(COR-1772): Changed to date range for PageInformationBlock and KPITile

* feat(COR-1772): Schema adjustments

* feat(COR-1772): final schema adjustments

* feat(COR-1772): pre-final steps before PR

* feat(COR-1772): First PR comment resolution

* feat(COR-1772): Schema adjustment

* feat(COR-1772): corrected naming based on threshold conventions

* feat(COR-1772): Type contingency for choropleth legend

* feat(COR-1772): PR comment resolution

* feat(COR-1772): PR comment resolution
  • Loading branch information
VWSCoronaDashboard30 authored Aug 31, 2023
1 parent 87daac8 commit d2117ef
Show file tree
Hide file tree
Showing 18 changed files with 314 additions and 48 deletions.
6 changes: 5 additions & 1 deletion packages/app/schema/archived_gm/__difference.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"required": [
"tested_overall__infected_moving_average_archived_20230331",
"tested_overall__infected_per_100k_moving_average_archived_20230331",
"deceased_rivm__covid_daily_archived_20221231"
"deceased_rivm__covid_daily_archived_20221231",
"hospital_nice__admissions_on_date_of_reporting_moving_average_archived_20230830"
],
"properties": {
"tested_overall__infected_moving_average_archived_20230331": {
Expand All @@ -16,6 +17,9 @@
},
"deceased_rivm__covid_daily_archived_20221231": {
"$ref": "#/definitions/diff_integer"
},
"hospital_nice__admissions_on_date_of_reporting_moving_average_archived_20230830": {
"$ref": "#/definitions/diff_integer"
}
},
"additionalProperties": false,
Expand Down
10 changes: 9 additions & 1 deletion packages/app/schema/archived_gm_collection/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "object",
"title": "archived_gm_collection",
"additionalProperties": false,
"required": ["last_generated", "proto_name", "name", "code", "sewer_archived_20230623", "tested_overall_archived_20230331"],
"required": ["last_generated", "proto_name", "name", "code", "hospital_nice_choropleth_archived_20230830", "sewer_archived_20230623", "tested_overall_archived_20230331"],
"properties": {
"last_generated": {
"type": "string"
Expand All @@ -17,6 +17,14 @@
"code": {
"$ref": "#/$defs/archived_gm_collection_id"
},
"hospital_nice_choropleth_archived_20230830": {
"type": "array",
"minItems": 342,
"maxItems": 342,
"items": {
"$ref": "hospital_nice_choropleth.json"
}
},
"sewer_archived_20230623": {
"type": "array",
"minItems": 342,
Expand Down
28 changes: 28 additions & 0 deletions packages/app/schema/archived_gm_collection/hospital_nice.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "archived_gm_collection_hospital_nice",
"additionalProperties": false,
"required": ["date_unix", "gmcode", "admissions_on_date_of_admission", "admissions_on_date_of_admission_per_100000", "admissions_on_date_of_reporting", "date_of_insertion_unix"],
"properties": {
"date_unix": {
"type": "integer"
},
"gmcode": {
"type": "string",
"pattern": "^GM[0-9]+$"
},
"admissions_on_date_of_admission": {
"type": "integer"
},
"admissions_on_date_of_admission_per_100000": {
"type": "number"
},
"admissions_on_date_of_reporting": {
"type": "integer"
},
"date_of_insertion_unix": {
"type": "integer"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "archived_gm_collection_hospital_nice_choropleth",
"additionalProperties": false,
"required": ["date_unix", "gmcode", "admissions_on_date_of_admission", "admissions_on_date_of_admission_per_100000", "admissions_on_date_of_reporting", "date_of_insertion_unix"],
"properties": {
"date_unix": {
"type": "integer"
},
"gmcode": {
"type": "string",
"pattern": "^GM[0-9]+$"
},
"admissions_on_date_of_admission": {
"type": "number"
},
"admissions_on_date_of_admission_per_100000": {
"type": "number"
},
"admissions_on_date_of_reporting": {
"type": "number"
},
"date_of_insertion_unix": {
"type": "integer"
}
}
}
14 changes: 13 additions & 1 deletion packages/app/schema/gm/hospital_nice.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
"admissions_on_date_of_admission",
"admissions_on_date_of_admission_moving_average",
"admissions_on_date_of_admission_moving_average_rounded",
"admissions_in_the_last_7_days",
"admissions_on_date_of_reporting",
"date_unix",
"date_of_insertion_unix"
"date_of_insertion_unix",
"date_start_unix",
"date_end_unix"
],
"properties": {
"date_unix": {
Expand All @@ -25,11 +28,20 @@
"admissions_on_date_of_admission_moving_average_rounded": {
"type": ["integer", "null"]
},
"admissions_in_the_last_7_days": {
"type": ["integer", "null"]
},
"admissions_on_date_of_reporting": {
"type": "integer"
},
"date_of_insertion_unix": {
"type": "integer"
},
"date_start_unix": {
"type": "integer"
},
"date_end_unix": {
"type": "integer"
}
}
}
Expand Down
21 changes: 7 additions & 14 deletions packages/app/schema/gm_collection/hospital_nice_choropleth.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
"type": "object",
"title": "gm_collection_hospital_nice_choropleth",
"additionalProperties": false,
"required": [
"date_unix",
"gmcode",
"admissions_on_date_of_admission",
"admissions_on_date_of_admission_per_100000",
"admissions_on_date_of_reporting",
"date_of_insertion_unix"
],
"required": ["date_unix", "gmcode", "admissions_in_the_last_7_days_per_100000", "date_of_insertion_unix", "date_start_unix", "date_end_unix"],
"properties": {
"date_unix": {
"type": "integer"
Expand All @@ -19,16 +12,16 @@
"type": "string",
"pattern": "^GM[0-9]+$"
},
"admissions_on_date_of_admission": {
"type": "integer"
},
"admissions_on_date_of_admission_per_100000": {
"admissions_in_the_last_7_days_per_100000": {
"type": "number"
},
"admissions_on_date_of_reporting": {
"date_of_insertion_unix": {
"type": "integer"
},
"date_start_unix": {
"type": "integer"
},
"date_of_insertion_unix": {
"date_end_unix": {
"type": "integer"
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/app/src/components/choropleth-legenda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ export function ChoroplethLegenda({ title, thresholds, valueAnnotation, pageType
});
if (pageType === 'sewer' && i === 0 && x.threshold === 0) {
label = commonTexts.common.no_virus_particles_measured;
} else if (pageType === 'patienten-in-beeld' || (pageType === 'ziekenhuis-opnames' && i === 0 && x.threshold === 0)) {
label = commonTexts.common.no_notifications;
}
if (pageType === 'sewer' && i === 1) {

if (pageType && i === 1) {
label = replaceVariablesInText(commonTexts.common.greater_than_value, {
value_1: x.threshold,
value_2: thresholds[i + 1].threshold,
Expand Down
13 changes: 12 additions & 1 deletion packages/app/src/components/choropleth-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ErrorBoundary } from './error-boundary';
import { FullscreenChartTile } from './fullscreen-chart-tile';
import { MetadataProps } from './metadata';
import { Heading, Text } from './typography';

import { CalendarGear } from '@corona-dashboard/icons';
type ChoroplethTileProps = {
title: string;
description?: string | React.ReactNode;
Expand All @@ -22,6 +22,7 @@ type ChoroplethTileProps = {
valueAnnotation?: string;
hasPadding?: boolean;
pageType?: string;
notification?: string;
} & (
| {
onChartRegionChange: (v: RegionControlOption) => void;
Expand All @@ -44,6 +45,7 @@ export function ChoroplethTile({
valueAnnotation,
hasPadding,
pageType,
notification,
...dataProps
}: ChoroplethTileProps) {
const breakpoints = useBreakpoints(true);
Expand All @@ -61,6 +63,15 @@ export function ChoroplethTile({

{typeof description === 'string' ? <Text>{description}</Text> : description}

{notification && (
<Box display="flex" alignItems={'center'}>
<CalendarGear />
<Box marginLeft={space[2]}>
<Text>{notification}</Text>
</Box>
</Box>
)}

{onChartRegionChange && chartRegion && (
<Box display="flex" justifyContent="flex-start" paddingTop={space[4]}>
<ChartRegionControls value={chartRegion} onChange={onChartRegionChange} />
Expand Down
36 changes: 36 additions & 0 deletions packages/app/src/components/choropleth/logic/thresholds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,41 @@ const hospitalAdmissionsPer100000Thresholds: ChoroplethThresholdsValue[] = [
},
];

const admissionsInTheLast7DaysPer100000: ChoroplethThresholdsValue[] = [
{
color: colors.gray2,
threshold: 0,
},
{
color: colors.scale.blueDetailed[0],
threshold: 0,
},
{
color: colors.scale.blueDetailed[1],
threshold: 2.5,
},
{
color: colors.scale.blueDetailed[2],
threshold: 5,
},
{
color: colors.scale.blueDetailed[3],
threshold: 10,
},
{
color: colors.scale.blueDetailed[4],
threshold: 15,
},
{
color: colors.scale.blueDetailed[5],
threshold: 25,
},
{
color: colors.scale.blueDetailed[6],
threshold: 50,
},
];

const infectedLocationsPercentageThresholds: ChoroplethThresholdsValue[] = [
{
color: colors.gray2,
Expand Down Expand Up @@ -319,6 +354,7 @@ export const thresholds: Thresholds = {
gm: {
infected_per_100k: positiveTestedThresholds,
admissions_on_date_of_admission_per_100000: hospitalAdmissionsPer100000Thresholds,
admissions_in_the_last_7_days_per_100000: admissionsInTheLast7DaysPer100000,
admissions_on_date_of_admission: hospitalAdmissionsThresholds,
elderly_at_home: elderlyAtHomeThresholds,
average: sewerThresholds,
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/components/choropleth/logic/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
ArchivedGmCollection,
ArchivedGmCollectionHospitalNiceChoropleth,
GmCollection,
GmCollectionHospitalNiceChoropleth,
GmCollectionSewer,
Expand Down Expand Up @@ -59,7 +60,7 @@ export type InferedDataCollection<T extends ChoroplethDataItem> = T extends GmDa
export type GmDataCollection = GmCollectionHospitalNiceChoropleth[] | GmCollectionSewer[] | GmCollectionVaccineCoveragePerAgeGroup[];
export type GmDataItem = GmDataCollection[number];

export type ArchivedGmDataCollection = GmCollectionTestedOverall[];
export type ArchivedGmDataCollection = GmCollectionTestedOverall[] | ArchivedGmCollectionHospitalNiceChoropleth[];
export type ArchivedGmDataItem = ArchivedGmDataCollection[number];

export type ArchivedVrDataCollection = VrCollectionVulnerableNursingHome[] | VrCollectionElderlyAtHome[] | VrCollectionDisabilityCare[];
Expand Down
Loading

0 comments on commit d2117ef

Please sign in to comment.