Farm AI Assistant

Farm AI Assistant is a AI-powered dairy farm operations agent that turns raw milk-recording CSV exports into a morning decision plan. The goal is simple: help a farmer answer three questions quickly:

  1. Which cows need attention?
  2. What is the main farm bottleneck?
  3. What should be done next?

## Inspiration

The inspiration came from a practical problem in dairy operations: farms often have valuable cow-level data, but the data lives in exported spreadsheets and is hard to turn into daily action. A farmer does not need another generic chatbot first thing in the morning. They need a short, evidence-backed work plan that highlights cows needing attention, explains why, and lets the farmer stay in control.

## What It Does

The app imports converted cow CSV files, normalizes German milk-recording columns, stores observations in Supabase/PostgreSQL, and runs deterministic analysis to calculate cow-level signals such as expected milk, milk gap, rolling averages, SCC risk, protein trend, estimated daily margin, and recoverable loss.

A simplified version of the margin logic is:

$$ \text{estimated daily margin} = \text{milk revenue} - \text{estimated feed cost} $$

The system then generates prioritized tasks from deterministic findings. Qwen is used only after that step: it explains the evidence in concise farmer-facing language, generates a morning briefing, and uses stored farm memory so prior farmer decisions can influence future briefings.

The core architecture rule is:

Rules decide. Qwen explains.

## How I Built It

I built the backend with FastAPI and Poetry, the frontend with Vue/Vite, and persistence with Supabase Auth plus Supabase PostgreSQL. The frontend talks only to the FastAPI backend, so Supabase secrets and data access stay server-side.

The workflow is:

  1. Import raw cow CSV data.
  2. Normalize source columns into stable internal fields.
  3. Persist observations with deduplication and overwrite-on-reimport behavior.
  4. Run deterministic analysis synchronously after import.
  5. Generate persisted assistant tasks from findings.
  6. Let the farmer complete or dismiss tasks with structured reasons.
  7. Store meaningful farmer decisions as farm/cow memory.
  8. Use Qwen to generate briefings and explanations from the deterministic evidence.

## What I Learned

I learned that the strongest AI product here is not a chatbot, but a controlled workflow. The valuable part is combining deterministic farm logic with an LLM explanation layer. Qwen is most useful when it turns structured evidence into a clear morning plan, not when it invents diagnoses or decides priorities.

I also learned how important data boundaries are. Milk-recording exports are not complete daily farm data, so the system must be cautious: missing data should create monitoring notes or data-quality warnings, not confident recommendations.

## Challenges

The hardest challenge was keeping the workflow reliable end to end. CSV import, normalization, analysis, task generation, and AI explanation all needed clear boundaries. I had to make sure imports triggered deterministic analysis and task generation, but did not call the LLM automatically.

Another challenge was designing safe AI behavior. The app must avoid clinical diagnosis unless the data supports it, so it uses language like “mastitis risk” or “udder-health alert.” The LLM receives only selected evidence and must explain, not create new facts.

Finally, making the dashboard useful was a product challenge. The first screen needed to feel like a real morning operating surface: top cows needing attention, recoverable loss, bottleneck summary, task status, and short Qwen briefing, with evidence available when the farmer wants more detail.

## Impact

Farm AI Assistant helps convert existing farm data into practical daily action. It gives farmers a faster way to identify cows needing attention, estimate recoverable loss, understand bottlenecks, and review tasks while keeping human judgment in the loop.

Built With

  • fastapi
  • openai-compatible-api
  • poetry
  • pytest
  • python-3.10
  • qwen-cloud
  • ruff
  • supabase-auth
  • supabase-postgresql
  • vite
  • vue.js
Share this project:

Updates

Submission history