# auriny/ai-together architecture

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

- Interactive diagram: https://gitdiagram.com/auriny/ai-together
- Repository: https://github.com/auriny/ai-together

## Overview

omsk-together processes municipal complaint spreadsheets through an asynchronous Java-to-LLM workflow: upload and batch incidents, classify and filter them, aggregate by district and topic, generate district and global summaries, then return a ZIP of Excel and Word reports. The README also describes anonymization and an optional Gradio interface. The sampled excerpts show summarization prompts instructing removal of personal names, but do not establish a separate anonymization stage. The UI and controller behavior are only partly evidenced, so links beyond documented capabilities are omitted.

Main entry points: [`llm/main.py`](https://github.com/auriny/ai-together/blob/main/llm/main.py) (Batch workers), [`core/src/main/java/ru/auriny/core/service/ExcelService.java`](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/service/ExcelService.java) (Spreadsheet processing), [`llm/queue_client/redis.py`](https://github.com/auriny/ai-together/blob/main/llm/queue_client/redis.py) (LLM Redis client), [`llm/pipeline/processor/qwen.py`](https://github.com/auriny/ai-together/blob/main/llm/pipeline/processor/qwen.py) (Summary pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and export"]
  node_controller["Incident API"]
  node_excel["Spreadsheet processing<br/>[ExcelService.java]"]
  node_incident["Incident records<br/>[IncidentRow.java]"]
  node_reportrow["Report rows"]
  node_reportresult["Report response<br/>[ReportResult.java]"]
end

subgraph group_handoff["Queue handoff"]
  node_corequeue["Core Redis client"]
  node_redis[("Redis queues")]
  node_batch["Task batch<br/>[batch.py]"]
  node_llmqueue["LLM Redis client<br/>[redis.py]"]
  node_settings["Model and Redis settings<br/>[settings.py]"]
end

subgraph group_classification["Classification"]
  node_worker["Batch workers<br/>[main.py]"]
  node_classifier["Classification pipeline<br/>[rubert.py]"]
  node_rubert["RuBERT inference<br/>[rubert.py]"]
  node_labels["Classification labels<br/>[labels.py]"]
end

subgraph group_summaries["Analysis and summaries"]
  node_aggregation["District aggregation<br/>[temp_storages.py]"]
  node_qwenpipe["Summary pipeline<br/>[qwen.py]"]
  node_qwen["Qwen generation<br/>[qwen.py]"]
  node_summary["Summary records<br/>[summary.py]"]
end

subgraph group_presentation["User interface"]
  node_webui["Gradio web interface<br/>[web_ui.py]"]
  node_download(("Report download"))
end

node_user(("Municipal analyst"))

node_user -->|"uploads workbook"| node_controller
node_controller -->|"delegates processing"| node_excel
node_excel -->|"creates records"| node_incident
node_excel -->|"pushes batches"| node_corequeue
node_corequeue -->|"writes and reads"| node_redis
node_llmqueue -->|"pops and pushes"| node_redis
node_llmqueue -->|"validates task"| node_batch
node_worker -->|"receives tasks"| node_llmqueue
node_worker -->|"classifies batch"| node_classifier
node_classifier -->|"filters text"| node_rubert
node_classifier -->|"filters labels"| node_labels
node_worker -->|"accumulates incidents"| node_aggregation
node_worker -->|"summarizes districts"| node_qwenpipe
node_qwenpipe -->|"generates summaries"| node_qwen
node_qwenpipe -->|"reads topic statistics"| node_aggregation
node_qwenpipe -->|"creates summary records"| node_summary
node_worker -->|"publishes results"| node_llmqueue
node_excel -->|"renders report rows"| node_reportrow
node_excel -->|"returns ZIP result"| node_reportresult
node_corequeue -->|"decodes queued results"| node_reportrow
node_controller -->|"returns response"| node_reportresult
node_user -.->|"uses interface"| node_webui
node_webui -.->|"submits analysis"| node_controller
node_user -->|"downloads archive"| node_download
node_settings -->|"configures model"| node_rubert
node_settings -->|"configures model"| node_qwen
node_settings -->|"configures Redis"| node_llmqueue

click node_controller "https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/controller/IncidentController.java"
click node_excel "https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/service/ExcelService.java"
click node_incident "https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/dto/IncidentRow.java"
click node_reportrow "https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/dto/FinalReportRow.java"
click node_reportresult "https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/dto/ReportResult.java"
click node_corequeue "https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/service/AiQueueService.java"
click node_batch "https://github.com/auriny/ai-together/blob/main/llm/dto/batch.py"
click node_llmqueue "https://github.com/auriny/ai-together/blob/main/llm/queue_client/redis.py"
click node_worker "https://github.com/auriny/ai-together/blob/main/llm/main.py"
click node_classifier "https://github.com/auriny/ai-together/blob/main/llm/pipeline/classifier/rubert.py"
click node_rubert "https://github.com/auriny/ai-together/blob/main/llm/models/classifier/rubert.py"
click node_labels "https://github.com/auriny/ai-together/blob/main/llm/enums/labels.py"
click node_aggregation "https://github.com/auriny/ai-together/blob/main/llm/dto/temp_storages.py"
click node_qwenpipe "https://github.com/auriny/ai-together/blob/main/llm/pipeline/processor/qwen.py"
click node_qwen "https://github.com/auriny/ai-together/blob/main/llm/models/processor/qwen.py"
click node_summary "https://github.com/auriny/ai-together/blob/main/llm/dto/summary.py"
click node_settings "https://github.com/auriny/ai-together/blob/main/llm/settings.py"
click node_webui "https://github.com/auriny/ai-together/blob/main/llm/web_ui.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_controller,node_excel,node_incident,node_reportrow,node_reportresult toneBlue
class node_corequeue,node_redis,node_batch,node_llmqueue,node_settings toneAmber
class node_worker,node_classifier,node_rubert,node_labels toneMint
class node_aggregation,node_qwenpipe,node_qwen,node_summary toneRose
class node_webui,node_download,node_user toneIndigo
```

## Components

### Intake and export

- [Incident API](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/controller/IncidentController.java): `core/src/main/java/ru/auriny/core/controller/IncidentController.java`
- [Spreadsheet processing](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/service/ExcelService.java): `core/src/main/java/ru/auriny/core/service/ExcelService.java`
- [Incident records](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/dto/IncidentRow.java): `core/src/main/java/ru/auriny/core/dto/IncidentRow.java`
- [Report rows](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/dto/FinalReportRow.java): `core/src/main/java/ru/auriny/core/dto/FinalReportRow.java`
- [Report response](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/dto/ReportResult.java): `core/src/main/java/ru/auriny/core/dto/ReportResult.java`

### Queue handoff

- [Core Redis client](https://github.com/auriny/ai-together/blob/main/core/src/main/java/ru/auriny/core/service/AiQueueService.java): `core/src/main/java/ru/auriny/core/service/AiQueueService.java`
- **Redis queues**
- [Task batch](https://github.com/auriny/ai-together/blob/main/llm/dto/batch.py): `llm/dto/batch.py`
- [LLM Redis client](https://github.com/auriny/ai-together/blob/main/llm/queue_client/redis.py): `llm/queue_client/redis.py`
- [Model and Redis settings](https://github.com/auriny/ai-together/blob/main/llm/settings.py): `llm/settings.py`

### Classification

- [Batch workers](https://github.com/auriny/ai-together/blob/main/llm/main.py): `llm/main.py`
- [Classification pipeline](https://github.com/auriny/ai-together/blob/main/llm/pipeline/classifier/rubert.py): `llm/pipeline/classifier/rubert.py`
- [RuBERT inference](https://github.com/auriny/ai-together/blob/main/llm/models/classifier/rubert.py): `llm/models/classifier/rubert.py`
- [Classification labels](https://github.com/auriny/ai-together/blob/main/llm/enums/labels.py): `llm/enums/labels.py`

### Analysis and summaries

- [District aggregation](https://github.com/auriny/ai-together/blob/main/llm/dto/temp_storages.py): `llm/dto/temp_storages.py`
- [Summary pipeline](https://github.com/auriny/ai-together/blob/main/llm/pipeline/processor/qwen.py): `llm/pipeline/processor/qwen.py`
- [Qwen generation](https://github.com/auriny/ai-together/blob/main/llm/models/processor/qwen.py): `llm/models/processor/qwen.py`
- [Summary records](https://github.com/auriny/ai-together/blob/main/llm/dto/summary.py): `llm/dto/summary.py`

### User interface

- [Gradio web interface](https://github.com/auriny/ai-together/blob/main/llm/web_ui.py): `llm/web_ui.py`
- **Report download**

### Other components

- **Municipal analyst**

## Connections

- Municipal analyst → Incident API: uploads workbook (evidence: `README.md`)
- Incident API → Spreadsheet processing: delegates processing (evidence: `core/src/main/java/ru/auriny/core/controller/IncidentController.java`)
- Spreadsheet processing → Incident records: creates records (evidence: `core/src/main/java/ru/auriny/core/service/ExcelService.java`)
- Spreadsheet processing → Core Redis client: pushes batches (evidence: `core/src/main/java/ru/auriny/core/service/ExcelService.java`)
- Core Redis client → Redis queues: writes and reads (evidence: `core/src/main/java/ru/auriny/core/service/AiQueueService.java`)
- LLM Redis client → Redis queues: pops and pushes (evidence: `llm/queue_client/redis.py`)
- LLM Redis client → Task batch: validates task (evidence: `llm/queue_client/redis.py`)
- Batch workers → LLM Redis client: receives tasks (evidence: `llm/main.py`)
- Batch workers → Classification pipeline: classifies batch (evidence: `llm/main.py`)
- Classification pipeline → RuBERT inference: filters text (evidence: `llm/pipeline/classifier/rubert.py`)
- Classification pipeline → Classification labels: filters labels (evidence: `llm/pipeline/classifier/rubert.py`)
- Batch workers → District aggregation: accumulates incidents (evidence: `llm/main.py`)
- Batch workers → Summary pipeline: summarizes districts (evidence: `llm/main.py`)
- Summary pipeline → Qwen generation: generates summaries (evidence: `llm/pipeline/processor/qwen.py`)
- Summary pipeline → District aggregation: reads topic statistics (evidence: `llm/pipeline/processor/qwen.py`)
- Summary pipeline → Summary records: creates summary records (evidence: `llm/pipeline/processor/qwen.py`)
- Batch workers → LLM Redis client: publishes results (evidence: `llm/main.py`)
- Spreadsheet processing → Report rows: renders report rows (evidence: `core/src/main/java/ru/auriny/core/service/ExcelService.java`)
- Spreadsheet processing → Report response: returns ZIP result (evidence: `core/src/main/java/ru/auriny/core/service/ExcelService.java`)
- Core Redis client → Report rows: decodes queued results (evidence: `core/src/main/java/ru/auriny/core/service/ExcelService.java`)
- Incident API → Report response: returns response (evidence: `core/src/main/java/ru/auriny/core/controller/IncidentController.java`)
- Municipal analyst → Gradio web interface: uses interface (evidence: `README.md`)
- Gradio web interface → Incident API: submits analysis
- Municipal analyst → Report download: downloads archive (evidence: `README.md`)
- Model and Redis settings → RuBERT inference: configures model (evidence: `llm/models/classifier/rubert.py`)
- Model and Redis settings → Qwen generation: configures model (evidence: `llm/models/processor/qwen.py`)
- Model and Redis settings → LLM Redis client: configures Redis (evidence: `llm/queue_client/redis.py`)
