How ujjwals653/crop-advisory works
Smart Agriculture is a farm and crop management PWA with monitoring, weather alerts, crop advice, and irrigation scheduling. A farmer manages farms and crops, records observations or sensor readings, then requests advice; the backend evaluates crop, sensor, weather, and agronomic-rule data, stores advisories and irrigation events, and presents them for review and action. Weather refresh and notifications are additional capabilities. Edges are limited to relationships shown in excerpts, the source index, or README; UI-to-endpoint calls are not mapped where their implementation was not shown.
Main entry points: models.py Domain records · app.py Flask application · App.jsx App routes · advisory_engine.py Advisory engine
Components 28
Farmer PWA
- App routes
frontend/src/App.jsx - Crop monitoring
frontend/src/pages/CropMonitor.jsx - Crop advice
frontend/src/pages/CropAdvice.jsx - Irrigation
frontend/src/pages/Irrigation.jsx - Weather
frontend/src/pages/Weather.jsx - Notifications
frontend/src/pages/Notifications.jsx - Notification settings
frontend/src/pages/NotificationSettings.jsx - API client
frontend/src/lib/api.js - Authentication state
frontend/src/lib/auth.jsx
Backend API
- Flask application
backend/app.py - Authentication routes
backend/routes/auth.py - Farm routes
backend/routes/farms.py - Monitoring routes
backend/routes/monitoring.py - Weather routes
backend/routes/weather.py - Advisory routes
backend/routes/advisory.py - Irrigation routes
backend/routes/irrigation.py - Notification routes
backend/routes/notifications.py
Agriculture Services
- Advisory engine
backend/services/advisory_engine.py - Agronomic rules
backend/seed_rules.py - Irrigation service
backend/services/irrigation.py - Weather service
backend/services/weather.py - Alert evaluation
backend/services/alerts.py - System settings
backend/settings_service.py - Notification dispatcher
backend/services/notifications.py
Persistence and Delivery
- Domain records
backend/models.py - MySQL database
Other components
- Farmer
- Open-Meteo
Connections 36
- Farmer → App routes: uses
README.md - App routes → Crop monitoring: routes to
frontend/src/App.jsx - App routes → Crop advice: routes to
frontend/src/App.jsx - App routes → Irrigation: routes to
frontend/src/App.jsx - App routes → Weather: routes to
frontend/src/App.jsx - App routes → Notifications: routes to
frontend/src/App.jsx - App routes → Notification settings: routes to
frontend/src/App.jsx - Authentication state → API client: calls
frontend/src/lib/auth.jsx - Flask application → Authentication routes: registers
backend/app.py - Flask application → Farm routes: registers
backend/app.py - Flask application → Monitoring routes: registers
backend/app.py - Flask application → Weather routes: registers
backend/app.py - Flask application → Advisory routes: registers
backend/app.py - Flask application → Irrigation routes: registers
backend/app.py - Flask application → Notification routes: registers
backend/app.py - Advisory routes → Advisory engine: calls
backend/routes/advisory.py - Advisory routes → Domain records: reads and writes
backend/routes/advisory.py - Monitoring routes → Domain records: reads and writes
backend/routes/monitoring.py - Farm routes → Domain records: reads and writes
backend/routes/farms.py - Authentication routes → Domain records: reads and writes
backend/routes/auth.py - Weather routes → Weather service: calls
backend/routes/weather.py - Irrigation routes → Irrigation service: calls
backend/routes/irrigation.py - Irrigation routes → Domain records: reads and writes
backend/routes/irrigation.py - Notification routes → Domain records: reads and writes
backend/routes/notifications.py - Advisory engine → Weather service: uses weather
backend/services/advisory_engine.py - Advisory engine → Irrigation service: updates schedule
backend/services/advisory_engine.py - Advisory engine → Notification dispatcher: dispatches
backend/services/advisory_engine.py - Alert evaluation → Notification dispatcher: notifies
backend/services/alerts.py - Weather service → Alert evaluation: evaluates forecasts
backend/services/weather.py - Weather service → Open-Meteo: fetches forecast
backend/services/weather.py - Advisory engine → System settings: reads thresholds
backend/services/advisory_engine.py - Alert evaluation → System settings: reads thresholds
backend/services/alerts.py - Weather service → System settings: reads refresh interval
backend/services/weather.py - Notification dispatcher → Domain records: stores notifications
backend/services/notifications.py - Domain records → MySQL database: persists records
README.md - Agronomic rules → Domain records: seeds rules
backend/seed_rules.py