Team Name: Sadhguna
Problem Statement ID: SIH252XX
Theme: Agriculture, FoodTech & Rural Development
AgniSutra is an AI-enabled platform designed to empower oilseed farmers with real-time yield forecasts, personalized advisories, and data-driven insights. By integrating machine learning, weather data, satellite imagery, and IoT sensor networks, AgniSutra aims to optimize crop yields, reduce import dependency, and stabilize farmer income.
- Yield Prediction Engine: AI models (Linear Regression/XGBoost) to forecast crop yield based on soil nutrients, rainfall, and temperature.
- Real-Time IoT Monitoring: Ingests data from soil moisture sensors to track farm health.
- Smart Alerts: Real-time WebSocket alerts for critical conditions (e.g., low soil moisture).
- Personalized Advisory: Recommendations for irrigation and resource management.
- Admin Dashboard: Aggregated view of total farms, users, and yield statistics with geospatial visualization.
- Secure Authentication: JWT-based secure login and registration for farmers and administrators.
- Framework: Next.js (React)
- Styling: Tailwind CSS
- Language: TypeScript
- Framework: FastAPI (Python)
- Database: PostgreSQL (via SQLAlchemy)
- ML Libraries: Scikit-learn, NumPy, Pandas
- Real-Time: WebSockets
- Authentication: OAuth2 with JWT (Passlib, Python-Jose)
- Simulation: Python-based IoT simulator
- Data Sources: User inputs, Simulated Sensors (extensible to IMD/ISRO APIs)
agnisutra/
├── backend/ # FastAPI Backend
│ ├── app/
│ │ ├── routers/ # API Endpoints (Auth, IoT, Yield, Admin)
│ │ ├── models.py # SQLAlchemy Database Models
│ │ ├── schemas.py # Pydantic Data Schemas
│ │ ├── database.py # DB Connection (PostgreSQL)
│ │ ├── main.py # App Entrypoint & WebSocket Manager
│ │ ├── manager.py # WebSocket Connection Manager
│ │ └── ml.py # ML Model Loader
│ ├── requirements.txt # Python Dependencies
│ ├── simulator.py # IoT Sensor Simulator
│ └── .env # Environment Variables
│
├── frontend/ # Next.js Frontend
│ ├── app/ # App Router Pages
│ ├── public/ # Static Assets
│ └── package.json # Node Dependencies
│
└── README.md # Project Documentation
- Python 3.9+
- Node.js 18+ & pnpm
- PostgreSQL (Running locally or via Docker)
Ensure PostgreSQL is running and create a database named agnisutra.
CREATE DATABASE agnisutra;Navigate to the backend directory:
cd backendCreate and activate a virtual environment:
# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtConfigure Environment Variables:
Create a .env file in backend/ (or edit the existing one) and set your DB credentials:
DATABASE_URL=postgresql://postgres:password@localhost:5432/agnisutra
SECRET_KEY=your_secret_keyRun the Server:
uvicorn app.main:app --reloadThe API will be available at http://127.0.0.1:8000
Navigate to the frontend directory:
cd frontendInstall dependencies:
pnpm installRun the development server:
pnpm devThe app will be available at http://localhost:3000
Visit http://127.0.0.1:8000/docs to explore and test all API endpoints interactively.
To simulate live sensor data flowing into the system:
- Ensure the backend is running.
- Open a new terminal in
backend/. - Run the simulator:
python simulator.py
- Observe real-time logs in the backend console or connect via WebSocket to receive alerts.
The backend loads a pre-trained model (model.pkl) at startup. If not found, it falls back to a heuristic formula.
To retrain/generate the dummy model:
# Run this python one-liner in the backend directory
python -c "import pickle; from sklearn.linear_model import LinearRegression; import numpy as np; X = np.array([[100, 500, 25], [150, 600, 30]]); y = np.array([2000, 2500]); model = LinearRegression().fit(X, y); pickle.dump(model, open('app/model.pkl', 'wb'))"- Ashutosh Mishra - Lead Developer
- (Add other team members here)
Built for Smart India Hackathon 2025