From bcff667531587ed64a111c61721d44d790dceb07 Mon Sep 17 00:00:00 2001 From: AT <93994194+VWSCoronaDashboard21@users.noreply.github.com> Date: Tue, 20 Dec 2022 16:23:22 +0100 Subject: [PATCH] feature/COR-1278-schema-self_test_overall (#4535) * feat: added schema for selftest_overall * fix: changed the naming * feat(infection-radar-data): Update the schema based on requirement for date ranges. * feat(self-test-schema): Adjust the schema property based on discussion on COR-1262 ticket. Co-authored-by: VWSCoronaDashboard21 Co-authored-by: VWSCoronaDashboard28 --- packages/app/schema/nl/__index.json | 4 ++ packages/app/schema/nl/self_test_overall.json | 40 +++++++++++++++++++ packages/common/src/types/data.ts | 12 ++++++ 3 files changed, 56 insertions(+) create mode 100644 packages/app/schema/nl/self_test_overall.json diff --git a/packages/app/schema/nl/__index.json b/packages/app/schema/nl/__index.json index b955224bdd..1aaad8a88f 100644 --- a/packages/app/schema/nl/__index.json +++ b/packages/app/schema/nl/__index.json @@ -32,6 +32,7 @@ "nursing_home", "proto_name", "reproduction", + "self_test_overall", "sewer", "tested_ggd", "tested_ggd_archived", @@ -241,6 +242,9 @@ }, "variants": { "$ref": "variants.json" + }, + "self_test_overall": { + "$ref": "self_test_overall.json" } }, "$defs": { diff --git a/packages/app/schema/nl/self_test_overall.json b/packages/app/schema/nl/self_test_overall.json new file mode 100644 index 0000000000..5d8975c870 --- /dev/null +++ b/packages/app/schema/nl/self_test_overall.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "nl_self_test_overall", + "type": "object", + "properties": { + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/value" + } + }, + "last_value": { + "$ref": "#/definitions/value" + } + }, + "required": ["values", "last_value"], + "additionalProperties": false, + "definitions": { + "value": { + "title": "nl_self_test_overall_value", + "type": "object", + "properties": { + "infected_percentage": { + "type": ["number", "null"] + }, + "date_range_start_unix": { + "type": "integer" + }, + "date_range_end_unix": { + "type": "integer" + }, + "date_of_insertion_unix": { + "type": "integer" + } + }, + "required": ["infected_percentage", "date_range_start_unix", "date_range_end_unix", "date_of_insertion_unix"], + "additionalProperties": false + } + } +} diff --git a/packages/common/src/types/data.ts b/packages/common/src/types/data.ts index 020fa4d12a..a54978a585 100644 --- a/packages/common/src/types/data.ts +++ b/packages/common/src/types/data.ts @@ -280,6 +280,7 @@ export interface Nl { vaccine_coverage_per_age_group_estimated_archived_20220908: NlVaccineCoveragePerAgeGroupEstimatedArchived_20220908Value; vaccine_stock: NlVaccineStock; variants?: NlVariants; + self_test_overall: NlSelfTestOverall; } export interface NlDifference { tested_overall__infected_per_100k_moving_average: DifferenceDecimal; @@ -1134,12 +1135,23 @@ export interface NlVariantsVariantValue { date_of_insertion_unix: number; date_of_report_unix: number; } +export interface NlSelfTestOverall { + values: NlSelfTestOverallValue[]; + last_value: NlSelfTestOverallValue; +} +export interface NlSelfTestOverallValue { + infected_percentage: number | null; + date_range_start_unix: number; + date_range_end_unix: number; + date_of_insertion_unix: number; +} export type TopicalIcon = | 'AfstandSporten' | 'AlcoholVerkoop' | 'Archive' | 'Arrow' + | 'ArrowWithIntensity' | 'Arts' | 'Avondklok' | 'BarChart'