This commit is contained in:
2026-04-27 03:12:33 +03:30
commit 78acb5510d
17 changed files with 749 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
from __future__ import annotations
from uuid import UUID
from pydantic import Field
from .common import ApiEnvelope, JsonList, RouteContract, SchemaModel
HTTP_METHOD = 'POST'
ROUTE_PATH = '/api/weather/water-need-prediction/'
class WeatherWaterNeedPredictionRequest(SchemaModel):
farm_uuid: UUID
class WaterNeedInsight(SchemaModel):
summary: str | None = None
irrigation_outlook: str | None = None
recommended_action: str | None = None
risk_note: str | None = None
confidence: float | None = None
class WeatherWaterNeedPredictionResponseData(SchemaModel):
farm_uuid: str
totalNext7Days: float | None = None
unit: str | None = None
categories: list[str] = Field(default_factory=list)
series: JsonList = Field(default_factory=list)
dailyBreakdown: JsonList = Field(default_factory=list)
insight: WaterNeedInsight = Field(default_factory=WaterNeedInsight)
knowledge_base: str | None = None
raw_response: str | None = None
class WeatherWaterNeedPredictionResponse(ApiEnvelope[WeatherWaterNeedPredictionResponseData]):
pass
CONTRACT = RouteContract(
method=HTTP_METHOD,
path=ROUTE_PATH,
request_model=WeatherWaterNeedPredictionRequest.__name__,
response_model=WeatherWaterNeedPredictionResponse.__name__,
)