How kanavkapoor05/ai-crop-yield-backend works
This is a FastAPI crop-analysis API with signup/login, protected yield prediction, and protected crop-image analysis. The main workflow is a user request reaching an API route, passing authentication where required, then producing a prediction or image-based diagnosis. The excerpts show MongoDB user access, JWT/password helpers, and the yield model load and prediction path. Recommendation logic is partly elided, and no README is provided, so the graph reflects only documented or excerpted behavior.
Main entry points: app.py API routes · database.py User collection · schemas.py Request schemas · auth.py Auth helpers
Components 13
API workflows
- API routes
app.py - Request schemas
schemas.py
Identity and users
- Auth helpers
auth.py - User collection
database.py - Utility helpers
utils.py
Crop analysis
- Yield input
app.py - Yield model
crop_yield_model.json - Yield prediction
app.py - Yield recommendations
app.py - Image upload
app.py - Image analysis
app.py
Other components
- User
- MongoDB
Connections 11
- User → API routes: sends requests
app.py - API routes → Request schemas: uses models
app.py - API routes → Auth helpers: calls helpers
app.py - API routes → User collection: reads and writes
app.py - User collection → MongoDB: stores users
database.py - API routes → Yield input: accepts input
app.py - API routes → Yield prediction: runs prediction
app.py - Yield prediction → Yield model: loads and predicts
app.py - Yield prediction → Yield recommendations: builds guidance
app.py - API routes → Image upload: accepts image
app.py - Image upload → Image analysis: analyzes image
app.py