How keerthipandala/smartfarmerassistant works
Smart Farmer Assistant is an agricultural decision-support web app. A farmer uses the React pages to submit crop, fertilizer, yield, or weather requests; the FastAPI backend authenticates protected requests, computes predictions or retrieves weather, and returns results. Crop and fertilizer predictions, yield predictions, and account records are persisted for dashboard/history use. The README documents the broader feature set; source excerpts directly show crop/fertilizer, authentication, and persistence paths, while some page-to-endpoint wiring is documented rather than excerpted.
Main entry points: main.py FastAPI endpoints · App.js React app routing · auth.py Account operations · Crop.jsx Crop recommendation
Components 21
Farmer interface
- React app routing
frontend/src/App.js - Crop recommendation
frontend/src/pages/Crop.jsx - Fertilizer recommendation
frontend/src/pages/Fertilizer.jsx - Yield prediction
frontend/src/pages/Yield.jsx - Weather lookup
frontend/src/pages/Weather.jsx - Dashboard summary
frontend/src/pages/Dashboard.jsx - Prediction history
frontend/src/pages/History.jsx
Prediction and API
- FastAPI endpoints
backend/main.py - Crop inference
backend/routes/crop.py - Fertilizer inference
backend/routes/fertilizer.py - Yield inference
backend/main.py - Weather retrieval
backend/routes/weather.py
Identity and access
- Account operations
backend/routes/auth.py - Token verification
backend/jwt_handler.py - Password security
backend/security.py
Persistence
- Database sessions
backend/database.py - Users and predictions
backend/models.py
External services
- Trained ML models
- PostgreSQL
- Weather API
Other components
- Farmer
Connections 29
- Farmer → React app routing: uses
- React app routing → Crop recommendation: routes to
frontend/src/App.js - React app routing → Fertilizer recommendation: routes to
frontend/src/App.js - React app routing → Yield prediction: routes to
frontend/src/App.js - React app routing → Weather lookup: routes to
frontend/src/App.js - React app routing → Dashboard summary: routes to
frontend/src/App.js - React app routing → Prediction history: routes to
frontend/src/App.js - Crop recommendation → FastAPI endpoints: posts request
frontend/src/pages/Crop.jsx - Fertilizer recommendation → FastAPI endpoints: requests prediction
- Yield prediction → FastAPI endpoints: requests prediction
- Weather lookup → FastAPI endpoints: requests weather
- Dashboard summary → FastAPI endpoints: requests summary
- Prediction history → FastAPI endpoints: requests records
- FastAPI endpoints → Crop inference: calls
backend/main.py - FastAPI endpoints → Fertilizer inference: calls
backend/main.py - FastAPI endpoints → Yield inference: predicts
backend/main.py - FastAPI endpoints → Weather retrieval: calls
backend/main.py - FastAPI endpoints → Account operations: calls
backend/main.py - FastAPI endpoints → Token verification: verifies token
backend/main.py - Account operations → Password security: hashes passwords
backend/routes/auth.py - Account operations → Token verification: creates token
backend/routes/auth.py - FastAPI endpoints → Database sessions: opens sessions
backend/main.py - FastAPI endpoints → Users and predictions: reads and writes
backend/main.py - Account operations → Users and predictions: stores accounts
backend/routes/auth.py - Database sessions → PostgreSQL: connects
backend/database.py - Crop inference → Trained ML models: uses model
- Fertilizer inference → Trained ML models: loads model
backend/routes/fertilizer.py - Yield inference → Trained ML models: loads model
backend/main.py - Weather retrieval → Weather API: retrieves weather