42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from uuid import UUID
|
||
|
|
|
||
|
|
from pydantic import Field
|
||
|
|
|
||
|
|
from .common import ApiEnvelope, JsonObject, RouteContract, SchemaModel
|
||
|
|
|
||
|
|
HTTP_METHOD = 'POST'
|
||
|
|
ROUTE_PATH = '/api/crop-simulation/yield-prediction/'
|
||
|
|
|
||
|
|
|
||
|
|
class CropSimulationYieldPredictionRequest(SchemaModel):
|
||
|
|
farm_uuid: UUID
|
||
|
|
plant_name: str | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class CropSimulationYieldPredictionResponseData(SchemaModel):
|
||
|
|
farm_uuid: str
|
||
|
|
plant_name: str | None = None
|
||
|
|
predictedYieldTons: float | None = None
|
||
|
|
predictedYieldRaw: float | None = None
|
||
|
|
unit: str | None = None
|
||
|
|
sourceUnit: str | None = None
|
||
|
|
simulationEngine: str | None = None
|
||
|
|
simulationModel: str | None = None
|
||
|
|
scenarioId: int | None = None
|
||
|
|
simulationWarning: str | None = None
|
||
|
|
supportingMetrics: JsonObject = Field(default_factory=dict)
|
||
|
|
|
||
|
|
|
||
|
|
class CropSimulationYieldPredictionResponse(ApiEnvelope[CropSimulationYieldPredictionResponseData]):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
CONTRACT = RouteContract(
|
||
|
|
method=HTTP_METHOD,
|
||
|
|
path=ROUTE_PATH,
|
||
|
|
request_model=CropSimulationYieldPredictionRequest.__name__,
|
||
|
|
response_model=CropSimulationYieldPredictionResponse.__name__,
|
||
|
|
)
|