fix: enforce SCADA chart device coverage
This commit is contained in:
@@ -320,6 +320,7 @@ class InvestigationReport(StrictModel):
|
||||
data_gaps: list[InvestigationDataGap] | None = None
|
||||
diagram: InvestigationDiagram | None = None
|
||||
ui_blocks: list["ReportUiBlock"] = Field(default_factory=list, max_length=8)
|
||||
scada_device_ids: list[TaskFeatureId] | None = Field(default=None, max_length=1000)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_result(self):
|
||||
@@ -742,8 +743,27 @@ class AgentArtifactsResult(StrictModel):
|
||||
progress_revision: PositiveInt | None = None
|
||||
|
||||
|
||||
class ScadaChartGap(StrictModel):
|
||||
device_id: TaskFeatureId
|
||||
day_offset: Annotated[int, Field(ge=0, le=7)]
|
||||
missing_count: Annotated[int, Field(ge=1, le=100)]
|
||||
reason: Literal["no_readings", "outside_frozen_scope", "outside_frozen_window", "no_scheduled_samples"]
|
||||
|
||||
|
||||
class ScadaChartContext(StrictModel):
|
||||
role: Literal["current", "comparison"]
|
||||
metric: Literal["pressure", "flow"]
|
||||
unit: Annotated[str, Field(min_length=1, max_length=128)]
|
||||
window_start: WorkbenchDateTime
|
||||
window_end: WorkbenchDateTime
|
||||
value_field: Literal["monitored_value", "cleaned_value"] = "monitored_value"
|
||||
gaps: list[ScadaChartGap] = Field(default_factory=list, max_length=8)
|
||||
|
||||
|
||||
class TaskSafeChartSeries(StrictModel):
|
||||
name: Annotated[str, Field(max_length=128)]
|
||||
device_id: TaskFeatureId | None = None
|
||||
day_offset: Annotated[int, Field(ge=0, le=7)] | None = None
|
||||
type: Literal["line", "bar", "scatter"] | None = None
|
||||
data: Annotated[list[Annotated[float, Field(strict=True, allow_inf_nan=False)] | None], Field(min_length=1, max_length=100)]
|
||||
sample_times: Annotated[list[Annotated[str, Field(
|
||||
@@ -770,6 +790,7 @@ class TaskSafeChartSeries(StrictModel):
|
||||
|
||||
class TaskSafeChart(StrictModel):
|
||||
title: Annotated[str, Field(max_length=200)]
|
||||
scada: ScadaChartContext | None = None
|
||||
chart_type: Literal["line", "bar", "time_comparison"]
|
||||
x_axis_name: Annotated[str, Field(max_length=128)] | None = None
|
||||
y_axis_name: Annotated[str, Field(max_length=128)] | None = None
|
||||
|
||||
Reference in New Issue
Block a user