# rahul270903/cocoa-disease-detection architecture

> Architecture diagram of the GitHub repository rahul270903/cocoa-disease-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahul270903/cocoa-disease-detection
- Repository: https://github.com/rahul270903/cocoa-disease-detection

## Overview

Cocoa Disease Detection is a Flask web application for farmers to identify cocoa diseases from uploaded images and receive localized care advice. Its main workflow accepts an image, processes it for CNN inference, presents a class and confidence, selects disease-specific recommendations, and supports translation. The README also describes registration/login and a dashboard; the sampled app code shows MySQL-backed authentication and notification handling. The source excerpts are partial, so several documented UI and database links are shown only where the README or excerpt supports them; the JavaScript core files include general site behavior and browser utilities.

Main entry points: [`app.py`](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py) (Flask routes), [`templates/admin/dashboard.html`](https://github.com/rahul270903/cocoa-disease-detection/blob/main/templates/admin/dashboard.html) (Dashboard UI), [`model.keras`](https://github.com/rahul270903/cocoa-disease-detection/blob/main/model.keras) (CNN classifier), [`database/schema.sql`](https://github.com/rahul270903/cocoa-disease-detection/blob/main/database/schema.sql) (MySQL records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_dashboard["Dashboard UI<br/>[dashboard.html]"]
  node_siteui["Site pages<br/>[index.html]"]
  node_mainjs["Page interactions<br/>[main.js]"]
  node_modernizr["Feature detection<br/>[modernizr.js]"]
  node_plugins["Browser plugins<br/>[plugins.js]"]
end

subgraph group_detection["Disease detection"]
  node_flask["Flask routes<br/>[app.py]"]
  node_upload["Image upload<br/>[app.py]"]
  node_preprocess["Image processing<br/>[app.py]"]
  node_classifier["CNN classifier<br/>[model.keras]"]
  node_care["Care recommendations<br/>[app.py]"]
  node_results["Prediction result<br/>[result.html]"]
end

subgraph group_accounts["Accounts and notifications"]
  node_auth["Registration and login<br/>[app.py]"]
  node_mysql[("MySQL records<br/>[schema.sql]")]
  node_notifications["Admin notifications<br/>[app.py]"]
end

subgraph group_localization["Localization"]
  node_translation["Result translation<br/>[app.py]"]
end

node_farmer(("Farmer"))
node_translatorapi{{"Translation API"}}

node_farmer -->|"uses"| node_dashboard
node_farmer -->|"visits"| node_siteui
node_farmer -->|"submits image"| node_flask
node_flask -->|"routes upload"| node_upload
node_upload -->|"processes image"| node_preprocess
node_preprocess -->|"predicts"| node_classifier
node_classifier -->|"returns class"| node_care
node_care -->|"presents advice"| node_results
node_farmer -->|"registers or logs in"| node_auth
node_auth -->|"queries accounts"| node_mysql
node_flask -->|"dispatches alerts"| node_notifications
node_notifications -->|"stores and reads"| node_mysql
node_farmer -->|"requests language"| node_translation
node_translation -->|"translates HTML"| node_translatorapi
node_dashboard -.->|"requests translation"| node_translation
node_mainjs -->|"initializes widgets"| node_plugins

click node_dashboard "https://github.com/rahul270903/cocoa-disease-detection/blob/main/templates/admin/dashboard.html"
click node_siteui "https://github.com/rahul270903/cocoa-disease-detection/blob/main/templates/index.html"
click node_mainjs "https://github.com/rahul270903/cocoa-disease-detection/blob/main/static/js/main.js"
click node_modernizr "https://github.com/rahul270903/cocoa-disease-detection/blob/main/static/js/modernizr.js"
click node_plugins "https://github.com/rahul270903/cocoa-disease-detection/blob/main/static/js/plugins.js"
click node_flask "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py"
click node_upload "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py"
click node_preprocess "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py"
click node_classifier "https://github.com/rahul270903/cocoa-disease-detection/blob/main/model.keras"
click node_care "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py"
click node_results "https://github.com/rahul270903/cocoa-disease-detection/blob/main/result.html"
click node_auth "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py"
click node_mysql "https://github.com/rahul270903/cocoa-disease-detection/blob/main/database/schema.sql"
click node_notifications "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py"
click node_translation "https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.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_dashboard,node_siteui,node_mainjs,node_modernizr,node_plugins toneBlue
class node_flask,node_upload,node_preprocess,node_classifier,node_care,node_results toneAmber
class node_auth,node_mysql,node_notifications,node_translatorapi toneMint
class node_translation toneRose
class node_farmer toneIndigo
```

## Components

### Web experience

- [Dashboard UI](https://github.com/rahul270903/cocoa-disease-detection/blob/main/templates/admin/dashboard.html): `templates/admin/dashboard.html`
- [Site pages](https://github.com/rahul270903/cocoa-disease-detection/blob/main/templates/index.html): `templates/index.html`
- [Page interactions](https://github.com/rahul270903/cocoa-disease-detection/blob/main/static/js/main.js): `static/js/main.js`
- [Feature detection](https://github.com/rahul270903/cocoa-disease-detection/blob/main/static/js/modernizr.js): `static/js/modernizr.js`
- [Browser plugins](https://github.com/rahul270903/cocoa-disease-detection/blob/main/static/js/plugins.js): `static/js/plugins.js`

### Disease detection

- [Flask routes](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`
- [Image upload](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`
- [Image processing](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`
- [CNN classifier](https://github.com/rahul270903/cocoa-disease-detection/blob/main/model.keras): `model.keras`
- [Care recommendations](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`
- [Prediction result](https://github.com/rahul270903/cocoa-disease-detection/blob/main/result.html): `result.html`

### Accounts and notifications

- [Registration and login](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`
- [MySQL records](https://github.com/rahul270903/cocoa-disease-detection/blob/main/database/schema.sql): `database/schema.sql`
- [Admin notifications](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`

### Localization

- [Result translation](https://github.com/rahul270903/cocoa-disease-detection/blob/main/app.py): `app.py`

### Other components

- **Farmer**
- **Translation API**

## Connections

- Farmer → Dashboard UI: uses (evidence: `README.md`)
- Farmer → Site pages: visits (evidence: `README.md`)
- Farmer → Flask routes: submits image (evidence: `app.py`)
- Flask routes → Image upload: routes upload (evidence: `app.py`)
- Image upload → Image processing: processes image (evidence: `app.py`)
- Image processing → CNN classifier: predicts (evidence: `app.py`)
- CNN classifier → Care recommendations: returns class (evidence: `app.py`)
- Care recommendations → Prediction result: presents advice (evidence: `README.md`)
- Farmer → Registration and login: registers or logs in (evidence: `README.md`)
- Registration and login → MySQL records: queries accounts (evidence: `app.py`)
- Flask routes → Admin notifications: dispatches alerts (evidence: `app.py`)
- Admin notifications → MySQL records: stores and reads (evidence: `app.py`)
- Farmer → Result translation: requests language (evidence: `app.py`)
- Result translation → Translation API: translates HTML (evidence: `app.py`)
- Dashboard UI → Result translation: requests translation
- Page interactions → Browser plugins: initializes widgets (evidence: `static/js/main.js`)
