This commit is contained in:
2026-05-02 14:03:48 +03:30
parent f704e1188c
commit ef593153ba
14 changed files with 1286 additions and 18 deletions
+13 -2
View File
@@ -103,7 +103,14 @@ class WaterStressSimulationService:
raise GrowthSimulationError("Plant not found for the selected farm.")
return plant.name
def get_water_stress(self, *, farm_uuid: str, plant_name: str | None = None) -> dict[str, Any]:
def get_water_stress(
self,
*,
farm_uuid: str,
plant_name: str | None = None,
irrigation_recommendation: dict[str, Any] | None = None,
fertilization_recommendation: dict[str, Any] | None = None,
) -> dict[str, Any]:
resolved_plant_name = self._resolve_plant_name(farm_uuid=farm_uuid, plant_name=plant_name)
context = build_growth_context(
{
@@ -111,7 +118,11 @@ class WaterStressSimulationService:
"plant_name": resolved_plant_name,
}
)
simulation_result, _scenario_id, simulation_warning = _run_simulation(context)
simulation_result, _scenario_id, simulation_warning = _run_simulation(
context,
irrigation_recommendation=irrigation_recommendation,
fertilization_recommendation=fertilization_recommendation,
)
daily_output = simulation_result.get("daily_output") or []
if not daily_output:
raise GrowthSimulationError("Water stress simulation produced no daily output.")