# hemen-dev/email-categorizer architecture

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

- Interactive diagram: https://gitdiagram.com/hemen-dev/email-categorizer
- Repository: https://github.com/hemen-dev/email-categorizer

## Overview

Email Categorizer turns volunteer-application email text into keyword-based categories, then offers statistics, CSV reporting, and optional folder organization. Users can run it through a command-line interface or a Flask web interface; the sampled web route directly invokes the core processing, statistics, reporting, and organization functions. The core module excerpt is incomplete, so internal CLI wiring and some batch-discovery details are not expanded beyond documented capabilities.

Main entry points: [`web_gui.py`](https://github.com/hemen-dev/email-categorizer/blob/main/web_gui.py) (Flask web interface), [`src/email_categorizer.py`](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py) (Batch processing), [`data/sample_emails`](https://github.com/hemen-dev/email-categorizer/tree/main/data/sample_emails) (Email text files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["Command-line interface"]
  node_web["Flask web interface<br/>[web_gui.py]"]
end

subgraph group_categorization["Email categorization"]
  node_batch["Batch processing"]
  node_email_parser["Email parsing"]
  node_keyword_categories["Keyword categories"]
end

subgraph group_outputs["Reports and organization"]
  node_statistics["Statistics generation"]
  node_csv_report["CSV report"]
  node_organizer["Folder organization"]
end

node_cli_user(("CLI user"))
node_web_user(("Web user"))
node_email_files["Email text files"]
node_report_file["CSV output"]
node_organized_files["Categorized copies"]

node_cli_user -->|"runs"| node_cli
node_web_user -->|"submits"| node_web
node_email_files -->|"selects directory"| node_web
node_cli -->|"processes batch"| node_batch
node_batch -->|"reads files"| node_email_files
node_batch -->|"processes each"| node_email_parser
node_email_parser -->|"matches keywords"| node_keyword_categories
node_web -->|"processes each"| node_email_parser
node_web -->|"generates"| node_statistics
node_web -->|"requests report"| node_csv_report
node_web -->|"requests organization"| node_organizer
node_csv_report -->|"writes"| node_report_file
node_organizer -->|"copies into folders"| node_organized_files

click node_cli "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py"
click node_web "https://github.com/hemen-dev/email-categorizer/blob/main/web_gui.py"
click node_email_files "https://github.com/hemen-dev/email-categorizer/tree/main/data/sample_emails"
click node_batch "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py"
click node_email_parser "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py"
click node_keyword_categories "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py"
click node_statistics "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py"
click node_csv_report "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py"
click node_organizer "https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.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_cli,node_web,node_cli_user,node_web_user toneBlue
class node_batch,node_email_parser,node_keyword_categories toneAmber
class node_statistics,node_csv_report,node_organizer toneMint
class node_email_files toneTeal
class node_report_file,node_organized_files toneIndigo
```

## Components

### User interfaces

- [Command-line interface](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`
- [Flask web interface](https://github.com/hemen-dev/email-categorizer/blob/main/web_gui.py): `web_gui.py`

### Email categorization

- [Batch processing](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`
- [Email parsing](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`
- [Keyword categories](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`

### Reports and organization

- [Statistics generation](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`
- [CSV report](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`
- [Folder organization](https://github.com/hemen-dev/email-categorizer/blob/main/src/email_categorizer.py): `src/email_categorizer.py`

### Other components

- **CLI user**
- **Web user**
- [Email text files](https://github.com/hemen-dev/email-categorizer/tree/main/data/sample_emails): `data/sample_emails`
- **CSV output**
- **Categorized copies**

## Connections

- CLI user → Command-line interface: runs
- Web user → Flask web interface: submits
- Email text files → Flask web interface: selects directory
- Command-line interface → Batch processing: processes batch
- Batch processing → Email text files: reads files
- Batch processing → Email parsing: processes each
- Email parsing → Keyword categories: matches keywords
- Flask web interface → Email parsing: processes each
- Flask web interface → Statistics generation: generates
- Flask web interface → CSV report: requests report
- Flask web interface → Folder organization: requests organization
- CSV report → CSV output: writes
- Folder organization → Categorized copies: copies into folders
