How rajshekharbind/smart-agriculture-query-and-advisory-system works
AgroSathi AI is a mobile-first agricultural assistance platform. Farmers use its React interface to access advisory chat, voice, document Q&A, and farm-planning tools; the interface calls a FastAPI backend that routes requests to ML, language-model, retrieval, and persistent-data services. The README also documents disease, soil, crop/seed, pest, weather, market, schemes, and community capabilities, represented here as capability areas. Some page and router implementations were not sampled, so their internal call paths are not asserted.
Main entry points: main.py FastAPI entry · llm.py LLM wrapper · App.jsx App shell · auth.py Authentication
Components 22
Farmer interface
- App shell
frontend/src/App.jsx - Farm pages
frontend/src/pages - Chat page
frontend/src/pages/ChatPage.jsx - Chat state
frontend/src/context/ChatContext.jsx - Document state
frontend/src/context/DocumentContext.jsx - API services
frontend/src/services - HTTP client
frontend/src/services/api.js
API and identity
- FastAPI entry
backend/app/main.py - Authentication
backend/app/routers/auth.py - Security controls
backend/app/security.py
AI and retrieval
- ML services
backend/app/models/ml_services.py - Disease prediction
backend/app/models/prediction.py - LLM wrapper
backend/app/llm.py - Document extraction
backend/app/rag/document_processor.py - RAG search
backend/app/rag/local_faiss.py
Farm capabilities
- Agriculture routes
backend/app/routers/agri_info.py - AI tool routes
backend/app/routers/ai_tools.py - Farm operations
backend/app/routers/farm_ops.py - Document and voice
backend/app/routers/documents_voice.py - Chat, weather, markets, schemes, calendar, profit, guides, community
frontend/src/pages
Persistent state
- Application database
backend/app/database.py
Other components
- Farmer
Connections 26
- Farmer → App shell: uses
- App shell → Farm pages: displays
frontend/src/App.jsx - App shell → HTTP client: checks health
frontend/src/App.jsx - Chat page → Chat state: uses state
frontend/src/pages/ChatPage.jsx - Chat state → API services: requests chat
frontend/src/context/ChatContext.jsx - Document state → API services: requests documents
frontend/src/context/DocumentContext.jsx - API services → HTTP client: sends requests
frontend/src/services/agriService.js - HTTP client → FastAPI entry: calls API
frontend/src/services/api.js - FastAPI entry → Authentication: registers router
backend/app/main.py - FastAPI entry → Agriculture routes: registers router
backend/app/main.py - FastAPI entry → AI tool routes: registers router
backend/app/main.py - FastAPI entry → Farm operations: registers router
backend/app/main.py - FastAPI entry → Document and voice: registers router
backend/app/main.py - Authentication → Application database: reads and writes
backend/app/routers/auth.py - Authentication → Security controls: authenticates
backend/app/routers/auth.py - Agriculture routes → LLM wrapper: requests guidance
backend/app/routers/agri_info.py - AI tool routes → ML services: invokes models
backend/app/routers/ai_tools.py - AI tool routes → Security controls: validates uploads
backend/app/routers/ai_tools.py - Document and voice → RAG search: uses retrieval
backend/app/routers/documents_voice.py - Document and voice → Security controls: validates uploads
backend/app/routers/documents_voice.py - Farm operations → Application database: reads and writes
backend/app/routers/farm_ops.py - ML services → LLM wrapper: generates advice
backend/app/models/ml_services.py - Disease prediction → LLM wrapper: uses vision advice
backend/app/models/prediction.py - RAG search → LLM wrapper: answers with context
backend/app/rag/local_faiss.py - Document extraction → RAG search: prepares documents
- Farmer → Chat, weather, markets, schemes, calendar, profit, guides, community: uses