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
+10 -1
View File
@@ -5,7 +5,14 @@ from django.apps import apps
from farm_data.models import SensorData
class WaterStressService:
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 | None = None,
fertilization_recommendation: dict | None = None,
) -> dict[str, Any]:
sensor = SensorData.objects.filter(farm_uuid=farm_uuid).first()
if sensor is None:
raise ValueError("Farm not found.")
@@ -14,6 +21,8 @@ class WaterStressService:
return simulation_service.get_water_stress(
farm_uuid=str(sensor.farm_uuid),
plant_name=plant_name,
irrigation_recommendation=irrigation_recommendation,
fertilization_recommendation=fertilization_recommendation,
)
except Exception as exc:
raise RuntimeError(