# shresthagakul999-rgb/project-agrigrow architecture

> Architecture diagram of the GitHub repository shresthagakul999-rgb/project-agrigrow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shresthagakul999-rgb/project-agrigrow
- Repository: https://github.com/shresthagakul999-rgb/project-agrigrow

## Overview

Agrigrow is a Django farm-environment monitoring application. Its evident workflow is to collect or simulate farm sensor readings, classify new readings for risk, create and email alerts for warning/critical conditions, and expose farm readings, status, summaries, alerts, and weather-mode controls through an authenticated dashboard/API. Model training is a separate supporting capability. The README contains no feature documentation, and source excerpts do not show URL wiring or model/predictor internals; those relationships are omitted where not evidenced.

Main entry points: [`dashboard/views.py`](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/dashboard/views.py) (Dashboard API), [`mlengine/signals.py`](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/signals.py) (Reading classification), [`sensors/models.py`](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py) (Sensor readings), [`sensors/management/commands/generate_readings.py`](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/management/commands/generate_readings.py) (Reading simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitoring["Farm monitoring"]
  node_sensor_generation["Reading simulation"]
  node_farm_data[("Farm data<br/>[models.py]")]
  node_readings[("Sensor readings<br/>[models.py]")]
  node_weather_modes[("Weather modes<br/>[models.py]")]
end

subgraph group_risk["Risk analysis"]
  node_training["Model training<br/>[train_model.py]"]
  node_labeling["Rule labeling<br/>[labeling.py]"]
  node_predictor["Risk prediction<br/>[predictor.py]"]
  node_reading_signal["Reading classification<br/>[signals.py]"]
end

subgraph group_alerts["Alerts"]
  node_alert_records[("Alert records<br/>[models.py]")]
  node_email_sender["Email notification<br/>[notifications.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_api["Dashboard API<br/>[views.py]"]
  node_serialization["API serialization<br/>[serializers.py]"]
end

node_farmer(("Farmer"))
node_smtp{{"SMTP service"}}

node_farmer -->|"starts simulation"| node_sensor_generation
node_sensor_generation -->|"reads farms"| node_farm_data
node_sensor_generation -->|"reads mode"| node_weather_modes
node_sensor_generation -->|"creates readings"| node_readings
node_farmer -->|"requests data"| node_dashboard_api
node_dashboard_api -->|"reads owned farms"| node_farm_data
node_dashboard_api -->|"queries readings"| node_readings
node_dashboard_api -->|"reads or updates"| node_weather_modes
node_dashboard_api -->|"queries alerts"| node_alert_records
node_dashboard_api -->|"serializes results"| node_serialization
node_training -->|"loads readings"| node_readings
node_training -->|"labels samples"| node_labeling
node_readings -->|"post-save dispatch"| node_reading_signal
node_reading_signal -->|"predicts risk"| node_predictor
node_reading_signal -->|"updates risk"| node_readings
node_reading_signal -->|"creates alert"| node_alert_records
node_reading_signal -->|"sends alert"| node_email_sender
node_email_sender -.->|"sends email"| node_smtp

click node_sensor_generation "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/management/commands/generate_readings.py"
click node_farm_data "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py"
click node_readings "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py"
click node_weather_modes "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py"
click node_training "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/management/commands/train_model.py"
click node_labeling "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/labeling.py"
click node_predictor "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/predictor.py"
click node_reading_signal "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/signals.py"
click node_dashboard_api "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/dashboard/views.py"
click node_serialization "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/dashboard/serializers.py"
click node_alert_records "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/alerts/models.py"
click node_email_sender "https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/alerts/notifications.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_sensor_generation,node_farm_data,node_readings,node_weather_modes toneBlue
class node_training,node_labeling,node_predictor,node_reading_signal toneAmber
class node_alert_records,node_email_sender toneMint
class node_dashboard_api,node_serialization toneRose
class node_farmer,node_smtp toneIndigo
```

## Components

### Farm monitoring

- [Reading simulation](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/management/commands/generate_readings.py): `sensors/management/commands/generate_readings.py`
- [Farm data](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py): `sensors/models.py`
- [Sensor readings](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py): `sensors/models.py`
- [Weather modes](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/sensors/models.py): `sensors/models.py`

### Risk analysis

- [Model training](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/management/commands/train_model.py): `mlengine/management/commands/train_model.py`
- [Rule labeling](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/labeling.py): `mlengine/labeling.py`
- [Risk prediction](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/predictor.py): `mlengine/predictor.py`
- [Reading classification](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/mlengine/signals.py): `mlengine/signals.py`

### Alerts

- [Alert records](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/alerts/models.py): `alerts/models.py`
- [Email notification](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/alerts/notifications.py): `alerts/notifications.py`

### Dashboard

- [Dashboard API](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/dashboard/views.py): `dashboard/views.py`
- [API serialization](https://github.com/shresthagakul999-rgb/project-agrigrow/blob/main/dashboard/serializers.py): `dashboard/serializers.py`

### Other components

- **Farmer**
- **SMTP service**

## Connections

- Farmer → Reading simulation: starts simulation
- Reading simulation → Farm data: reads farms
- Reading simulation → Weather modes: reads mode
- Reading simulation → Sensor readings: creates readings
- Farmer → Dashboard API: requests data
- Dashboard API → Farm data: reads owned farms
- Dashboard API → Sensor readings: queries readings
- Dashboard API → Weather modes: reads or updates
- Dashboard API → Alert records: queries alerts
- Dashboard API → API serialization: serializes results
- Model training → Sensor readings: loads readings
- Model training → Rule labeling: labels samples
- Sensor readings → Reading classification: post-save dispatch
- Reading classification → Risk prediction: predicts risk
- Reading classification → Sensor readings: updates risk
- Reading classification → Alert records: creates alert
- Reading classification → Email notification: sends alert
- Email notification → SMTP service: sends email
