fix: enforce SCADA chart device coverage

This commit is contained in:
2026-11-12 10:38:55 +08:00
parent b853b61a0b
commit 2e8fe86f3f
17 changed files with 1220 additions and 13 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"contracts": {
"server": {
"file": "server-v1.openapi.json",
"sha256": "7ed3f6485909c3ef7fac8d2083d6931765e4d197e690c3b9914b905a8aa743b2"
"sha256": "d96df154b86b797d0db913d1e69cf335d92d34dd119f800c9346b90c6119c9bb"
}
}
}
+174
View File
@@ -4032,6 +4032,23 @@
"title": "Recommendations",
"type": "array"
},
"scada_device_ids": {
"anyOf": [
{
"items": {
"maxLength": 128,
"minLength": 1,
"type": "string"
},
"maxItems": 1000,
"type": "array"
},
{
"type": "null"
}
],
"title": "Scada Device Ids"
},
"stage": {
"anyOf": [
{
@@ -4144,6 +4161,23 @@
"title": "Recommendations",
"type": "array"
},
"scada_device_ids": {
"anyOf": [
{
"items": {
"maxLength": 128,
"minLength": 1,
"type": "string"
},
"maxItems": 1000,
"type": "array"
},
{
"type": "null"
}
],
"title": "Scada Device Ids"
},
"stage": {
"enum": [
"interim",
@@ -7383,6 +7417,110 @@
"title": "RunSimulationManuallyByDateRest",
"type": "object"
},
"ScadaChartContext": {
"additionalProperties": false,
"properties": {
"gaps": {
"items": {
"$ref": "#/components/schemas/ScadaChartGap"
},
"maxItems": 8,
"title": "Gaps",
"type": "array"
},
"metric": {
"enum": [
"pressure",
"flow"
],
"title": "Metric",
"type": "string"
},
"role": {
"enum": [
"current",
"comparison"
],
"title": "Role",
"type": "string"
},
"unit": {
"maxLength": 128,
"minLength": 1,
"title": "Unit",
"type": "string"
},
"value_field": {
"default": "monitored_value",
"enum": [
"monitored_value",
"cleaned_value"
],
"title": "Value Field",
"type": "string"
},
"window_end": {
"format": "date-time",
"title": "Window End",
"type": "string"
},
"window_start": {
"format": "date-time",
"title": "Window Start",
"type": "string"
}
},
"required": [
"role",
"metric",
"unit",
"window_start",
"window_end"
],
"title": "ScadaChartContext",
"type": "object"
},
"ScadaChartGap": {
"additionalProperties": false,
"properties": {
"day_offset": {
"maximum": 7.0,
"minimum": 0.0,
"title": "Day Offset",
"type": "integer"
},
"device_id": {
"maxLength": 128,
"minLength": 1,
"title": "Device Id",
"type": "string"
},
"missing_count": {
"maximum": 100.0,
"minimum": 1.0,
"title": "Missing Count",
"type": "integer"
},
"reason": {
"enum": [
"no_readings",
"outside_frozen_scope",
"outside_frozen_window",
"no_scheduled_samples"
],
"title": "Reason",
"type": "string"
}
},
"required": [
"device_id",
"day_offset",
"missing_count",
"reason"
],
"title": "ScadaChartGap",
"type": "object"
},
"ScadaDeviceResponse": {
"description": "Project SCADA metadata keyed by the canonical device identifier.",
"properties": {
@@ -10450,6 +10588,16 @@
"title": "Chart Type",
"type": "string"
},
"scada": {
"anyOf": [
{
"$ref": "#/components/schemas/ScadaChartContext"
},
{
"type": "null"
}
]
},
"series": {
"items": {
"$ref": "#/components/schemas/TaskSafeChartSeries"
@@ -10527,6 +10675,32 @@
"title": "Data",
"type": "array"
},
"day_offset": {
"anyOf": [
{
"maximum": 7.0,
"minimum": 0.0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Day Offset"
},
"device_id": {
"anyOf": [
{
"maxLength": 128,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"title": "Device Id"
},
"name": {
"maxLength": 128,
"title": "Name",
+101
View File
@@ -207,6 +207,97 @@
"type": "string",
"maxLength": 200
},
"scada": {
"type": "object",
"properties": {
"role": {
"type": "string",
"enum": [
"current",
"comparison"
]
},
"metric": {
"type": "string",
"enum": [
"pressure",
"flow"
]
},
"unit": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"window_start": {
"type": "string",
"maxLength": 64,
"format": "date-time",
"pattern": "^(?:[1-9][0-9]{3}|0[1-9][0-9]{2}|00[1-9][0-9]|000[1-9])-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])$"
},
"window_end": {
"type": "string",
"maxLength": 64,
"format": "date-time",
"pattern": "^(?:[1-9][0-9]{3}|0[1-9][0-9]{2}|00[1-9][0-9]|000[1-9])-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])$"
},
"value_field": {
"type": "string",
"enum": [
"monitored_value",
"cleaned_value"
]
},
"gaps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"device_id": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"day_offset": {
"type": "integer",
"minimum": 0,
"maximum": 7
},
"missing_count": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"reason": {
"type": "string",
"enum": [
"no_readings",
"outside_frozen_scope",
"outside_frozen_window",
"no_scheduled_samples"
]
}
},
"required": [
"device_id",
"day_offset",
"missing_count",
"reason"
],
"additionalProperties": false
},
"maxItems": 8
}
},
"required": [
"role",
"metric",
"unit",
"window_start",
"window_end"
],
"additionalProperties": false
},
"chart_type": {
"type": "string",
"enum": [
@@ -241,6 +332,16 @@
"type": "string",
"maxLength": 128
},
"device_id": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"day_offset": {
"type": "integer",
"minimum": 0,
"maximum": 7
},
"type": {
"type": "string",
"enum": [