# chandanajn816/smart-fertilization-recommondation-engine architecture

> Architecture diagram of the GitHub repository chandanajn816/smart-fertilization-recommondation-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandanajn816/smart-fertilization-recommondation-engine
- Repository: https://github.com/chandanajn816/smart-fertilization-recommondation-engine

## Overview

This is a Flask farm-management and fertilizer-advisory app. A grower signs in, creates a field, optionally identifies a crop from an image, enters soil and environmental measurements, and receives a fertilizer recommendation with supporting advisory information. Field and analysis history can be revisited through the dashboard. The code also defines account registration and session handling. The excerpts establish the route-to-service and route-to-model interactions; several field-route sections are omitted, so uncertain details of those handlers are not mapped.

Main entry points: [`app/__init__.py`](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/__init__.py) (Flask app setup), [`app/fields/routes.py`](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/fields/routes.py) (Field workflows), [`app/models.py`](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/models.py) (Farm records), [`app/auth/routes.py`](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/auth/routes.py) (Account routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask app setup<br/>[__init__.py]"]
  node_auth["Account routes<br/>[routes.py]"]
  node_dashboard["Field dashboard<br/>[routes.py]"]
  node_fields["Field workflows<br/>[routes.py]"]
  node_views["Page templates"]
end

subgraph group_domain["Farm records"]
  node_records[("Farm records<br/>[models.py]")]
end

subgraph group_advisory["Crop and soil advisory"]
  node_plantnet_service["Plant identification"]
  node_prediction["Fertilizer prediction"]
  node_model["Trained model artifact"]
end

node_grower(("Grower"))
node_plantnet{{"Pl@ntNet API"}}

node_grower -->|"requests pages"| node_app
node_app -->|"registers routes"| node_auth
node_app -->|"registers routes"| node_fields
node_app -->|"registers routes"| node_dashboard
node_app -->|"creates schema"| node_records
node_auth -->|"reads and writes"| node_records
node_auth -->|"renders pages"| node_views
node_dashboard -->|"reads fields"| node_records
node_dashboard -->|"renders pages"| node_views
node_fields -->|"reads and writes"| node_records
node_fields -->|"identifies image"| node_plantnet_service
node_plantnet_service -.->|"sends image"| node_plantnet
node_fields -->|"requests prediction"| node_prediction
node_prediction -->|"loads artifact"| node_model
node_fields -->|"renders pages"| node_views

click node_app "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/__init__.py"
click node_auth "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/auth/routes.py"
click node_dashboard "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/dashboard/routes.py"
click node_fields "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/fields/routes.py"
click node_views "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/tree/main/app/templates"
click node_records "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/models.py"
click node_plantnet_service "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/services/plantnet_service.py"
click node_prediction "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/services/prediction_service.py"
click node_model "https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/ml/models/fertilizer_model.joblib"

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_auth,node_dashboard,node_fields,node_views toneBlue
class node_records toneAmber
class node_plantnet_service,node_prediction,node_model,node_plantnet toneMint
class node_grower toneIndigo
```

## Components

### Web application

- [Flask app setup](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/__init__.py): `app/__init__.py`
- [Account routes](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/auth/routes.py): `app/auth/routes.py`
- [Field dashboard](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/dashboard/routes.py): `app/dashboard/routes.py`
- [Field workflows](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/fields/routes.py): `app/fields/routes.py`
- [Page templates](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/tree/main/app/templates): `app/templates`

### Farm records

- [Farm records](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/models.py): `app/models.py`

### Crop and soil advisory

- [Plant identification](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/services/plantnet_service.py): `app/services/plantnet_service.py`
- [Fertilizer prediction](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/app/services/prediction_service.py): `app/services/prediction_service.py`
- [Trained model artifact](https://github.com/chandanajn816/smart-fertilization-recommondation-engine/blob/main/ml/models/fertilizer_model.joblib): `ml/models/fertilizer_model.joblib`

### Other components

- **Grower**
- **Pl@ntNet API**

## Connections

- Grower → Flask app setup: requests pages
- Flask app setup → Account routes: registers routes
- Flask app setup → Field workflows: registers routes
- Flask app setup → Field dashboard: registers routes
- Flask app setup → Farm records: creates schema
- Account routes → Farm records: reads and writes
- Account routes → Page templates: renders pages
- Field dashboard → Farm records: reads fields
- Field dashboard → Page templates: renders pages
- Field workflows → Farm records: reads and writes
- Field workflows → Plant identification: identifies image
- Plant identification → Pl@ntNet API: sends image
- Field workflows → Fertilizer prediction: requests prediction
- Fertilizer prediction → Trained model artifact: loads artifact
- Field workflows → Page templates: renders pages
