Skip to content

About

Profit-based crop market comparison for Karnataka farmers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FarmProfit AI

FarmProfit AI helps farmers decide where and when to sell produce by comparing market prices, transportation costs, and other selling costs, then recommending the option with the highest expected net return.

This repository currently contains the project foundation only: folder layout, a FastAPI health check, and a minimal React + Vite + Tailwind frontend. Business logic, market integrations, and UI are not implemented yet.

Architecture

Farmer Input
    → Market Data Layer
    → Data Validation
    → Profit Calculation Engine
    → Recommendation Engine
    → Explanation + Confidence
    → Farmer

Layers stay separate on purpose:

Layer Location Role
API backend/api/ HTTP endpoints for farmer input and results
Core backend/core/ Shared config and validation
Models backend/models/ Domain and data shapes
Services backend/services/ Market data, costs, profit calculation
Recommendation backend/recommendation/ Explainable ranking of selling options
ML backend/ml/ Optional forecasting; not required for MVP recommendations
Data backend/data/ and data/ Validated market data and fallbacks

Design principles

  1. Recommendations must stay explainable.
  2. Market data and API responses are never invented.
  3. Market data, profit calculation, recommendation logic, and ML stay in separate modules.
  4. ML/forecasting is optional. The basic engine must work without it.
  5. If an external market-data source fails, the system should fall back to the latest validated data.
  6. Keep the MVP small. Docker and extra services come later.

Tech stack

  • Frontend: React, Vite, Tailwind CSS
  • Backend: Python, FastAPI
  • Database: PostgreSQL (not wired up yet)
  • AI/ML (later): Pandas, NumPy, scikit-learn
  • Version control: Git

Project structure

FarmProfitAI/
├── frontend/          # React + Vite + Tailwind
├── backend/           # FastAPI application
│   ├── api/
│   ├── core/
│   ├── models/
│   ├── services/
│   ├── recommendation/
│   ├── ml/
│   └── data/
├── data/              # Shared/validated data (no mock market feeds)
├── docs/
├── .gitignore
└── README.md

Run the backend

From the repository root:

cd backend
python -m venv .venv

Windows:

.venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload

macOS / Linux:

source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload

Health check: http://127.0.0.1:8000/health Market data: http://127.0.0.1:8000/markets Interactive docs: http://127.0.0.1:8000/docs

Manual market comparison

The hackathon MVP does not perform road routing or automatic market discovery. After choosing a crop, district, and farm location, select one or more available market-price records from the market dropdown. Each market keeps its own provider-backed price and date.

Transport quotes are optional. Enter a quote when it is known to compare net profit after transport. If no quote is supplied, the market remains visible but the comparison is marked incomplete; unknown transport is never treated as zero, and no distance is fabricated.

Run the frontend

cd frontend
npm install
npm run dev

The Vite app is a placeholder so the toolchain can start. There is no farmer UI yet.

About

Profit-based crop market comparison for Karnataka farmers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages