# jbajady/ai-guest-rescue-system architecture

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

- Interactive diagram: https://gitdiagram.com/jbajady/ai-guest-rescue-system
- Repository: https://github.com/jbajady/ai-guest-rescue-system

## Overview

The project classifies stranded-guest tickets, prioritizing safety signals, then assigns a ticket type and its agent/tool policy. Its documented batch workflow reads the Lisbon CSV and writes detailed sorted output plus ticket-type assignments. The package also exposes canonical ticket-type definitions. The sampled code shows no live booking or safety-agent integration; these are represented as policy metadata, not runtime services.

Main entry points: [`src/ai_guest_rescue_system/triage.py`](https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py) (Ticket CSV processing), [`scripts/sort_lisbon_tickets.py`](https://github.com/jbajady/ai-guest-rescue-system/blob/main/scripts/sort_lisbon_tickets.py) (Sort tickets CLI), [`data/lisbon_stranded_guest_tickets_2026-11-16.csv`](https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/lisbon_stranded_guest_tickets_2026-11-16.csv) (Lisbon ticket input), [`data/lisbon_tickets_sorted.csv`](https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/lisbon_tickets_sorted.csv) (Detailed sorted output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Batch workflow"]
  node_sort_cli["Sort tickets CLI"]
  node_input_csv["Lisbon ticket input"]
  node_sorted_csv["Detailed sorted output"]
  node_assignments_csv["Type assignments"]
end

subgraph group_classification["Ticket classification"]
  node_triage_io["Ticket CSV processing<br/>[triage.py]"]
  node_signal_detection["Safety signal detection<br/>[triage.py]"]
  node_ticket_classification["Ticket classification<br/>[triage.py]"]
end

subgraph group_policy["Ticket policy"]
  node_type_metadata["Canonical type definitions<br/>[ticket_types.py]"]
end

node_operator(("Operator"))

node_operator -->|"runs"| node_sort_cli
node_sort_cli -->|"calls writers"| node_triage_io
node_triage_io -->|"reads rows"| node_input_csv
node_triage_io -->|"checks signals"| node_signal_detection
node_triage_io -->|"classifies rows"| node_ticket_classification
node_triage_io -->|"writes results"| node_sorted_csv
node_triage_io -->|"writes mappings"| node_assignments_csv

click node_sort_cli "https://github.com/jbajady/ai-guest-rescue-system/blob/main/scripts/sort_lisbon_tickets.py"
click node_triage_io "https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py"
click node_signal_detection "https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py"
click node_ticket_classification "https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py"
click node_type_metadata "https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/ticket_types.py"
click node_input_csv "https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/lisbon_stranded_guest_tickets_2026-11-16.csv"
click node_sorted_csv "https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/lisbon_tickets_sorted.csv"
click node_assignments_csv "https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/ticket_type_assignments.csv"

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_sort_cli,node_input_csv,node_sorted_csv,node_assignments_csv toneBlue
class node_triage_io,node_signal_detection,node_ticket_classification toneAmber
class node_type_metadata toneMint
class node_operator toneIndigo
```

## Components

### Batch workflow

- [Sort tickets CLI](https://github.com/jbajady/ai-guest-rescue-system/blob/main/scripts/sort_lisbon_tickets.py): `scripts/sort_lisbon_tickets.py`
- [Lisbon ticket input](https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/lisbon_stranded_guest_tickets_2026-11-16.csv): `data/lisbon_stranded_guest_tickets_2026-11-16.csv`
- [Detailed sorted output](https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/lisbon_tickets_sorted.csv): `data/lisbon_tickets_sorted.csv`
- [Type assignments](https://github.com/jbajady/ai-guest-rescue-system/blob/main/data/ticket_type_assignments.csv): `data/ticket_type_assignments.csv`

### Ticket classification

- [Ticket CSV processing](https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py): `src/ai_guest_rescue_system/triage.py`
- [Safety signal detection](https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py): `src/ai_guest_rescue_system/triage.py`
- [Ticket classification](https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/triage.py): `src/ai_guest_rescue_system/triage.py`

### Ticket policy

- [Canonical type definitions](https://github.com/jbajady/ai-guest-rescue-system/blob/main/src/ai_guest_rescue_system/ticket_types.py): `src/ai_guest_rescue_system/ticket_types.py`

### Other components

- **Operator**

## Connections

- Operator → Sort tickets CLI: runs (evidence: `README.md`)
- Sort tickets CLI → Ticket CSV processing: calls writers (evidence: `scripts/sort_lisbon_tickets.py`)
- Ticket CSV processing → Lisbon ticket input: reads rows (evidence: `src/ai_guest_rescue_system/triage.py`)
- Ticket CSV processing → Safety signal detection: checks signals (evidence: `src/ai_guest_rescue_system/triage.py`)
- Ticket CSV processing → Ticket classification: classifies rows (evidence: `src/ai_guest_rescue_system/triage.py`)
- Ticket CSV processing → Detailed sorted output: writes results (evidence: `src/ai_guest_rescue_system/triage.py`)
- Ticket CSV processing → Type assignments: writes mappings (evidence: `src/ai_guest_rescue_system/triage.py`)
