# enerikk/supporttickettriage architecture

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

- Interactive diagram: https://gitdiagram.com/enerikk/supporttickettriage
- Repository: https://github.com/enerikk/supporttickettriage

## Overview

Support Ticket Triage accepts tickets, classifies and embeds them, and uses independent score and similarity gates to decide whether a human should triage them or request a grounded draft. Drafts are checked against the exact retrieved evidence before review; approval makes the final text a resolution and admits the ticket to the future retrieval corpus. The React UI supports queue and review work, while a separate evaluation harness measures retrieval. Workflow links rely on the README; sampled code and the SOURCE INDEX support internal service and persistence links.

Main entry points: [`src/SupportTicketTriage.Api/Endpoints/TicketEndpoints.cs`](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Api/Endpoints/TicketEndpoints.cs) (Ticket API), [`src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs`](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs) (Draft generation), [`src/SupportTicketTriage.Infrastructure/Persistence/SupportTicketTriageDbContext.cs`](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Persistence/SupportTicketTriageDbContext.cs) (Triage database), [`src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs`](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs) (Review service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and routing"]
  node_api["Ticket API<br/>[TicketEndpoints.cs]"]
  node_redactor["PII redactor<br/>[PiiRedactor.cs]"]
  node_embedding["Ticket embedding"]
  node_classification["Ticket classification"]
  node_routing["Routing gates"]
end

subgraph group_grounding["Grounded drafting"]
  node_retrieval["Similar-ticket retrieval"]
  node_draft["Draft generation"]
  node_validation["Citation validation"]
end

subgraph group_review["Human review"]
  node_reviewservice["Review service"]
  node_reviewlogic["Review submission rules"]
  node_client["Review UI<br/>[App.tsx]"]
  node_queue["Ticket queue<br/>[TicketQueue.tsx]"]
  node_detail["Ticket detail<br/>[TicketDetail.tsx]"]
  node_actions["Review actions<br/>[ReviewActions.tsx]"]
end

subgraph group_data["Domain and persistence"]
  node_ticket["Ticket state<br/>[Ticket.cs]"]
  node_database[("Triage database")]
end

subgraph group_evaluation["Retrieval evaluation"]
  node_eval["Evaluation runner<br/>[Program.cs]"]
  node_dataset["Evaluation dataset<br/>[EvalDataset.cs]"]
  node_metrics["Retrieval metrics"]
end

node_user(("Support agent"))
node_azure{{"Azure OpenAI"}}

node_user -->|"submits ticket"| node_api
node_api -->|"persists ticket"| node_ticket
node_api -->|"requests embedding"| node_embedding
node_api -->|"requests classification"| node_classification
node_embedding -->|"redacts text"| node_redactor
node_classification -->|"redacts text"| node_redactor
node_embedding -->|"requests vectors"| node_azure
node_classification -->|"requests classification"| node_azure
node_embedding -->|"stores vector"| node_database
node_classification -->|"stores result"| node_database
node_api -->|"evaluates gates"| node_routing
node_routing -->|"checks similarity"| node_retrieval
node_routing -->|"reads score; records decision"| node_database
node_user -->|"uses review UI"| node_client
node_client -->|"renders"| node_queue
node_client -->|"renders"| node_detail
node_detail -->|"renders"| node_actions
node_client -.->|"loads and updates tickets"| node_api
node_api -->|"requests draft"| node_draft
node_draft -->|"retrieves evidence"| node_retrieval
node_draft -->|"redacts prompt text"| node_redactor
node_draft -->|"requests draft"| node_azure
node_draft -->|"checks citations"| node_validation
node_draft -->|"stores draft"| node_database
node_retrieval -->|"reads resolved neighbors"| node_database
node_user -->|"submits review"| node_api
node_api -->|"records decision"| node_reviewservice
node_reviewservice -->|"validates submission"| node_reviewlogic
node_reviewservice -->|"sets resolution"| node_ticket
node_reviewservice -->|"commits review"| node_database
node_reviewservice -->|"backfills if missing"| node_embedding
node_eval -->|"loads examples"| node_dataset
node_eval -->|"runs retrieval"| node_retrieval
node_eval -.->|"scores recall"| node_metrics
node_eval -->|"loads test corpus"| node_database

click node_api "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Api/Endpoints/TicketEndpoints.cs"
click node_ticket "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Domain/Ticket.cs"
click node_redactor "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Application/Redaction/PiiRedactor.cs"
click node_embedding "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketEmbeddingService.cs"
click node_classification "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketClassificationService.cs"
click node_routing "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Routing/TicketRoutingService.cs"
click node_retrieval "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Retrieval/TicketRetrievalService.cs"
click node_draft "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs"
click node_validation "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Application/Generation/CitationValidation.cs"
click node_reviewservice "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs"
click node_reviewlogic "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Application/Review/ReviewSubmission.cs"
click node_client "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/App.tsx"
click node_queue "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/features/queue/TicketQueue.tsx"
click node_detail "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/features/ticket/TicketDetail.tsx"
click node_actions "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/features/ticket/ReviewActions.tsx"
click node_database "https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Persistence/SupportTicketTriageDbContext.cs"
click node_eval "https://github.com/enerikk/supporttickettriage/blob/main/tools/SupportTicketTriage.Eval/Program.cs"
click node_dataset "https://github.com/enerikk/supporttickettriage/blob/main/tools/SupportTicketTriage.Eval/Dataset/EvalDataset.cs"
click node_metrics "https://github.com/enerikk/supporttickettriage/blob/main/tools/SupportTicketTriage.Eval/Metrics/RetrievalMetrics.cs"

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_redactor,node_embedding,node_classification,node_routing toneBlue
class node_retrieval,node_draft,node_validation toneAmber
class node_reviewservice,node_reviewlogic,node_client,node_queue,node_detail,node_actions toneMint
class node_ticket,node_database toneRose
class node_eval,node_dataset,node_metrics,node_user,node_azure toneIndigo
```

## Components

### Intake and routing

- [Ticket API](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Api/Endpoints/TicketEndpoints.cs): `src/SupportTicketTriage.Api/Endpoints/TicketEndpoints.cs`
- [PII redactor](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Application/Redaction/PiiRedactor.cs): `src/SupportTicketTriage.Application/Redaction/PiiRedactor.cs`
- [Ticket embedding](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketEmbeddingService.cs): `src/SupportTicketTriage.Infrastructure/Ai/TicketEmbeddingService.cs`
- [Ticket classification](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketClassificationService.cs): `src/SupportTicketTriage.Infrastructure/Ai/TicketClassificationService.cs`
- [Routing gates](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Routing/TicketRoutingService.cs): `src/SupportTicketTriage.Infrastructure/Routing/TicketRoutingService.cs`

### Grounded drafting

- [Similar-ticket retrieval](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Retrieval/TicketRetrievalService.cs): `src/SupportTicketTriage.Infrastructure/Retrieval/TicketRetrievalService.cs`
- [Draft generation](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs): `src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs`
- [Citation validation](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Application/Generation/CitationValidation.cs): `src/SupportTicketTriage.Application/Generation/CitationValidation.cs`

### Human review

- [Review service](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs): `src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs`
- [Review submission rules](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Application/Review/ReviewSubmission.cs): `src/SupportTicketTriage.Application/Review/ReviewSubmission.cs`
- [Review UI](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/App.tsx): `src/SupportTicketTriage.Client/src/App.tsx`
- [Ticket queue](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/features/queue/TicketQueue.tsx): `src/SupportTicketTriage.Client/src/features/queue/TicketQueue.tsx`
- [Ticket detail](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/features/ticket/TicketDetail.tsx): `src/SupportTicketTriage.Client/src/features/ticket/TicketDetail.tsx`
- [Review actions](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Client/src/features/ticket/ReviewActions.tsx): `src/SupportTicketTriage.Client/src/features/ticket/ReviewActions.tsx`

### Domain and persistence

- [Ticket state](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Domain/Ticket.cs): `src/SupportTicketTriage.Domain/Ticket.cs`
- [Triage database](https://github.com/enerikk/supporttickettriage/blob/main/src/SupportTicketTriage.Infrastructure/Persistence/SupportTicketTriageDbContext.cs): `src/SupportTicketTriage.Infrastructure/Persistence/SupportTicketTriageDbContext.cs`

### Retrieval evaluation

- [Evaluation runner](https://github.com/enerikk/supporttickettriage/blob/main/tools/SupportTicketTriage.Eval/Program.cs): `tools/SupportTicketTriage.Eval/Program.cs`
- [Evaluation dataset](https://github.com/enerikk/supporttickettriage/blob/main/tools/SupportTicketTriage.Eval/Dataset/EvalDataset.cs): `tools/SupportTicketTriage.Eval/Dataset/EvalDataset.cs`
- [Retrieval metrics](https://github.com/enerikk/supporttickettriage/blob/main/tools/SupportTicketTriage.Eval/Metrics/RetrievalMetrics.cs): `tools/SupportTicketTriage.Eval/Metrics/RetrievalMetrics.cs`

### Other components

- **Support agent**
- **Azure OpenAI**

## Connections

- Support agent → Ticket API: submits ticket
- Ticket API → Ticket state: persists ticket
- Ticket API → Ticket embedding: requests embedding
- Ticket API → Ticket classification: requests classification
- Ticket embedding → PII redactor: redacts text (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketEmbeddingService.cs`)
- Ticket classification → PII redactor: redacts text (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketClassificationService.cs`)
- Ticket embedding → Azure OpenAI: requests vectors
- Ticket classification → Azure OpenAI: requests classification
- Ticket embedding → Triage database: stores vector (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketEmbeddingService.cs`)
- Ticket classification → Triage database: stores result (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketClassificationService.cs`)
- Ticket API → Routing gates: evaluates gates
- Routing gates → Similar-ticket retrieval: checks similarity (evidence: `src/SupportTicketTriage.Infrastructure/Routing/TicketRoutingService.cs`)
- Routing gates → Triage database: reads score; records decision (evidence: `src/SupportTicketTriage.Infrastructure/Routing/TicketRoutingService.cs`)
- Support agent → Review UI: uses review UI
- Review UI → Ticket queue: renders (evidence: `src/SupportTicketTriage.Client/src/App.tsx`)
- Review UI → Ticket detail: renders (evidence: `src/SupportTicketTriage.Client/src/App.tsx`)
- Ticket detail → Review actions: renders (evidence: `src/SupportTicketTriage.Client/src/features/ticket/ReviewActions.tsx`)
- Review UI → Ticket API: loads and updates tickets
- Ticket API → Draft generation: requests draft
- Draft generation → Similar-ticket retrieval: retrieves evidence (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs`)
- Draft generation → PII redactor: redacts prompt text (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs`)
- Draft generation → Azure OpenAI: requests draft
- Draft generation → Citation validation: checks citations (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs`)
- Draft generation → Triage database: stores draft (evidence: `src/SupportTicketTriage.Infrastructure/Ai/TicketDraftService.cs`)
- Similar-ticket retrieval → Triage database: reads resolved neighbors (evidence: `src/SupportTicketTriage.Infrastructure/Retrieval/TicketRetrievalService.cs`)
- Support agent → Ticket API: submits review
- Ticket API → Review service: records decision
- Review service → Review submission rules: validates submission (evidence: `src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs`)
- Review service → Ticket state: sets resolution (evidence: `src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs`)
- Review service → Triage database: commits review (evidence: `src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs`)
- Review service → Ticket embedding: backfills if missing (evidence: `src/SupportTicketTriage.Infrastructure/Review/TicketReviewService.cs`)
- Evaluation runner → Evaluation dataset: loads examples (evidence: `tools/SupportTicketTriage.Eval/Program.cs`)
- Evaluation runner → Similar-ticket retrieval: runs retrieval (evidence: `tools/SupportTicketTriage.Eval/Program.cs`)
- Evaluation runner → Retrieval metrics: scores recall
- Evaluation runner → Triage database: loads test corpus (evidence: `tools/SupportTicketTriage.Eval/Program.cs`)
