Logo Lanfrica

b100mBUG/AgriCore-Backend

Domaine:

agriculturenatural language processing

Type de record:

software
Créateur:
b10
Hôte:
FastAPI backend for AgriBot, an AI farming assistant for smallholder farmers in Kenya, with chat, weather insights, and an extension officer directory. # AgriBot: Kenya Farming Assistant API Backend for AgriBot, an AI farming assistant for smallholder farmers in Kenya and East Africa. Started out as a WhatsApp bot, now it's the FastAPI backend for a standalone Android app built with KivyMD, so there's no WhatsApp dependency anymore. ## What it does - **AI chat**. Farmers chat with an AI agricultural extension officer (powered by Gemini) that gives advice on crops, pests, diseases, and livestock, tuned to Kenyan/East African context: local crop names, common pests, agro-ecological zones, and so on. - **Weather and farming insights**. Pulls current conditions and a 7-day forecast for the farmer's location (via Open-Meteo) and generates a short farming tip based on it. - **Farmer profiles**. Lightweight, device-based identity, no phone number or login required. Farmers can optionally add their name, location, primary crop, and farm size to get more tailored advice. - **Extension officer directory**. A public directory of real extension officers by county and specialization (crops, livestock, horticulture, agroforestry), so farmers can escalate beyond the AI when needed. - **Admin analytics**. Key-protected endpoints for basic usage stats: farmer counts, message volume, active farmers in the last 7 days, and top counties. ## Tech stack - FastAPI (async Python web framework) - SQLAlchemy 2.0 (async) with aiosqlite / asyncpg. SQLite for local dev, Postgres ready for production - Google Gemini (google-genai) for chat and weather insight generation - Open-Meteo for weather (free, no key required) - Pydantic v2 / pydantic-settings for validation and environment config ## Project structure ``` app/ ├── config.py # Environment-driven settings (.env) ├── database.py # Async engine, session factory ├── schemas.py # All Pydantic request/response models ├── models/ │ ├── base.py # Shared declarative base │ ├── farmer.py # Farmer profile (device-based identity) │ ├── chat.py …