# tanishvenpure/ticket-triage-transformer architecture

> Architecture diagram of the GitHub repository tanishvenpure/ticket-triage-transformer, 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/tanishvenpure/ticket-triage-transformer
- Repository: https://github.com/tanishvenpure/ticket-triage-transformer

## Overview

This is a support-ticket triage product: a user submits ticket text through the Streamlit chat/dashboard or directly to the FastAPI API; the API validates it, obtains category and urgency predictions from the ONNX inference service, then applies transparent routing rules to return priority, action, required skills, and a matched agent. A separate model-development branch cleans ticket data, evaluates a baseline, fine-tunes a multi-task transformer, and prepares and calibrates the deployed model. The README documents these product stages; unsampled implementation details and external deployment wiring are not inferred.

Main entry points: [`app/main.py`](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/main.py) (FastAPI endpoints), [`models`](https://github.com/tanishvenpure/ticket-triage-transformer/tree/main/models) (Model artifacts), [`src/train.py`](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/train.py) (Fine-tuning loop), [`app/inference.py`](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/inference.py) (ONNX inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Ticket interface"]
  node_dashboard["Chat and dashboard<br/>[app.py]"]
end

subgraph group_service["Triage service"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_inference["ONNX inference<br/>[inference.py]"]
  node_routing["Routing decisions<br/>[routing.py]"]
  node_outputs["Triage response<br/>[main.py]"]
end

subgraph group_development["Model development"]
  node_cleaning["Ticket cleaning<br/>[load_and_clean.py]"]
  node_clean_data["Clean ticket data<br/>[tickets_clean.csv]"]
  node_baseline["Baseline evaluation<br/>[baseline.py]"]
  node_dataset["Training dataset<br/>[dataset.py]"]
  node_training["Fine-tuning loop<br/>[train.py]"]
  node_classifier["Multi-task classifier<br/>[model.py]"]
end

subgraph group_preparation["Serving preparation"]
  node_onnxprep["ONNX export and benchmark"]
  node_quantcheck["Quantization accuracy check"]
  node_calibration["Temperature calibration<br/>[calibrate.py]"]
  node_model_artifacts["Model artifacts"]
  node_calibration_data["Calibration settings<br/>[calibration.json]"]
end

node_user(("Ticket submitter"))

node_user -->|"submits ticket"| node_dashboard
node_dashboard -->|"requests prediction"| node_api
node_user -->|"posts ticket"| node_api
node_api -->|"classifies text"| node_inference
node_api -->|"gets routing"| node_routing
node_api -->|"returns result"| node_outputs
node_inference -->|"loads model and labels"| node_model_artifacts
node_inference -->|"loads temperatures"| node_calibration_data
node_routing -->|"adds decisions"| node_outputs
node_cleaning -->|"writes cleaned data"| node_clean_data
node_clean_data -->|"evaluates baseline"| node_baseline
node_clean_data -.->|"trains on data"| node_training
node_training -->|"uses batches"| node_dataset
node_training -->|"trains model"| node_classifier
node_training -.->|"saves checkpoint"| node_model_artifacts
node_model_artifacts -->|"exports ONNX"| node_onnxprep
node_onnxprep -->|"writes ONNX"| node_model_artifacts
node_onnxprep -->|"checks accuracy"| node_quantcheck
node_model_artifacts -->|"calibrates predictions"| node_calibration
node_calibration -->|"writes temperatures"| node_calibration_data

click node_dashboard "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/dashboard/app.py"
click node_api "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/main.py"
click node_inference "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/inference.py"
click node_routing "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/routing.py"
click node_outputs "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/main.py"
click node_cleaning "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/load_and_clean.py"
click node_clean_data "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/data/processed/tickets_clean.csv"
click node_baseline "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/baseline.py"
click node_dataset "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/dataset.py"
click node_training "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/train.py"
click node_classifier "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/model.py"
click node_onnxprep "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/quantize_and_benchmark.py"
click node_quantcheck "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/check_quantized_accuracy.py"
click node_calibration "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/calibrate.py"
click node_model_artifacts "https://github.com/tanishvenpure/ticket-triage-transformer/tree/main/models"
click node_calibration_data "https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/results/calibration.json"

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_dashboard toneBlue
class node_api,node_inference,node_routing,node_outputs toneAmber
class node_cleaning,node_clean_data,node_baseline,node_dataset,node_training,node_classifier toneMint
class node_onnxprep,node_quantcheck,node_calibration,node_model_artifacts,node_calibration_data toneRose
class node_user toneIndigo
```

## Components

### Ticket interface

- [Chat and dashboard](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/dashboard/app.py): `dashboard/app.py`

### Triage service

- [FastAPI endpoints](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/main.py): `app/main.py`
- [ONNX inference](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/inference.py): `app/inference.py`
- [Routing decisions](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/routing.py): `app/routing.py`
- [Triage response](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/app/main.py): `app/main.py`

### Model development

- [Ticket cleaning](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/load_and_clean.py): `src/load_and_clean.py`
- [Clean ticket data](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/data/processed/tickets_clean.csv): `data/processed/tickets_clean.csv`
- [Baseline evaluation](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/baseline.py): `src/baseline.py`
- [Training dataset](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/dataset.py): `src/dataset.py`
- [Fine-tuning loop](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/train.py): `src/train.py`
- [Multi-task classifier](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/model.py): `src/model.py`

### Serving preparation

- [ONNX export and benchmark](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/quantize_and_benchmark.py): `src/quantize_and_benchmark.py`
- [Quantization accuracy check](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/check_quantized_accuracy.py): `src/check_quantized_accuracy.py`
- [Temperature calibration](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/src/calibrate.py): `src/calibrate.py`
- [Model artifacts](https://github.com/tanishvenpure/ticket-triage-transformer/tree/main/models): `models`
- [Calibration settings](https://github.com/tanishvenpure/ticket-triage-transformer/blob/main/results/calibration.json): `results/calibration.json`

### Other components

- **Ticket submitter**

## Connections

- Ticket submitter → Chat and dashboard: submits ticket (evidence: `readme.md`)
- Chat and dashboard → FastAPI endpoints: requests prediction (evidence: `dashboard/app.py`)
- Ticket submitter → FastAPI endpoints: posts ticket (evidence: `readme.md`)
- FastAPI endpoints → ONNX inference: classifies text (evidence: `app/main.py`)
- FastAPI endpoints → Routing decisions: gets routing (evidence: `app/main.py`)
- FastAPI endpoints → Triage response: returns result (evidence: `app/main.py`)
- ONNX inference → Model artifacts: loads model and labels (evidence: `app/inference.py`)
- ONNX inference → Calibration settings: loads temperatures (evidence: `app/inference.py`)
- Routing decisions → Triage response: adds decisions (evidence: `app/routing.py`)
- Ticket cleaning → Clean ticket data: writes cleaned data (evidence: `readme.md`)
- Clean ticket data → Baseline evaluation: evaluates baseline (evidence: `readme.md`)
- Clean ticket data → Fine-tuning loop: trains on data
- Fine-tuning loop → Training dataset: uses batches (evidence: `src/train.py`)
- Fine-tuning loop → Multi-task classifier: trains model (evidence: `src/train.py`)
- Fine-tuning loop → Model artifacts: saves checkpoint
- Model artifacts → ONNX export and benchmark: exports ONNX (evidence: `readme.md`)
- ONNX export and benchmark → Model artifacts: writes ONNX (evidence: `src/quantize_and_benchmark.py`)
- ONNX export and benchmark → Quantization accuracy check: checks accuracy (evidence: `readme.md`)
- Model artifacts → Temperature calibration: calibrates predictions (evidence: `readme.md`)
- Temperature calibration → Calibration settings: writes temperatures (evidence: `src/calibrate.py`)
