How shreyanshfs/fasalrakshak-ai-powered-crop-loss-evidence-verification-system works
FasalRakshak collects geotagged crop-loss claims, stores evidence, correlates images and weather, and presents confidence signals for official review. The primary path is farmer submission (including offline capture and later sync) through the reports API, followed by asynchronous AI assessment and review in the dashboard. The README also documents exports, certificates, and proactive weather monitoring. Edges reflect the supplied excerpts, SOURCE INDEX references, or README; unsampled integrations are not asserted as confirmed calls.
Main entry points: main.py FastAPI Runtime · ai_pipeline.py AI Assessment Pipeline · reports.py Claims API · api.ts Frontend API Client
Components 25
Farmer and Inspector Experience
- Farmer PWA
frontend/src/app/farmer/page.tsx - Claims View
frontend/src/app/farmer/claims/page.tsx - Review Dashboard
frontend/src/app/dashboard/page.tsx - Offline Claim Submit
frontend/src/lib/offline/useOfflineClaimSubmit.ts - Offline Claim Store
frontend/src/lib/offline/db.ts - Claim Sync Engine
frontend/src/lib/offline/syncEngine.ts - Frontend API Client
frontend/src/lib/api.ts
API and Identity
- FastAPI Runtime
backend/app/main.py - Authentication API
backend/app/api/auth.py - Identity Service
backend/app/services/auth_service.py - Auth and Role Guards
backend/app/api/deps.py
Claims and Evidence
- Claims API
backend/app/api/reports.py - Evidence Storage
backend/app/services/storage_service.py - MinIO Object Store
- Claim Exports and Certificates
backend/app/services/pmfby_export_service.py
Assessment and Weather
- AI Assessment Pipeline
backend/app/workers/ai_pipeline.py - Vision and Duplicate Audit
backend/app/services/cv_service.py - Claim Weather Correlation
backend/app/services/weather_service.py - Confidence Scoring
backend/app/services/scoring_service.py - Proactive Weather Monitor
backend/app/services/weather_monitor_service.py
Runtime and Persistence
- Redis Streams
- Stream Consumer
backend/app/workers/consumer.py - PostgreSQL and PostGIS
backend/app/db/session.py
Other components
- Farmer
- Inspector
Connections 29
- Farmer → Farmer PWA: captures loss
README.md - Farmer PWA → Offline Claim Submit: queues offline
- Offline Claim Submit → Offline Claim Store: stores claim
frontend/src/lib/offline/useOfflineClaimSubmit.ts - Claim Sync Engine → Offline Claim Store: reads and updates
frontend/src/lib/offline/syncEngine.ts - Claim Sync Engine → Frontend API Client: uploads claim
- Farmer PWA → Frontend API Client: uses API
- Frontend API Client → FastAPI Runtime: sends requests
- Inspector → Review Dashboard: reviews cases
README.md - Review Dashboard → Frontend API Client: requests review data
- FastAPI Runtime → Authentication API: routes requests
backend/app/main.py - FastAPI Runtime → Claims API: routes requests
backend/app/main.py - Authentication API → Identity Service: uses identity service
backend/app/api/auth.py - Authentication API → Auth and Role Guards: checks roles
backend/app/api/auth.py - Identity Service → PostgreSQL and PostGIS: reads and writes users
backend/app/services/auth_service.py - Claims API → Auth and Role Guards: guards claim routes
backend/app/api/reports.py - Claims API → PostgreSQL and PostGIS: persists claim data
backend/app/api/reports.py - Claims API → Evidence Storage: requests evidence URLs
backend/app/api/reports.py - Evidence Storage → MinIO Object Store: creates upload URLs
backend/app/services/storage_service.py - FastAPI Runtime → Stream Consumer: starts worker
backend/app/main.py - Stream Consumer → Redis Streams: consumes events
backend/app/workers/consumer.py - Stream Consumer → AI Assessment Pipeline: runs assessment
backend/app/workers/consumer.py - AI Assessment Pipeline → MinIO Object Store: fetches images
backend/app/workers/ai_pipeline.py - AI Assessment Pipeline → Vision and Duplicate Audit: analyzes and checks duplicates
backend/app/workers/ai_pipeline.py - AI Assessment Pipeline → Claim Weather Correlation: fetches correlation
backend/app/workers/ai_pipeline.py - AI Assessment Pipeline → Confidence Scoring: computes confidence
backend/app/workers/ai_pipeline.py - AI Assessment Pipeline → PostgreSQL and PostGIS: persists assessment
backend/app/workers/ai_pipeline.py - FastAPI Runtime → Proactive Weather Monitor: starts monitor worker
- Claims API → Claim Exports and Certificates: uses claim exports
backend/app/api/reports.py - FastAPI Runtime → PostgreSQL and PostGIS: initializes database
backend/app/main.py