Logo Lanfrica

Joy-mel/FarmGuard-AI

Domain:

agriculture

Record type:

software
Creator:
Joy
Host:
FarmGuard-AI is a data-driven decision-support system designed to empower small-scale farmers in Kenya. By merging historical climate trends with real-time market volatility, the system provides automated alerts for drought, heat stress, and floods, alongside AI-powered price forecasts for staple crops. # FarmGuard AI 🌾 **Explore the Live Dashboard:** Click here to view the active platform ( # FarmGuard AI β€” Full Architecture ## Directory structure ``` farmguard_v2/ β”œβ”€β”€ api/ # Component 1: FastAPI backend β”‚ β”œβ”€β”€ main.py # /predict, /health, /webhook/whatsapp, /api/counties, β”‚ β”‚ # /api/predict/all, /api/history, /refresh β”‚ β”œβ”€β”€ schemas.py # Pydantic request/response models β”‚ β”œβ”€β”€ model_pipeline.py # training + prediction for all 47 counties β”‚ β”œβ”€β”€ kenya_counties.py # 47 counties: lat/lon + agro-ecological zone + soil profiles β”‚ β”œβ”€β”€ requirements.txt β”‚ └── models/ # trained .joblib bundles, one per county β”œβ”€β”€ dashboard/ # Component 2: Streamlit live dashboard β”‚ β”œβ”€β”€ app.py # dark-green themed UI, calls the API over HTTP β”‚ β”œβ”€β”€ assets/ # drop banner.png / logo.png here (optional) β”‚ └── requirements.txt β”œβ”€β”€ whatsapp/ # Component 3: WhatsApp bot logic β”‚ └── handler.py # message parsing + reply building, provider-agnostic β”œβ”€β”€ Dockerfile.api β”œβ”€β”€ Dockerfile.dashboard └── README.md (this file) ``` The three components are genuinely separable: `dashboard/app.py` only ever talks to the API over HTTP (never imports model code directly), and `whatsapp/handler.py` contains pure message-in/reply-out logic with no Twilio-specific code, so swapping to Meta's WhatsApp Cloud API directly later only touches `api/main.py`'s webhook glue, not the bot's brain. ## All 47 Kenyan counties `api/kenya_counties.py` lists every county with a centroid lat/lon and one of 7 agro-ecological zones (central highlands, lake basin, rift valley, eastern semi-arid, coast, arid north, southern rangelands). Soil profiles are assigned per zone, not per county β€” that's a genuine simplification, documented in that file, and the honest reason two counties in the same zone show the same soil type. Swap `ZONE …