# jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine- architecture

> Architecture diagram of the GitHub repository jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-
- Repository: https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-

## Overview

OptiCrop is a crop-planning web application: users enter soil and climate measurements to get a crop recommendation and care guidance, or assess a chosen crop’s suitability. A research dashboard exposes inquiry analytics, CSV export, and model retraining. The frontend’s navigation and prediction/suitability requests are visible in source; README documents the wider API capabilities. Dashboard request wiring and some backend internals were not sampled, so those links are marked unverified or omitted.

Main entry points: [`backend/main.py`](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py) (FastAPI routes), [`frontend/src/App.jsx`](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/App.jsx) (Page navigation), [`backend/db.py`](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/db.py) (Prediction log schema), [`frontend/src/pages/SuitabilityChecker.jsx`](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/SuitabilityChecker.jsx) (Suitability form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["Page navigation<br/>[App.jsx]"]
  node_landing["Feature landing<br/>[LandingPage.jsx]"]
  node_recommend_ui["Farmer inputs"]
  node_suitability_ui["Suitability form"]
  node_dashboard["Research dashboard"]
  node_api_config["API endpoint config<br/>[config.js]"]
end

subgraph group_api["Recommendation API"]
  node_backend["FastAPI routes<br/>[main.py]"]
  node_prediction["Crop prediction<br/>[main.py]"]
  node_suitability["Suitability scoring<br/>[main.py]"]
  node_ideal_ranges["Crop ideal ranges<br/>[main.py]"]
  node_analytics["Analytics and export<br/>[main.py]"]
  node_retraining["Retraining trigger<br/>[main.py]"]
end

subgraph group_ml["Model lifecycle"]
  node_trainer["Model training<br/>[train.py]"]
  node_dataset["Crop dataset"]
  node_artifacts["Model and crop data"]
  node_tips["Crop care tips<br/>[crop_tips.json]"]
end

subgraph group_state["Inquiry records"]
  node_db_model["Prediction log schema<br/>[db.py]"]
  node_sqlite[("SQLite inquiry store")]
end

node_farmer(("Farmer"))

node_farmer -->|"uses"| node_app
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_recommend_ui
node_app -->|"renders"| node_suitability_ui
node_app -->|"renders"| node_dashboard
node_recommend_ui -->|"POST /predict"| node_backend
node_suitability_ui -->|"requests ranges"| node_backend
node_suitability_ui -->|"POST /suitability"| node_backend
node_backend -->|"routes prediction"| node_prediction
node_backend -->|"routes assessment"| node_suitability
node_backend -->|"routes ranges"| node_ideal_ranges
node_backend -->|"routes analytics"| node_analytics
node_backend -->|"routes retraining"| node_retraining
node_prediction -->|"loads artifacts"| node_artifacts
node_prediction -.->|"loads tips"| node_tips
node_trainer -->|"reads data"| node_dataset
node_trainer -->|"writes model data"| node_artifacts
node_backend -->|"uses records"| node_db_model
node_db_model -->|"stores logs"| node_sqlite
node_prediction -->|"logs inquiry"| node_db_model
node_suitability -->|"logs inquiry"| node_db_model
node_analytics -->|"reads inquiries"| node_db_model
node_retraining -->|"starts training"| node_trainer
node_dashboard -.->|"loads analytics"| node_backend
node_api_config -.->|"sets API base"| node_backend

click node_app "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/App.jsx"
click node_landing "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/LandingPage.jsx"
click node_recommend_ui "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/FarmerRecommendation.jsx"
click node_suitability_ui "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/SuitabilityChecker.jsx"
click node_dashboard "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/ResearchDashboard.jsx"
click node_api_config "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/config.js"
click node_backend "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py"
click node_prediction "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py"
click node_suitability "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py"
click node_ideal_ranges "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py"
click node_analytics "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py"
click node_retraining "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py"
click node_trainer "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/train.py"
click node_dataset "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/Crop_recommendation.csv"
click node_artifacts "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/tree/main/backend"
click node_tips "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/crop_tips.json"
click node_db_model "https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/db.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_landing,node_recommend_ui,node_suitability_ui,node_dashboard,node_api_config toneBlue
class node_backend,node_prediction,node_suitability,node_ideal_ranges,node_analytics,node_retraining toneAmber
class node_trainer,node_dataset,node_artifacts,node_tips toneMint
class node_db_model,node_sqlite toneRose
class node_farmer toneIndigo
```

## Components

### Web interface

- [Page navigation](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Feature landing](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/LandingPage.jsx): `frontend/src/pages/LandingPage.jsx`
- [Farmer inputs](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/FarmerRecommendation.jsx): `frontend/src/pages/FarmerRecommendation.jsx`
- [Suitability form](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/SuitabilityChecker.jsx): `frontend/src/pages/SuitabilityChecker.jsx`
- [Research dashboard](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/pages/ResearchDashboard.jsx): `frontend/src/pages/ResearchDashboard.jsx`
- [API endpoint config](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/frontend/src/config.js): `frontend/src/config.js`

### Recommendation API

- [FastAPI routes](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py): `backend/main.py`
- [Crop prediction](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py): `backend/main.py`
- [Suitability scoring](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py): `backend/main.py`
- [Crop ideal ranges](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py): `backend/main.py`
- [Analytics and export](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py): `backend/main.py`
- [Retraining trigger](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/main.py): `backend/main.py`

### Model lifecycle

- [Model training](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/train.py): `backend/train.py`
- [Crop dataset](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/Crop_recommendation.csv): `Crop_recommendation.csv`
- [Model and crop data](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/tree/main/backend): `backend`
- [Crop care tips](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/crop_tips.json): `backend/crop_tips.json`

### Inquiry records

- [Prediction log schema](https://github.com/jaswanth-kattula/opticrop-smart-agricultural-production-optimization-engine-/blob/main/backend/db.py): `backend/db.py`
- **SQLite inquiry store**

### Other components

- **Farmer**

## Connections

- Farmer → Page navigation: uses (evidence: `README.md`)
- Page navigation → Feature landing: renders (evidence: `frontend/src/App.jsx`)
- Page navigation → Farmer inputs: renders (evidence: `frontend/src/App.jsx`)
- Page navigation → Suitability form: renders (evidence: `frontend/src/App.jsx`)
- Page navigation → Research dashboard: renders (evidence: `frontend/src/App.jsx`)
- Farmer inputs → FastAPI routes: POST /predict (evidence: `frontend/src/pages/FarmerRecommendation.jsx`)
- Suitability form → FastAPI routes: requests ranges (evidence: `frontend/src/pages/SuitabilityChecker.jsx`)
- Suitability form → FastAPI routes: POST /suitability (evidence: `frontend/src/pages/SuitabilityChecker.jsx`)
- FastAPI routes → Crop prediction: routes prediction (evidence: `README.md`)
- FastAPI routes → Suitability scoring: routes assessment (evidence: `README.md`)
- FastAPI routes → Crop ideal ranges: routes ranges (evidence: `README.md`)
- FastAPI routes → Analytics and export: routes analytics (evidence: `README.md`)
- FastAPI routes → Retraining trigger: routes retraining (evidence: `README.md`)
- Crop prediction → Model and crop data: loads artifacts (evidence: `backend/main.py`)
- Crop prediction → Crop care tips: loads tips
- Model training → Crop dataset: reads data (evidence: `backend/train.py`)
- Model training → Model and crop data: writes model data (evidence: `backend/train.py`)
- FastAPI routes → Prediction log schema: uses records (evidence: `backend/main.py`)
- Prediction log schema → SQLite inquiry store: stores logs (evidence: `backend/db.py`)
- Crop prediction → Prediction log schema: logs inquiry (evidence: `README.md`)
- Suitability scoring → Prediction log schema: logs inquiry (evidence: `README.md`)
- Analytics and export → Prediction log schema: reads inquiries (evidence: `backend/main.py`)
- Retraining trigger → Model training: starts training (evidence: `README.md`)
- Research dashboard → FastAPI routes: loads analytics
- API endpoint config → FastAPI routes: sets API base
