Inspiration

Watching smallholder farmers lose harvests to surprise downpours or mid-season heat waves inspired Farmers_app. I wanted a guide that turns complex forecasts into plain advice a farmer can act on each morning.

What it does

Farmers_app pulls real-time and historical weather from the free Open-Meteo API, extracts agronomic indicators (low rainfall, heat stress, heavy rain alerts), and feeds the summary into Google Gemini. The frontend (React + Vite) shows: A locality form with defaults for quick checks. Snapshot cards for temperature, rainfall, and min/max ranges. Visual gauges for current temperature within the daily band and rainfall progress toward a 10 mm target. AI-generated action items displayed as friendly bullet points.

How we built it

Backend: FastAPI service with async httpx calls, Pydantic models, and a Gemini client. Settings are managed via pydantic-settings and .env files. Tests use pytest, pytest-asyncio, and respx to simulate Open-Meteo responses. Analytics: Lightweight heuristics flag conditions like low rainfall or heat stress. These indicators are merged into the Gemini prompt to ground AI responses in real data. Frontend: React + TypeScript + Vite. Components render snapshot stats, custom visual cards, and AI guidance. Styling is pure CSS. Vitest + Testing Library cover UI behavior. Tooling: Editable pip install (pip install -e .[dev,ai]), ESLint 9, Vitest, and scripts documented in the README.

Challenges we ran into

Handling Gemini model availability (e.g., temporary 404s for gemini-1.5-flash) required resilient fallback messaging. Balancing depth with clarity: it was tempting to add dozens of agronomic metrics, but we trimmed to a beginner-friendly set. Coordinating async tests and HTTP mocks so they remained deterministic across different environments.

Accomplishments that we're proud of

Delivering meaningful guidance even without a Gemini key—thanks to heuristic fallback text—while seamlessly upgrading to AI-enhanced insights when a key is supplied. Implementing visual cues (temperature bar, rainfall gauge) that help non-technical users interpret the forecast quickly. Achieving green runs for both backend (pytest) and frontend (npm run test -- --run, npm run lint) pipelines.

What we learned

Prompt structure drastically affects Gemini’s output; agronomy-specific context leads to more actionable recommendations. Farmers value clarity over quantity. A few well-crafted insights outperform raw data dumps. Building tests around third-party APIs early prevents regression headaches when integrating AI or remote services later.

What's next for Farmers_app

Add historical trend charts and yield-risk heuristics when more data becomes available. Introduce multilingual support and unit toggles for regions using Fahrenheit or inches. Integrate push channels (SMS/WhatsApp) so advisories reach farmers without constant dashboard checks. Explore automated irrigation recommendations by combining soil moisture sensors with the existing weather insights.

Built With

  • css-backend-frameworks:-fastapi
  • dotenv
  • eslint-9
  • for
  • httpx-(async-client)
  • open-meteo-weather-api-testing:-pytest
  • pip-editable-installs
  • pydantic-settings
  • pytest-asyncio
  • respx-(http-mocks)
  • tech-stack-languages:-python-3.13
  • typescript
  • uvicorn-frontend-frameworks-&-tooling:-react-18
  • vite
  • vitest-+-testing-library-ai-&-apis:-google-gemini-(generative-ai-sdk)
  • vitest-tooling-&-config:-npm
Share this project:

Updates