# dainlucas/jev-tg-classifier architecture

> Architecture diagram of the GitHub repository dainlucas/jev-tg-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dainlucas/jev-tg-classifier
- Repository: https://github.com/dainlucas/jev-tg-classifier

## Overview

JEV Telegram Classifier monitors Telegram messages through either a Telethon user session or the Telegram Bot API, classifies their text with JEV AI (or local simulation), and presents results in an interactive terminal dashboard. Categories are loaded from JSON; the bot also supports category and test commands and optional group replies. The user listener preloads recent messages and synchronizes alongside real-time events. Source excerpts show the main call paths, but not the full dashboard implementation or every integration detail.

Main entry points: [`classifier.py`](https://github.com/dainlucas/jev-tg-classifier/blob/main/classifier.py) (JEV classifier), [`main.py`](https://github.com/dainlucas/jev-tg-classifier/blob/main/main.py) (Mode launcher), [`cli_dashboard.py`](https://github.com/dainlucas/jev-tg-classifier/blob/main/cli_dashboard.py) (Tabbed dashboard), [`bot_listener.py`](https://github.com/dainlucas/jev-tg-classifier/blob/main/bot_listener.py) (Bot listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_main["Mode launcher<br/>[main.py]"]
  node_simulation["Sample-message simulation<br/>[main.py]"]
end

subgraph group_ingest["Telegram ingestion"]
  node_user_listener["User listener<br/>[user_listener.py]"]
  node_telethon["Telegram user service"]
  node_bot_listener["Bot listener<br/>[bot_listener.py]"]
  node_telegram_bot["Telegram Bot API"]
end

subgraph group_classification["Classification"]
  node_classifier["JEV classifier<br/>[classifier.py]"]
  node_categories["Category definitions<br/>[categories.json]"]
  node_typesafe["TypeSafe AI service"]
end

subgraph group_presentation["Terminal presentation"]
  node_dashboard["Tabbed dashboard<br/>[cli_dashboard.py]"]
  node_keyboard["Keyboard controls<br/>[cli_dashboard.py]"]
end

node_operator(("Operator"))
node_terminal(("Terminal user"))

node_operator -->|"starts"| node_main
node_main -->|"configures"| node_classifier
node_main -->|"creates"| node_dashboard
node_main -->|"selects mode"| node_user_listener
node_main -->|"selects mode"| node_bot_listener
node_main -->|"selects mode"| node_simulation
node_simulation -->|"classifies"| node_classifier
node_simulation -->|"adds results"| node_dashboard
node_user_listener -->|"monitors"| node_telethon
node_bot_listener -->|"polls"| node_telegram_bot
node_user_listener -->|"classifies"| node_classifier
node_bot_listener -->|"classifies"| node_classifier
node_bot_listener -->|"reloads categories"| node_classifier
node_user_listener -->|"adds results"| node_dashboard
node_bot_listener -->|"adds results"| node_dashboard
node_classifier -->|"loads"| node_categories
node_classifier -->|"requests classification"| node_typesafe
node_dashboard -->|"renders feed"| node_terminal
node_keyboard -->|"changes tabs"| node_dashboard
node_operator -->|"navigates"| node_keyboard

click node_main "https://github.com/dainlucas/jev-tg-classifier/blob/main/main.py"
click node_simulation "https://github.com/dainlucas/jev-tg-classifier/blob/main/main.py"
click node_user_listener "https://github.com/dainlucas/jev-tg-classifier/blob/main/user_listener.py"
click node_bot_listener "https://github.com/dainlucas/jev-tg-classifier/blob/main/bot_listener.py"
click node_classifier "https://github.com/dainlucas/jev-tg-classifier/blob/main/classifier.py"
click node_categories "https://github.com/dainlucas/jev-tg-classifier/blob/main/categories.json"
click node_dashboard "https://github.com/dainlucas/jev-tg-classifier/blob/main/cli_dashboard.py"
click node_keyboard "https://github.com/dainlucas/jev-tg-classifier/blob/main/cli_dashboard.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_main,node_simulation,node_terminal toneBlue
class node_user_listener,node_telethon,node_bot_listener,node_telegram_bot toneAmber
class node_classifier,node_categories,node_typesafe toneMint
class node_dashboard,node_keyboard toneRose
class node_operator toneIndigo
```

## Components

### Application entry

- [Mode launcher](https://github.com/dainlucas/jev-tg-classifier/blob/main/main.py): `main.py`
- [Sample-message simulation](https://github.com/dainlucas/jev-tg-classifier/blob/main/main.py): `main.py`

### Telegram ingestion

- [User listener](https://github.com/dainlucas/jev-tg-classifier/blob/main/user_listener.py): `user_listener.py`
- **Telegram user service**
- [Bot listener](https://github.com/dainlucas/jev-tg-classifier/blob/main/bot_listener.py): `bot_listener.py`
- **Telegram Bot API**

### Classification

- [JEV classifier](https://github.com/dainlucas/jev-tg-classifier/blob/main/classifier.py): `classifier.py`
- [Category definitions](https://github.com/dainlucas/jev-tg-classifier/blob/main/categories.json): `categories.json`
- **TypeSafe AI service**

### Terminal presentation

- [Tabbed dashboard](https://github.com/dainlucas/jev-tg-classifier/blob/main/cli_dashboard.py): `cli_dashboard.py`
- [Keyboard controls](https://github.com/dainlucas/jev-tg-classifier/blob/main/cli_dashboard.py): `cli_dashboard.py`

### Other components

- **Operator**
- **Terminal user**

## Connections

- Operator → Mode launcher: starts (evidence: `README.md`)
- Mode launcher → JEV classifier: configures (evidence: `main.py`)
- Mode launcher → Tabbed dashboard: creates (evidence: `main.py`)
- Mode launcher → User listener: selects mode (evidence: `main.py`)
- Mode launcher → Bot listener: selects mode (evidence: `main.py`)
- Mode launcher → Sample-message simulation: selects mode (evidence: `main.py`)
- Sample-message simulation → JEV classifier: classifies (evidence: `main.py`)
- Sample-message simulation → Tabbed dashboard: adds results (evidence: `main.py`)
- User listener → Telegram user service: monitors (evidence: `user_listener.py`)
- Bot listener → Telegram Bot API: polls (evidence: `bot_listener.py`)
- User listener → JEV classifier: classifies (evidence: `user_listener.py`)
- Bot listener → JEV classifier: classifies (evidence: `bot_listener.py`)
- Bot listener → JEV classifier: reloads categories (evidence: `bot_listener.py`)
- User listener → Tabbed dashboard: adds results (evidence: `user_listener.py`)
- Bot listener → Tabbed dashboard: adds results (evidence: `bot_listener.py`)
- JEV classifier → Category definitions: loads (evidence: `classifier.py`)
- JEV classifier → TypeSafe AI service: requests classification (evidence: `classifier.py`)
- Tabbed dashboard → Terminal user: renders feed (evidence: `cli_dashboard.py`)
- Keyboard controls → Tabbed dashboard: changes tabs (evidence: `cli_dashboard.py`)
- Operator → Keyboard controls: navigates (evidence: `README.md`)
