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

Commit

Permalink
feat(COR-1690): Archived positive tests metrics (#4827)
Browse files Browse the repository at this point in the history
* feat(COR-1690): Archived positive tests metrics

* feat(COR-1690): Implemented GM and Choropleth changes

* feat(COR-1690): Removed console.log() from get-schema-metrics.ts

* feat(COR-1690): PR comment resolution

* feat(COR-1690): PR CMS V2 compile issue resolution
  • Loading branch information
VWSCoronaDashboard30 authored Aug 8, 2023
1 parent 7cf3c52 commit f0fce3c
Show file tree
Hide file tree
Showing 27 changed files with 340 additions and 292 deletions.
56 changes: 56 additions & 0 deletions packages/app/schema/archived_gm/__difference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "archived_gm_difference",
"type": "object",
"properties": {
"tested_overall__infected_moving_average_archived_20230331": {
"$ref": "#/definitions/diff_decimal"
},
"tested_overall__infected_per_100k_moving_average_archived_20230331": {
"$ref": "#/definitions/diff_decimal"
}
},
"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
}
}
}
14 changes: 7 additions & 7 deletions packages/app/schema/archived_gm/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
"type": "object",
"title": "archived_gm",
"additionalProperties": false,
"required": [
"last_generated",
"proto_name",
"name",
"code",
"sewer_archived_20230623"
],
"required": ["last_generated", "proto_name", "name", "code", "difference", "sewer_archived_20230623", "tested_overall_archived_20230331"],
"properties": {
"last_generated": {
"type": "string"
Expand All @@ -23,8 +17,14 @@
"code": {
"$ref": "#/$defs/archived_gm_code"
},
"difference": {
"$ref": "__difference.json"
},
"sewer_archived_20230623": {
"$ref": "sewer.json"
},
"tested_overall_archived_20230331": {
"$ref": "positive_tests/tested_overall.json"
}
},
"$defs": {
Expand Down
16 changes: 9 additions & 7 deletions packages/app/schema/archived_gm_collection/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
"type": "object",
"title": "archived_gm_collection",
"additionalProperties": false,
"required": [
"last_generated",
"proto_name",
"name",
"code",
"sewer_archived_20230623"
],
"required": ["last_generated", "proto_name", "name", "code", "sewer_archived_20230623", "tested_overall_archived_20230331"],
"properties": {
"last_generated": {
"type": "string"
Expand All @@ -30,6 +24,14 @@
"items": {
"$ref": "sewer.json"
}
},
"tested_overall_archived_20230331": {
"type": "array",
"minItems": 342,
"maxItems": 342,
"items": {
"$ref": "positive_tests/tested_overall.json"
}
}
},
"$defs": {
Expand Down
30 changes: 23 additions & 7 deletions packages/app/schema/archived_nl/__difference.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,41 @@
"nursing_home__deceased_daily_archived_20230126": {
"$ref": "#/definitions/diff_integer"
},
"vulnerable_nursing_home__infected_locations_total_archived_20230711": {
"nursing_home__newly_infected_people_archived_20230126": {
"$ref": "#/definitions/diff_integer"
},
"nursing_home__newly_infected_people_archived_20230126": {
"reproduction__index_average_archived_20230711": {
"$ref": "#/definitions/diff_decimal"
},
"tested_ggd__infected_percentage_moving_average_archived_20230321": {
"$ref": "#/definitions/diff_decimal"
},
"tested_ggd__tested_total_moving_average_archived_20230321": {
"$ref": "#/definitions/diff_decimal"
},
"tested_overall__infected_moving_average_archived_20230331": {
"$ref": "#/definitions/diff_decimal"
},
"tested_overall__infected_per_100k_moving_average_archived_20230331": {
"$ref": "#/definitions/diff_decimal"
},
"vulnerable_nursing_home__infected_locations_total_archived_20230711": {
"$ref": "#/definitions/diff_integer"
},
"vulnerable_hospital_admissions_archived_20230711": {
"$ref": "#/definitions/diff_integer"
},
"reproduction__index_average_archived_20230711": {
"$ref": "#/definitions/diff_decimal"
}
},
"required": [
"nursing_home__deceased_daily_archived_20230126",
"vulnerable_nursing_home__infected_locations_total_archived_20230711",
"nursing_home__newly_infected_people_archived_20230126",
"reproduction__index_average_archived_20230711",
"tested_ggd__infected_percentage_moving_average_archived_20230321",
"tested_ggd__tested_total_moving_average_archived_20230321",
"tested_overall__infected_moving_average_archived_20230331",
"tested_overall__infected_per_100k_moving_average_archived_20230331",
"vulnerable_hospital_admissions_archived_20230711",
"reproduction__index_average_archived_20230711"
"vulnerable_nursing_home__infected_locations_total_archived_20230711"
],
"additionalProperties": false,
"definitions": {
Expand Down
20 changes: 18 additions & 2 deletions packages/app/schema/archived_nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
"behavior_annotations_archived_20230412",
"behavior_per_age_group_archived_20230411",
"doctor_archived_20210903",
"g_number_archived_20220307",
"nursing_home_archived_20230126",
"reproduction_archived_20230711",
"sewer_archived_20230623",
"tested_ggd_archived_20230321",
"tested_overall_archived_20230331",
"tested_per_age_group_archived_20230331",
"vulnerable_hospital_admissions_archived_20230711",
"vulnerable_nursing_home_archived_20230711",
"reproduction_archived_20230711"
"vulnerable_nursing_home_archived_20230711"
],
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -47,9 +51,21 @@
"doctor_archived_20210903": {
"$ref": "doctor.json"
},
"g_number_archived_20220307": {
"$ref": "positive_tests/g_number.json"
},
"nursing_home_archived_20230126": {
"$ref": "nursing_home.json"
},
"tested_ggd_archived_20230321": {
"$ref": "positive_tests/tested_ggd.json"
},
"tested_overall_archived_20230331": {
"$ref": "positive_tests/tested_overall.json"
},
"tested_per_age_group_archived_20230331": {
"$ref": "positive_tests/tested_per_age_group.json"
},
"sewer_archived_20230623": {
"$ref": "sewer.json"
},
Expand Down
13 changes: 1 addition & 12 deletions packages/app/schema/gm/__difference.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"title": "gm_difference",
"type": "object",
"properties": {
"tested_overall__infected_per_100k_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
"tested_overall__infected_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
"hospital_nice__admissions_on_date_of_reporting_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
Expand All @@ -19,12 +13,7 @@
"$ref": "#/definitions/diff_integer"
}
},
"required": [
"tested_overall__infected_per_100k_moving_average",
"tested_overall__infected_moving_average",
"hospital_nice__admissions_on_date_of_reporting_moving_average",
"deceased_rivm__covid_daily_archived_20221231"
],
"required": ["hospital_nice__admissions_on_date_of_reporting_moving_average", "deceased_rivm__covid_daily_archived_20221231"],
"additionalProperties": false,
"definitions": {
"diff_integer": {
Expand Down
4 changes: 0 additions & 4 deletions packages/app/schema/gm/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"sewer_installation_measurement",
"sewer_per_installation",
"sewer",
"tested_overall",
"vaccine_coverage_per_age_group",
"vaccine_coverage_per_age_group_archived",
"vaccine_coverage_per_age_group_archived_20220908",
Expand Down Expand Up @@ -46,9 +45,6 @@
"hospital_nice": {
"$ref": "hospital_nice.json"
},
"tested_overall": {
"$ref": "tested_overall.json"
},
"sewer": {
"$ref": "sewer.json"
},
Expand Down
10 changes: 1 addition & 9 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", "hospital_nice_choropleth", "sewer", "vaccine_coverage_per_age_group"],
"properties": {
"last_generated": {
"type": "string"
Expand Down Expand Up @@ -33,14 +33,6 @@
"$ref": "hospital_nice.json"
}
},
"tested_overall": {
"type": "array",
"minItems": 342,
"maxItems": 342,
"items": {
"$ref": "tested_overall.json"
}
},
"sewer": {
"type": "array",
"minItems": 342,
Expand Down
16 changes: 0 additions & 16 deletions packages/app/schema/nl/__difference.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
"title": "nl_difference",
"type": "object",
"properties": {
"tested_overall__infected_per_100k_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
"tested_overall__infected_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
"tested_ggd__tested_total_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
"tested_ggd__infected_percentage_moving_average": {
"$ref": "#/definitions/diff_decimal"
},
"infectious_people__estimate": {
"$ref": "#/definitions/diff_integer"
},
Expand Down Expand Up @@ -44,12 +32,8 @@
}
},
"required": [
"tested_overall__infected_per_100k_moving_average",
"tested_overall__infected_moving_average",
"hospital_nice__admissions_on_date_of_reporting_moving_average",
"hospital_lcps__beds_occupied_covid",
"tested_ggd__tested_total_moving_average",
"tested_ggd__infected_percentage_moving_average",
"infectious_people__estimate",
"intensive_care_nice__admissions_on_date_of_reporting_moving_average",
"intensive_care_lcps__beds_occupied_covid",
Expand Down
16 changes: 0 additions & 16 deletions packages/app/schema/nl/__index.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"named_difference",
"disability_care_archived_20230126",
"elderly_at_home_archived_20230126",
"g_number",
"hospital_lcps",
"hospital_nice",
"hospital_nice_per_age_group",
Expand All @@ -29,9 +28,6 @@
"proto_name",
"self_test_overall",
"sewer",
"tested_ggd",
"tested_overall",
"tested_per_age_group",
"vaccine_campaigns",
"vaccine_campaigns_archived_20220908",
"vaccine_planned_archived_20220908",
Expand Down Expand Up @@ -82,9 +78,6 @@
"booster_coverage_archived_20220904": {
"$ref": "booster_coverage_archived_20220904.json"
},
"g_number": {
"$ref": "g_number.json"
},
"infectious_people": {
"$ref": "infectious_people.json"
},
Expand All @@ -94,12 +87,6 @@
"intensive_care_nice_per_age_group": {
"$ref": "intensive_care_nice_per_age_group.json"
},
"tested_overall": {
"$ref": "tested_overall.json"
},
"tested_per_age_group": {
"$ref": "tested_per_age_group.json"
},
"sewer": {
"$ref": "sewer.json"
},
Expand All @@ -115,9 +102,6 @@
"intensive_care_lcps": {
"$ref": "intensive_care_lcps.json"
},
"tested_ggd": {
"$ref": "tested_ggd.json"
},
"disability_care_archived_20230126": {
"$ref": "disability_care_archived_20230126.json"
},
Expand Down
14 changes: 10 additions & 4 deletions packages/app/src/components/choropleth/logic/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
ArchivedGmCollection,
GmCollection,
GmCollectionHospitalNice,
GmCollectionSewer,
Expand Down Expand Up @@ -44,12 +45,14 @@ export const mapToCodeType: Record<MapType, CodeProp> = {
vr: 'vrcode',
};

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

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

export type InferedDataCollection<T extends ChoroplethDataItem> = T extends GmDataItem
? GmCollection
: T extends ArchivedGmDataItem
? ArchivedGmCollection
: T extends VrDataItem
? VrCollection
: T extends ArchivedVrDataItem
Expand All @@ -59,13 +62,16 @@ export type InferedDataCollection<T extends ChoroplethDataItem> = T extends GmDa
export type VrDataCollection = VrCollectionDisabilityCareArchived_20230126[] | VrCollectionElderlyAtHomeArchived_20230126[] | VrCollectionVulnerableNursingHome[];
export type VrDataItem = VrDataCollection[number];

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

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

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

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

export type CodedGeoProperties = {
code: string;
Expand Down
Loading

0 comments on commit f0fce3c

Please sign in to comment.