UPDATE
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from .common import ApiEnvelope, JsonObject, JsonValue, JsonList, RouteContract, SchemaModel
|
||||
|
||||
HTTP_METHOD = 'GET'
|
||||
ROUTE_PATH = '/api/crop-simulation/growth/<task_id>/status/'
|
||||
|
||||
|
||||
class CropSimulationGrowthStatusRequest(SchemaModel):
|
||||
task_id: str
|
||||
page: int | None = Field(default=None, ge=1)
|
||||
page_size: int | None = Field(default=None, ge=1)
|
||||
|
||||
|
||||
class CropSimulationPagination(SchemaModel):
|
||||
page: int
|
||||
page_size: int
|
||||
total_items: int
|
||||
total_pages: int
|
||||
has_next: bool
|
||||
has_previous: bool
|
||||
|
||||
|
||||
class CropSimulationGrowthResult(SchemaModel):
|
||||
plant_name: str | None = None
|
||||
dynamic_parameters: list[str] = Field(default_factory=list)
|
||||
engine: str | None = None
|
||||
model_name: str | None = None
|
||||
scenario_id: int | None = None
|
||||
simulation_warning: str | None = None
|
||||
summary_metrics: JsonObject = Field(default_factory=dict)
|
||||
stage_timeline: JsonList = Field(default_factory=list)
|
||||
stages_page: JsonList = Field(default_factory=list)
|
||||
pagination: CropSimulationPagination | None = None
|
||||
daily_records_count: int | None = None
|
||||
default_page_size: int | None = None
|
||||
|
||||
|
||||
class CropSimulationGrowthStatusResponseData(SchemaModel):
|
||||
task_id: str
|
||||
status: str
|
||||
message: str | None = None
|
||||
progress: JsonObject = Field(default_factory=dict)
|
||||
result: CropSimulationGrowthResult | None = None
|
||||
error: str | None = None
|
||||
|
||||
|
||||
class CropSimulationGrowthStatusResponse(ApiEnvelope[CropSimulationGrowthStatusResponseData]):
|
||||
pass
|
||||
|
||||
|
||||
CONTRACT = RouteContract(
|
||||
method=HTTP_METHOD,
|
||||
path=ROUTE_PATH,
|
||||
request_model=CropSimulationGrowthStatusRequest.__name__,
|
||||
response_model=CropSimulationGrowthStatusResponse.__name__,
|
||||
)
|
||||
Reference in New Issue
Block a user