# jawon02/ai architecture

> Architecture diagram of the GitHub repository jawon02/ai, 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/jawon02/ai
- Repository: https://github.com/jawon02/ai

## Overview

This repository is a single-file traffic-monitoring simulator. Its workflow reads a looping video, runs YOLO detection in a background worker, filters accident detections by box overlap, overlays results for local display, and asynchronously posts an encoded frame and traffic status to a backend when available. The graph separates video/display, detection, and backend reporting responsibilities within the one source file. There is no README content; all shown relationships are supported by the excerpt from ai_simulator.py.

Main entry points: [`ai_simulator.py`](https://github.com/jawon02/ai/blob/main/ai_simulator.py) (Video and Display)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_video_display["Video and Display<br/>[ai_simulator.py]"]
end

subgraph group_detection["Detection"]
  node_inference["YOLO Inference<br/>[ai_simulator.py]"]
  node_overlap_filter["Overlap Filter<br/>[ai_simulator.py]"]
end

subgraph group_reporting["Backend Reporting"]
  node_network_worker["Network Sender<br/>[ai_simulator.py]"]
end

node_operator(("Operator"))
node_backend["Backend API"]

node_operator -->|"starts or quits"| node_video_display
node_video_display -->|"supplies frames"| node_inference
node_inference -->|"filters detections"| node_overlap_filter
node_overlap_filter -->|"updates detection state"| node_video_display
node_video_display -->|"queues frame and status"| node_network_worker
node_network_worker -->|"posts telemetry"| node_backend
node_video_display -->|"checks availability"| node_backend

click node_video_display "https://github.com/jawon02/ai/blob/main/ai_simulator.py"
click node_inference "https://github.com/jawon02/ai/blob/main/ai_simulator.py"
click node_overlap_filter "https://github.com/jawon02/ai/blob/main/ai_simulator.py"
click node_network_worker "https://github.com/jawon02/ai/blob/main/ai_simulator.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_video_display toneBlue
class node_inference,node_overlap_filter toneAmber
class node_network_worker,node_backend toneMint
class node_operator toneIndigo
```

## Components

### Simulation

- [Video and Display](https://github.com/jawon02/ai/blob/main/ai_simulator.py): `ai_simulator.py`

### Detection

- [YOLO Inference](https://github.com/jawon02/ai/blob/main/ai_simulator.py): `ai_simulator.py`
- [Overlap Filter](https://github.com/jawon02/ai/blob/main/ai_simulator.py): `ai_simulator.py`

### Backend Reporting

- [Network Sender](https://github.com/jawon02/ai/blob/main/ai_simulator.py): `ai_simulator.py`

### Other components

- **Operator**
- **Backend API**

## Connections

- Operator → Video and Display: starts or quits (evidence: `ai_simulator.py`)
- Video and Display → YOLO Inference: supplies frames (evidence: `ai_simulator.py`)
- YOLO Inference → Overlap Filter: filters detections (evidence: `ai_simulator.py`)
- Overlap Filter → Video and Display: updates detection state (evidence: `ai_simulator.py`)
- Video and Display → Network Sender: queues frame and status (evidence: `ai_simulator.py`)
- Network Sender → Backend API: posts telemetry (evidence: `ai_simulator.py`)
- Video and Display → Backend API: checks availability (evidence: `ai_simulator.py`)
