# roshika1235/customersupportsystem architecture

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

- Interactive diagram: https://gitdiagram.com/roshika1235/customersupportsystem
- Repository: https://github.com/roshika1235/customersupportsystem

## Overview

This repository is a customer-support desk: agents submit tickets, receive ML triage and similar-ticket context, then get an LLM-generated summary, draft reply, and recommended actions. Tickets and analyses are saved so agents can track status and review history; a dashboard summarizes saved-ticket trends. A separate model-preparation branch cleans and labels data and trains classifiers. The map follows documented API/UI calls and sampled backend logic; some training, prediction, and storage wiring is inferred only at subsystem level or omitted where excerpts do not establish it.

Main entry points: [`main_fastapi.py`](https://github.com/roshika1235/customersupportsystem/blob/main/main_fastapi.py) (FastAPI service), [`app.py`](https://github.com/roshika1235/customersupportsystem/blob/main/app.py) (Streamlit navigation), [`llm_pipeline.py`](https://github.com/roshika1235/customersupportsystem/blob/main/llm_pipeline.py) (LLM analysis), [`llm_client.py`](https://github.com/roshika1235/customersupportsystem/blob/main/llm_client.py) (LLM client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Agent interface"]
  node_app["Streamlit navigation<br/>[app.py]"]
  node_new_ticket["New ticket<br/>[new_ticket.py]"]
  node_manage_tickets["Ticket management<br/>[manage_tickets.py]"]
  node_dashboard["Ticket dashboard<br/>[dashboard.py]"]
end

subgraph group_service["Ticket analysis service"]
  node_api["FastAPI service<br/>[main_fastapi.py]"]
  node_predictor["ML predictions<br/>[ml_predictor.py]"]
  node_similar["Similar-ticket search<br/>[similar_tickets.py]"]
  node_llm_pipeline["LLM analysis<br/>[llm_pipeline.py]"]
  node_suggestions["Escalation rules<br/>[suggestions.py]"]
  node_llm_client["LLM client<br/>[llm_client.py]"]
end

subgraph group_learning["Model preparation"]
  node_preprocessing["Data preparation"]
  node_labeling["LLM label generation<br/>[label_with_llm.py]"]
  node_training["Classifier training<br/>[train_pipelines.py]"]
  node_dataset["Ticket dataset"]
end

subgraph group_persistence["Ticket records"]
  node_database_helpers["Ticket persistence<br/>[database.py]"]
  node_ticket_store[("Ticket database<br/>[database.py]")]
end

node_agent(("Support agent"))
node_openrouter{{"OpenRouter"}}

node_agent -->|"uses"| node_app
node_app -->|"opens"| node_new_ticket
node_app -->|"opens"| node_manage_tickets
node_app -->|"opens"| node_dashboard
node_new_ticket -->|"submits ticket"| node_api
node_manage_tickets -->|"requests tickets"| node_api
node_dashboard -->|"requests stats"| node_api
node_api -->|"predicts labels"| node_predictor
node_api -->|"searches tickets"| node_similar
node_api -->|"runs analysis"| node_llm_pipeline
node_llm_pipeline -->|"requests completion"| node_llm_client
node_llm_pipeline -->|"checks escalation"| node_suggestions
node_llm_client -->|"sends prompt"| node_openrouter
node_labeling -->|"requests labels"| node_llm_client
node_api -->|"saves and reads"| node_database_helpers
node_database_helpers -->|"reads and writes"| node_ticket_store
node_preprocessing -->|"cleans data"| node_dataset
node_labeling -.->|"labels tickets"| node_dataset
node_training -.->|"trains from"| node_dataset

click node_app "https://github.com/roshika1235/customersupportsystem/blob/main/app.py"
click node_new_ticket "https://github.com/roshika1235/customersupportsystem/blob/main/views/new_ticket.py"
click node_manage_tickets "https://github.com/roshika1235/customersupportsystem/blob/main/views/manage_tickets.py"
click node_dashboard "https://github.com/roshika1235/customersupportsystem/blob/main/views/dashboard.py"
click node_api "https://github.com/roshika1235/customersupportsystem/blob/main/main_fastapi.py"
click node_predictor "https://github.com/roshika1235/customersupportsystem/blob/main/ml_predictor.py"
click node_similar "https://github.com/roshika1235/customersupportsystem/blob/main/similar_tickets.py"
click node_llm_pipeline "https://github.com/roshika1235/customersupportsystem/blob/main/llm_pipeline.py"
click node_suggestions "https://github.com/roshika1235/customersupportsystem/blob/main/suggestions.py"
click node_llm_client "https://github.com/roshika1235/customersupportsystem/blob/main/llm_client.py"
click node_preprocessing "https://github.com/roshika1235/customersupportsystem/blob/main/data_preprocessing.py"
click node_labeling "https://github.com/roshika1235/customersupportsystem/blob/main/label_with_llm.py"
click node_training "https://github.com/roshika1235/customersupportsystem/blob/main/train_pipelines.py"
click node_dataset "https://github.com/roshika1235/customersupportsystem/blob/main/final_dataset_customer_support.csv"
click node_database_helpers "https://github.com/roshika1235/customersupportsystem/blob/main/database.py"
click node_ticket_store "https://github.com/roshika1235/customersupportsystem/blob/main/database.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_app,node_new_ticket,node_manage_tickets,node_dashboard toneBlue
class node_api,node_predictor,node_similar,node_llm_pipeline,node_suggestions,node_llm_client toneAmber
class node_preprocessing,node_labeling,node_training,node_dataset,node_openrouter toneMint
class node_database_helpers,node_ticket_store toneRose
class node_agent toneIndigo
```

## Components

### Agent interface

- [Streamlit navigation](https://github.com/roshika1235/customersupportsystem/blob/main/app.py): `app.py`
- [New ticket](https://github.com/roshika1235/customersupportsystem/blob/main/views/new_ticket.py): `views/new_ticket.py`
- [Ticket management](https://github.com/roshika1235/customersupportsystem/blob/main/views/manage_tickets.py): `views/manage_tickets.py`
- [Ticket dashboard](https://github.com/roshika1235/customersupportsystem/blob/main/views/dashboard.py): `views/dashboard.py`

### Ticket analysis service

- [FastAPI service](https://github.com/roshika1235/customersupportsystem/blob/main/main_fastapi.py): `main_fastapi.py`
- [ML predictions](https://github.com/roshika1235/customersupportsystem/blob/main/ml_predictor.py): `ml_predictor.py`
- [Similar-ticket search](https://github.com/roshika1235/customersupportsystem/blob/main/similar_tickets.py): `similar_tickets.py`
- [LLM analysis](https://github.com/roshika1235/customersupportsystem/blob/main/llm_pipeline.py): `llm_pipeline.py`
- [Escalation rules](https://github.com/roshika1235/customersupportsystem/blob/main/suggestions.py): `suggestions.py`
- [LLM client](https://github.com/roshika1235/customersupportsystem/blob/main/llm_client.py): `llm_client.py`

### Model preparation

- [Data preparation](https://github.com/roshika1235/customersupportsystem/blob/main/data_preprocessing.py): `data_preprocessing.py`
- [LLM label generation](https://github.com/roshika1235/customersupportsystem/blob/main/label_with_llm.py): `label_with_llm.py`
- [Classifier training](https://github.com/roshika1235/customersupportsystem/blob/main/train_pipelines.py): `train_pipelines.py`
- [Ticket dataset](https://github.com/roshika1235/customersupportsystem/blob/main/final_dataset_customer_support.csv): `final_dataset_customer_support.csv`

### Ticket records

- [Ticket persistence](https://github.com/roshika1235/customersupportsystem/blob/main/database.py): `database.py`
- [Ticket database](https://github.com/roshika1235/customersupportsystem/blob/main/database.py): `database.py`

### Other components

- **Support agent**
- **OpenRouter**

## Connections

- Support agent → Streamlit navigation: uses
- Streamlit navigation → New ticket: opens
- Streamlit navigation → Ticket management: opens
- Streamlit navigation → Ticket dashboard: opens
- New ticket → FastAPI service: submits ticket
- Ticket management → FastAPI service: requests tickets
- Ticket dashboard → FastAPI service: requests stats
- FastAPI service → ML predictions: predicts labels
- FastAPI service → Similar-ticket search: searches tickets
- FastAPI service → LLM analysis: runs analysis
- LLM analysis → LLM client: requests completion
- LLM analysis → Escalation rules: checks escalation
- LLM client → OpenRouter: sends prompt
- LLM label generation → LLM client: requests labels
- FastAPI service → Ticket persistence: saves and reads
- Ticket persistence → Ticket database: reads and writes
- Data preparation → Ticket dataset: cleans data
- LLM label generation → Ticket dataset: labels tickets
- Classifier training → Ticket dataset: trains from
