From 8f73ebbebe08964fa13b959b4bdb11ad8cbe2f0c Mon Sep 17 00:00:00 2001 From: Mackenzie Grimes - NOAA Affiliate Date: Fri, 3 Jan 2025 15:24:15 -0700 Subject: [PATCH] add gateway_web_request, support_profile schema --- .../common/schema/gateway_web_request.json | 21 +++ .../schema/gateway_web_request_schema.json | 4 + .../idsse/common/schema/support_profile.json | 151 ++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 python/idsse_common/idsse/common/schema/gateway_web_request.json create mode 100644 python/idsse_common/idsse/common/schema/gateway_web_request_schema.json create mode 100644 python/idsse_common/idsse/common/schema/support_profile.json diff --git a/python/idsse_common/idsse/common/schema/gateway_web_request.json b/python/idsse_common/idsse/common/schema/gateway_web_request.json new file mode 100644 index 0000000..23bb568 --- /dev/null +++ b/python/idsse_common/idsse/common/schema/gateway_web_request.json @@ -0,0 +1,21 @@ +{ + "GatewayWebRequest": { + "description": "Definition of an NWSC Gateway request via the web API to publish new Support Profile/Criteria", + "type": "object", + "properties": { + "issueDt": { "$ref": "timing.json#/TimeString" }, + "validDt": { + "oneOf": [ + { "$ref": "timing.json#/Timing" }, + { "$ref": "timing.json#/TimeList" } + ] + }, + "criteria": { "$ref": "criteria.json#/Criteria" }, + "supportProfile": { "$ref": "support_profile.json#/SupportProfile" } + }, + "oneOf": [ + { "required": ["supportProfile", "issueDt"] }, + { "required": ["criteria"] } + ] + } +} diff --git a/python/idsse_common/idsse/common/schema/gateway_web_request_schema.json b/python/idsse_common/idsse/common/schema/gateway_web_request_schema.json new file mode 100644 index 0000000..460d244 --- /dev/null +++ b/python/idsse_common/idsse/common/schema/gateway_web_request_schema.json @@ -0,0 +1,4 @@ +{ + "description": "Mechanism for making NWSC Gateway /profiles web request", + "allOf": [{ "$ref": "gateway_web_request.json#/GatewayWebRequest" }] +} diff --git a/python/idsse_common/idsse/common/schema/support_profile.json b/python/idsse_common/idsse/common/schema/support_profile.json new file mode 100644 index 0000000..be6ec63 --- /dev/null +++ b/python/idsse_common/idsse/common/schema/support_profile.json @@ -0,0 +1,151 @@ +{ + "Phrase": { + "description": "Definition of one weather field threshold. Akin to Criteria 'part'", + "type": "object", + "properties": { + "type": { "type": "string" }, + "phraseId": { "type": "string" }, + "probability": { "type": "number" }, + "environmentalConditionType": { "type": "string" }, + "wwaProduct": { "type": "string" }, + "condition": { "type": "string" }, + "value": { "type": "string" }, + "timeFrame": { "type": "string" }, + "minDuration": { "type": "string" }, + "dataSource": { "type": "string" }, + "dataParameter": { "type": "string" } + }, + "required": [ + "dataSource", + "environmentalConditionType", + "condition", + "value", + "units" + ] + }, + + "Severity": { + "description": "Definition of weather field thresholds to reach this severity impact", + "type": "object", + "properties": { + "severity": { "type": "string" }, + "encodedRepresentation": { + "description": "Compound statement of relationship of all weather thresholds phrases, by phraseId", + "type": "string" + }, + "map": { + "type": "object", + "patternProperties": { + "^[a-zA-Z]*$": { "$ref": "#/Phrase" } + } + } + }, + "required": ["severity", "encodedRepresentation", "map"] + }, + + "NonImpactThresholds": { + "description": "Support Profile weather conditions to determine if impact is met/not met", + "type": "object", + "properties": { + "phrasesForAllSeverities": { + "type": "object", + "properties": { + "MINOR": { "$ref": "#/Severity" }, + "MODERATE": { "$ref": "#/Severity" }, + "SEVERE": { "$ref": "#/Severity" }, + "EXTREME": { "$ref": "#/Severity" } + }, + "oneOf": [ + { "required": ["MINOR"] }, + { "required": ["MODERATE"] }, + { "required": ["SEVERE"] }, + { "required": ["EXTREME"] } + ] + }, + "allTypesAsStrings": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1 + } + }, + "required": ["phrasesForAllSeverities", "allTypesAsStrings"] + }, + + "Timing": { + "description": "Time range of Support Profile event", + "type": "object", + "properties": { + "start": { "type": ["string", "null"] }, + "duration": { "type": ["number", "null"] }, + "rrule": { "type": ["string", "null"] } + } + }, + + "Location": { + "description": "Geographic location of Support Profile event", + "type": "object", + "properties": { + "createdAt": { "type": "string" }, + "lastModified": { "type": "string" }, + "name": { "type": "string" }, + "geomAsString": { "type": "string" }, + "geometryType": { + "type": "string", + "enum": ["POINT", "LINESTRING", "POLYGON", "CIRCLE"] + }, + "geoShapeCreationMethod": { "type": "string" }, + "validTime": { "type": ["string", "null"] }, + "creationMethod": { "type": "string" }, + "notes": { "type": "string" }, + "editable": { "type": "boolean" }, + "minElevation": { "type": "number" }, + "maxElevation": { "type": "number" }, + "original": { "type": "null" }, + "address": { "type": "null" }, + "userData": { "type": "null" } + }, + "required": ["geomAsString", "name"] + }, + + "Setting": { + "description": "Definition of Support Profile event location and timing", + "type": "object", + "properties": { + "id": { "type": "string" }, + "name": { "type": "string" }, + "driverType": { "type": "string" }, + "locations": { + "type": "array", + "items": { "$ref": "#/Location" }, + "minItems": 1 + }, + "timing": { "$ref": "#/Timing" }, + "nationalSecurity": { "type": "boolean" }, + "website": { "type": "string" }, + "numberOfPeople": { "type": "number" } + } + }, + + "SupportProfile": { + "description": "Mechanism for defining an NWS Connect Support Profile", + "type": "object", + "properties": { + "id": { "type": "string" }, + "name": { "type": "string" }, + "associatedOfficeId": { "type": "string" }, + "profileType": { "type": "string" }, + "lifecycleStatus": { "type": "string" }, + "maxLeadTime": { "type": "number" }, + "maxLeadTimeAsString": { "type": "string" }, + "isLive": { "type": "boolean" }, + "timeBuffer": { "type": "number" }, + "geoBuffer": { "type": "number" }, + "requestedServices": { "type": "array" }, + "profileLevelActionPlans": { "type": "array" }, + "setting": { "$ref": "#/Setting" }, + "impacts": { "type": "array" }, + "nonImpactThresholds": { "$ref": "#/NonImpactThresholds" } + }, + "required": ["id", "name", "setting", "nonImpactThresholds"] + } +}