# sadhithyan7/ticket-to-faq-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/sadhithyan7/ticket-to-faq-pipeline
- Repository: https://github.com/sadhithyan7/ticket-to-faq-pipeline

## Overview

Ticket → FAQ Pipeline ingests support-ticket CSVs, groups tickets into themes, drafts FAQ Markdown through a configured LLM, and persists drafts for review. Users can run and edit the workflow through the dashboard/API, the command-line runner, or MCP tools. The README documents embedding/KMeans clustering with a TF-IDF fallback; the supplied cluster.py excerpt does not show its implementation, so clustering internals are not expanded here.

Main entry points: [`src/api.py`](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/api.py) (FastAPI routes), [`mcp_server/server.py`](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/mcp_server/server.py) (MCP tools), [`src/run.py`](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/run.py) (CLI runner), [`src/write.py`](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/write.py) (Draft writer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_api["FastAPI routes<br/>[api.py]"]
  node_cli["CLI runner<br/>[run.py]"]
  node_mcp["MCP tools<br/>[server.py]"]
end

subgraph group_pipeline["FAQ pipeline"]
  node_ingest["CSV ingestion<br/>[ingest.py]"]
  node_cluster["Ticket clustering<br/>[cluster.py]"]
  node_draft["FAQ drafting<br/>[draft.py]"]
  node_llm["LLM provider<br/>[llm.py]"]
  node_config["Runtime config<br/>[config.py]"]
end

subgraph group_storage["Persistence"]
  node_writer["Draft writer<br/>[write.py]"]
  node_sqlite[("SQLite database")]
  node_markdown["Markdown drafts"]
end

subgraph group_review["Draft review"]
  node_dashboard["Review dashboard<br/>[app.js]"]
end

node_user(("Operator"))
node_provider["LLM service"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"calls API"| node_api
node_api -->|"serves UI"| node_dashboard
node_user -->|"runs"| node_cli
node_user -->|"invokes tools"| node_mcp
node_api -->|"loads tickets"| node_ingest
node_api -->|"clusters tickets"| node_cluster
node_api -->|"requests drafts"| node_draft
node_api -->|"saves drafts"| node_writer
node_cli -->|"loads tickets"| node_ingest
node_cli -->|"clusters tickets"| node_cluster
node_cli -->|"requests drafts"| node_draft
node_cli -->|"saves drafts"| node_writer
node_mcp -->|"loads tickets"| node_ingest
node_mcp -->|"clusters tickets"| node_cluster
node_mcp -->|"requests draft"| node_draft
node_mcp -->|"saves draft"| node_writer
node_draft -->|"generates text"| node_llm
node_llm -->|"calls provider"| node_provider
node_llm -->|"reads settings"| node_config
node_api -->|"reads settings"| node_config
node_ingest -->|"stores tickets"| node_sqlite
node_writer -->|"stores draft row"| node_sqlite
node_writer -->|"writes file"| node_markdown
node_api -->|"reads and updates drafts"| node_sqlite
node_mcp -->|"queries drafts"| node_sqlite

click node_dashboard "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/frontend/app.js"
click node_api "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/api.py"
click node_cli "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/run.py"
click node_mcp "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/mcp_server/server.py"
click node_ingest "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/ingest.py"
click node_cluster "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/cluster.py"
click node_draft "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/draft.py"
click node_llm "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/llm.py"
click node_config "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/config.py"
click node_writer "https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/write.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_api,node_cli,node_mcp toneBlue
class node_ingest,node_cluster,node_draft,node_llm,node_config toneAmber
class node_writer,node_sqlite,node_markdown toneMint
class node_dashboard toneRose
class node_user,node_provider toneIndigo
```

## Components

### Entry points

- [FastAPI routes](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/api.py): `src/api.py`
- [CLI runner](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/run.py): `src/run.py`
- [MCP tools](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/mcp_server/server.py): `mcp_server/server.py`

### FAQ pipeline

- [CSV ingestion](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/ingest.py): `src/ingest.py`
- [Ticket clustering](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/cluster.py): `src/cluster.py`
- [FAQ drafting](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/draft.py): `src/draft.py`
- [LLM provider](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/llm.py): `src/llm.py`
- [Runtime config](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/config.py): `src/config.py`

### Persistence

- [Draft writer](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/src/write.py): `src/write.py`
- **SQLite database**
- **Markdown drafts**

### Draft review

- [Review dashboard](https://github.com/sadhithyan7/ticket-to-faq-pipeline/blob/main/frontend/app.js): `frontend/app.js`

### Other components

- **Operator**
- **LLM service**

## Connections

- Operator → Review dashboard: uses (evidence: `frontend/app.js`)
- Review dashboard → FastAPI routes: calls API (evidence: `frontend/app.js`)
- FastAPI routes → Review dashboard: serves UI (evidence: `src/api.py`)
- Operator → CLI runner: runs (evidence: `README.md`)
- Operator → MCP tools: invokes tools (evidence: `mcp_server/server.py`)
- FastAPI routes → CSV ingestion: loads tickets (evidence: `src/api.py`)
- FastAPI routes → Ticket clustering: clusters tickets (evidence: `src/api.py`)
- FastAPI routes → FAQ drafting: requests drafts (evidence: `src/api.py`)
- FastAPI routes → Draft writer: saves drafts (evidence: `src/api.py`)
- CLI runner → CSV ingestion: loads tickets (evidence: `src/run.py`)
- CLI runner → Ticket clustering: clusters tickets (evidence: `src/run.py`)
- CLI runner → FAQ drafting: requests drafts (evidence: `src/run.py`)
- CLI runner → Draft writer: saves drafts (evidence: `src/run.py`)
- MCP tools → CSV ingestion: loads tickets (evidence: `mcp_server/server.py`)
- MCP tools → Ticket clustering: clusters tickets (evidence: `mcp_server/server.py`)
- MCP tools → FAQ drafting: requests draft (evidence: `mcp_server/server.py`)
- MCP tools → Draft writer: saves draft (evidence: `mcp_server/server.py`)
- FAQ drafting → LLM provider: generates text (evidence: `src/draft.py`)
- LLM provider → LLM service: calls provider (evidence: `src/llm.py`)
- LLM provider → Runtime config: reads settings (evidence: `src/llm.py`)
- FastAPI routes → Runtime config: reads settings (evidence: `src/api.py`)
- CSV ingestion → SQLite database: stores tickets (evidence: `src/ingest.py`)
- Draft writer → SQLite database: stores draft row (evidence: `src/write.py`)
- Draft writer → Markdown drafts: writes file (evidence: `src/write.py`)
- FastAPI routes → SQLite database: reads and updates drafts (evidence: `src/api.py`)
- MCP tools → SQLite database: queries drafts (evidence: `mcp_server/server.py`)
