feat(replay): execute periodic diagnosis and hydraulic checks

This commit is contained in:
2026-11-16 15:13:22 +08:00
parent 4c441fcbf2
commit 389892cb3f
22 changed files with 1934 additions and 12 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"contracts": {
"server": {
"file": "server-v1.openapi.json",
"sha256": "04aeed6f1a7414b37267d84141d036d00d2f8579ee28af37590bd4b92137e712"
"sha256": "90e0ac0fb466f0a67c9a8a909252a610cb8a089fd4289fa23232d4646d0a8849"
}
}
}
+579
View File
@@ -6519,6 +6519,302 @@
"title": "Page[str]",
"type": "object"
},
"PeriodicTaskExecution": {
"additionalProperties": false,
"properties": {
"attempt": {
"default": 1,
"minimum": 1.0,
"title": "Attempt",
"type": "integer"
},
"batch_sequence": {
"minimum": 1.0,
"title": "Batch Sequence",
"type": "integer"
},
"calculation_job_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"title": "Calculation Job Id"
},
"conclusion": {
"enum": [
"normal",
"attention",
"insufficient_data",
"suspected_burst",
"suspected_pollution"
],
"title": "Conclusion",
"type": "string"
},
"data_gaps": {
"items": {
"type": "string"
},
"title": "Data Gaps",
"type": "array"
},
"evidence": {
"items": {
"type": "string"
},
"title": "Evidence",
"type": "array"
},
"execution_id": {
"format": "uuid",
"title": "Execution Id",
"type": "string"
},
"investigation_task_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"title": "Investigation Task Id"
},
"knowledge_cutoff": {
"format": "date-time",
"title": "Knowledge Cutoff",
"type": "string"
},
"metrics": {
"items": {
"$ref": "#/components/schemas/PeriodicTaskMetric"
},
"title": "Metrics",
"type": "array"
},
"period_end": {
"format": "date-time",
"title": "Period End",
"type": "string"
},
"period_start": {
"format": "date-time",
"title": "Period Start",
"type": "string"
},
"replay_id": {
"format": "uuid",
"title": "Replay Id",
"type": "string"
},
"result": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Result"
},
"risk_signals": {
"items": {
"additionalProperties": true,
"type": "object"
},
"title": "Risk Signals",
"type": "array"
},
"status": {
"enum": [
"pending",
"running",
"completed",
"failed"
],
"title": "Status",
"type": "string"
},
"steps": {
"items": {
"$ref": "#/components/schemas/PeriodicTaskStep"
},
"title": "Steps",
"type": "array"
},
"summary": {
"title": "Summary",
"type": "string"
},
"task_key": {
"enum": [
"scada-diagnosis",
"network-simulation"
],
"title": "Task Key",
"type": "string"
},
"title": {
"title": "Title",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
}
},
"required": [
"execution_id",
"replay_id",
"task_key",
"title",
"period_start",
"period_end",
"knowledge_cutoff",
"batch_sequence",
"status",
"conclusion",
"summary",
"steps",
"updated_at"
],
"title": "PeriodicTaskExecution",
"type": "object"
},
"PeriodicTaskMetric": {
"additionalProperties": false,
"properties": {
"detail": {
"default": "",
"title": "Detail",
"type": "string"
},
"id": {
"title": "Id",
"type": "string"
},
"label": {
"title": "Label",
"type": "string"
},
"status": {
"default": "normal",
"enum": [
"normal",
"attention",
"critical"
],
"title": "Status",
"type": "string"
},
"unit": {
"default": "",
"title": "Unit",
"type": "string"
},
"value": {
"title": "Value",
"type": "string"
}
},
"required": [
"id",
"label",
"value"
],
"title": "PeriodicTaskMetric",
"type": "object"
},
"PeriodicTaskPage": {
"additionalProperties": false,
"properties": {
"items": {
"items": {
"$ref": "#/components/schemas/PeriodicTaskExecution"
},
"title": "Items",
"type": "array"
},
"next_offset": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Next Offset"
}
},
"required": [
"items",
"next_offset"
],
"title": "PeriodicTaskPage",
"type": "object"
},
"PeriodicTaskRetry": {
"additionalProperties": false,
"properties": {
"request_id": {
"format": "uuid",
"title": "Request Id",
"type": "string"
}
},
"required": [
"request_id"
],
"title": "PeriodicTaskRetry",
"type": "object"
},
"PeriodicTaskStep": {
"additionalProperties": false,
"properties": {
"detail": {
"default": "",
"title": "Detail",
"type": "string"
},
"id": {
"title": "Id",
"type": "string"
},
"status": {
"enum": [
"pending",
"running",
"completed",
"failed",
"skipped"
],
"title": "Status",
"type": "string"
},
"title": {
"title": "Title",
"type": "string"
}
},
"required": [
"id",
"title",
"status"
],
"title": "PeriodicTaskStep",
"type": "object"
},
"PlaceSearchConfig": {
"additionalProperties": false,
"properties": {
@@ -8453,6 +8749,11 @@
"title": "Rules",
"type": "array"
},
"scheduled_tasks_enabled": {
"default": false,
"title": "Scheduled Tasks Enabled",
"type": "boolean"
},
"start_time": {
"format": "date-time",
"title": "Start Time",
@@ -8766,6 +9067,22 @@
],
"title": "Monitoring Interval Seconds"
},
"periodic_error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Periodic Error"
},
"periodic_pending": {
"default": false,
"title": "Periodic Pending",
"type": "boolean"
},
"processed_count": {
"default": 0,
"title": "Processed Count",
@@ -8804,6 +9121,11 @@
"title": "Rules",
"type": "array"
},
"scheduled_tasks_enabled": {
"default": false,
"title": "Scheduled Tasks Enabled",
"type": "boolean"
},
"start_time": {
"format": "date-time",
"title": "Start Time",
@@ -43962,6 +44284,263 @@
]
}
},
"/api/v1/scada-replays/{replay_id}/scheduled-tasks": {
"get": {
"operationId": "get_scada_replays_replay_id_scheduled_tasks",
"parameters": [
{
"in": "path",
"name": "replay_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Replay Id",
"type": "string"
}
},
{
"in": "query",
"name": "offset",
"required": false,
"schema": {
"default": 0,
"minimum": 0,
"title": "Offset",
"type": "integer"
}
},
{
"in": "query",
"name": "limit",
"required": false,
"schema": {
"default": 100,
"maximum": 200,
"minimum": 1,
"title": "Limit",
"type": "integer"
}
},
{
"in": "header",
"name": "X-Project-Id",
"required": true,
"schema": {
"title": "X-Project-Id",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PeriodicTaskPage"
}
}
},
"description": "Successful Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Authentication required"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Insufficient permission"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource not found"
},
"409": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource conflict"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Validation error"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Dependency unavailable"
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
],
"summary": "Scheduled Tasks",
"tags": [
"SCADA Replay"
]
}
},
"/api/v1/scada-replays/{replay_id}/scheduled-tasks/{execution_id}/retry": {
"post": {
"operationId": "post_scada_replays_replay_id_scheduled_tasks_execution_id_retry",
"parameters": [
{
"in": "path",
"name": "replay_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Replay Id",
"type": "string"
}
},
{
"in": "path",
"name": "execution_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Execution Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Project-Id",
"required": true,
"schema": {
"title": "X-Project-Id",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PeriodicTaskRetry"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PeriodicTaskExecution"
}
}
},
"description": "Successful Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Authentication required"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Insufficient permission"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource not found"
},
"409": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Resource conflict"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Validation error"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "Dependency unavailable"
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
],
"summary": "Retry Scheduled Task",
"tags": [
"SCADA Replay"
]
}
},
"/api/v1/sensor-placement-candidates/{node_id}": {
"get": {
"operationId": "get_sensor_placement_candidates_node_id",