How chethu-1004/agri-mithra works
Agri Mitra is a farmer-facing agriculture API with a small JavaScript frontend. The principal workflow is an authenticated farmer submitting a crop image, receiving a disease or species assessment and recommendations, and retaining scan history. Other major branches cover accounts, farm and crop records, marketplace, weather notifications, and agricultural chat. The graph follows visible router registration and source-index references; unsampled routes and service internals are represented at module level, without asserting unshown call sequences.
Main entry points: main.py API application · models.py Domain records · disease_routes.py Disease scan routes · species_routes.py Species scan routes
Components 24
API entry and identity
- API application
backend/backend/main.py - Account routes
backend/backend/agrinetra/api/auth_routes.py - Token authorization
backend/backend/agrinetra/auth/dependencies.py
Farm and crop intelligence
- Farm and crop routes
backend/backend/agrinetra/api/farm_crop_routes.py - Disease scan routes
backend/backend/agrinetra/api/disease_routes.py - Species scan routes
backend/backend/agrinetra/api/species_routes.py - Disease predictor
backend/backend/agrinetra/disease_detection/model_loader.py - Species predictor
backend/backend/agrinetra/species_detection/predictor.py - Plant analysis
backend/backend/agrinetra/services/plant_analysis.py - Treatment recommendations
backend/backend/agrinetra/disease_detection/recommendations.py
Farmer services
- Weather notifications
backend/backend/agrinetra/api/weather_notification_routes.py - Marketplace routes
backend/backend/agrinetra/api/market_routes.py - Administration routes
backend/backend/agrinetra/api/admin_routes.py - AI routes
backend/backend/agrinetra/api/ai_routes.py - Weather service
backend/backend/agrinetra/services/weather.py
Persistence and files
- Database sessions
backend/backend/agrinetra/database/connection.py - Domain records
backend/backend/agrinetra/database/models.py - Image storage
backend/backend/agrinetra/storage/service.py
Chat and knowledge
- Chat routes
backend/backend/agrinetra/api/chat_routes.py - Farmer chat context
backend/backend/agrinetra/services/chat_context.py - Chatbot service
backend/backend/agrinetra/services/chatbot.py - Ollama chatbot
backend/backend/agrinetra/services/ollama_chatbot.py - Agriculture knowledge
backend/backend/agrinetra/services/knowledge_base.py
Other components
- Farmer
Connections 39
- Farmer → API application: uses API
backend/backend/main.py - API application → Account routes: registers router
backend/backend/main.py - API application → Farm and crop routes: registers router
backend/backend/main.py - API application → Disease scan routes: registers router
backend/backend/main.py - API application → Species scan routes: registers router
backend/backend/main.py - API application → Weather notifications: registers router
backend/backend/main.py - API application → Chat routes: registers router
backend/backend/main.py - API application → Administration routes: registers router
backend/backend/main.py - API application → Marketplace routes: registers router
backend/backend/main.py - API application → AI routes: registers router
backend/backend/main.py - Account routes → Database sessions: queries via
backend/backend/agrinetra/api/auth_routes.py - Account routes → Domain records: reads and writes
backend/backend/agrinetra/api/auth_routes.py - Account routes → Token authorization: uses token checks
backend/backend/agrinetra/api/auth_routes.py - Farm and crop routes → Database sessions: queries via
backend/backend/agrinetra/api/farm_crop_routes.py - Farm and crop routes → Domain records: reads and writes
backend/backend/agrinetra/api/farm_crop_routes.py - Disease scan routes → Database sessions: queries via
backend/backend/agrinetra/api/disease_routes.py - Disease scan routes → Domain records: stores scan
backend/backend/agrinetra/api/disease_routes.py - Disease scan routes → Image storage: saves image
backend/backend/agrinetra/api/disease_routes.py - Disease scan routes → Disease predictor: predicts image
backend/backend/agrinetra/api/disease_routes.py - Disease scan routes → Treatment recommendations: gets recommendation
backend/backend/agrinetra/api/disease_routes.py - Disease scan routes → Plant analysis: builds analysis
backend/backend/agrinetra/api/disease_routes.py - Species scan routes → Species predictor: predicts image
backend/backend/agrinetra/api/species_routes.py - Species scan routes → Disease predictor: checks disease
backend/backend/agrinetra/api/species_routes.py - Species scan routes → Plant analysis: builds analysis
backend/backend/agrinetra/api/species_routes.py - Species scan routes → Image storage: saves image
backend/backend/agrinetra/api/species_routes.py - Species scan routes → Domain records: stores scan
backend/backend/agrinetra/api/species_routes.py - Weather notifications → Weather service: gets forecasts
backend/backend/agrinetra/api/weather_notification_routes.py - Weather notifications → Domain records: reads and writes
backend/backend/agrinetra/api/weather_notification_routes.py - Marketplace routes → Domain records: reads and writes
backend/backend/agrinetra/api/market_routes.py - Administration routes → Domain records: manages records
backend/backend/agrinetra/api/admin_routes.py - Administration routes → Image storage: uses image storage
backend/backend/agrinetra/api/admin_routes.py - Chat routes → Farmer chat context: builds context
backend/backend/agrinetra/api/chat_routes.py - Chat routes → Chatbot service: requests reply
backend/backend/agrinetra/api/chat_routes.py - Chat routes → Agriculture knowledge: retrieves evidence
backend/backend/agrinetra/api/chat_routes.py - Chat routes → Domain records: reads and writes
backend/backend/agrinetra/api/chat_routes.py - Farmer chat context → Domain records: reads records
backend/backend/agrinetra/services/chat_context.py - Chatbot service → Ollama chatbot: delegates to
backend/backend/agrinetra/services/chatbot.py - Token authorization → Database sessions: checks revocation
backend/backend/agrinetra/auth/dependencies.py - Token authorization → Domain records: loads account
backend/backend/agrinetra/auth/dependencies.py