FarmFlo Simulation Studio: Smart Irrigation Scheduling for Virtual UK Farms

FarmFlo Simulation Studio: Smart Irrigation Scheduling for Virtual UK Farms

WebMachine LearningAI Agent2026ReactViteTailwind CSSReact RouterRechartsLeafletNode.jsExpressMongoDBMongooseJWTPythonFastAPIscikit-learnXGBoostTensorFlowKerasSciPyNumPypandasGoogle Agent Development KitGemini APIOpen-Meteo APINASA POWERCOSMOS UKVitestPytest

Client

Erabes

Year

2026

Tech stack

React, Vite, Tailwind CSS, React Router, Recharts, Leaflet, Node.js, Express, MongoDB, Mongoose, JWT, Python, FastAPI, scikit-learn, XGBoost, TensorFlow, Keras, SciPy, NumPy, pandas, Google Agent Development Kit, Gemini API, Open-Meteo API, NASA POWER, COSMOS UK, Vitest, Pytest

About

FarmFlo turns a plain language description of a farm into a calibrated soil and weather simulation, a machine learning soil moisture forecast, and an optimised irrigation schedule that is explained in plain English and checked against the real numbers before you see it.

The Problem

On a lot of farms, deciding when to irrigate and how much water to use is still guesswork. Watering too early or too much wastes water, energy, and money, and it can hurt the crop. Watering too late stresses the crop and cuts the yield. The information that would help, like soil moisture readings, weather history, and forecasts, is spread across different sources and hard to turn into a clear plan. Most tools that try to solve this need sensors buried in the field, spreadsheets, or technical setup that a normal grower does not have time for. And when a model does spit out a number, it usually does not explain itself, so it is hard to trust and hard to act on with confidence.

What I Built

FarmFlo Simulation Studio is a full web application that lets someone describe a farm in a single sentence and get back a complete irrigation plan they can actually use. It runs as three services working together: a React dashboard, a Node and Express API with MongoDB and user accounts, and a Python FastAPI service that handles the simulation, the machine learning prediction, the optimisation engine, and the language layer. Every plan is grounded in real public UK data, and every plan comes with a plain language explanation that is fact checked against the real numbers before it reaches the user.

Key Features

Describe a farm in plain language and let the language layer suggest soil type, land cover, a name, and a location label for you to review

Interactive map and address search to pin the exact farm location

Calibrated soil and weather simulation built from COSMOS UK soil moisture data, NASA POWER, and Open-Meteo records

Soil moisture forecasting with three trained models, Random Forest, XGBoost, and an LSTM network, compared side by side

Model metrics table so you can see which model is most accurate and why it was picked

Optimisation based irrigation scheduler that finds the smallest amount of water that keeps the soil above a safe moisture floor every day

Three baseline strategies, fixed interval, threshold based, and linear programme, shown next to the optimised plan for an honest comparison

Planning horizons of 3, 7, or 14 days

Plain language explanation of each schedule, written by Gemini through Google's Agent Development Kit

Guardrail check that rejects any explanation that does not match the real numbers and falls back to a safe template sentence instead

Live weather forecast pulled from Open-Meteo for the planning window

History page showing every past farm, simulation, prediction, and schedule tied to your account

One click PDF download of any generated schedule

Charts for soil moisture over time, predicted values against actual values, and daily irrigation amounts

Project Details

How it works

  1. You create an account and add a farm. You can type something like "A 20 hectare arable wheat farm near Norwich on heavy clay soil" and the language layer fills in the soil type, land cover, and a location label for you. Nothing is saved until you confirm it. You set the exact spot with a map picker and an address search.
  2. As soon as the farm exists, the backend asks the Python service to build a calibrated simulation for that location. The simulation is a water balance model tuned against real COSMOS UK soil moisture sites, with weather drawn from NASA POWER and Open-Meteo, so the starting conditions reflect observed reality rather than invented numbers.
  3. The Python service then predicts soil moisture over time using three models, a Random Forest, an XGBoost model, and an LSTM network. All three run on the same data and are compared, and the most accurate one drives the schedule. The dashboard shows the comparison and the accuracy metrics.
  4. On the Schedule page you pick a farm and a horizon of 3, 7, or 14 days and generate a plan. The decision engine pulls a live weather forecast for that window and solves a constrained optimisation problem with SciPy: find the daily watering amounts that use the least total water while keeping predicted soil moisture above a safe floor on every day of the plan. It also runs the three simpler baseline strategies so you can see how much water the optimised plan saves.
  5. The finished plan is sent to the language layer, which uses Gemini to write a short plain language explanation of what to do and why. Before you see it, a guardrail step re checks that explanation against the real numbers in the plan. If it does not line up, or the language service is unreachable, FarmFlo shows a plain template sentence built straight from the same numbers. The numeric plan is never blocked by the explanation failing.
  6. You can download the schedule as a PDF, and the History page keeps every farm, simulation, prediction, and schedule connected to your account.

What it needs to run

  • Node.js and Python installed locally
  • A MongoDB connection string, with the MongoDB Atlas free tier being enough
  • A Gemini API key for the language layer
  • Internet access when generating a schedule, because it calls the Open-Meteo forecast API and the Gemini API. Running the models on their own works offline.
  • Three services running at the same time: the frontend on port 5173, the backend on 5000, and the Python service on 8000. The frontend only talks to the backend, and only the backend talks to the Python service.

Summary

FarmFlo Simulation Studio shows a complete path from a plain sentence to a plan a grower can trust. It brings together a real calibrated simulation, a fair comparison of three machine learning models, a proper optimisation engine with baselines to measure it against, and a generative AI explanation that is fact checked instead of trusted blindly. The end result is an irrigation plan a person can read, question, and act on, with no sensors, no spreadsheets, and no data science background needed.

Screenshots

The Result

  • A working three service application that goes from a one sentence farm description to a complete, explained irrigation schedule in a few minutes.
  • Soil moisture prediction accuracy of about 0.97 R squared, with a mean absolute error of roughly 2 points of volumetric water content, across the Random Forest and XGBoost models, and the LSTM close behind.
  • The optimisation engine consistently uses less water than the fixed interval and threshold baselines while keeping soil moisture above the safety floor on every day of the plan.
  • Every explanation shown to a user has passed a guardrail check against the real numbers, so the plain language never contradicts the plan.
  • Full automated test coverage for the backend and the Python service that runs offline, so the core logic can be verified without touching real APIs or a real database.
  • Results stay grounded in real public data sources, COSMOS UK, NASA POWER, and Open-Meteo, rather than synthetic assumptions.