# adminfarhanaftab/long_video_analysis architecture

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

- Interactive diagram: https://gitdiagram.com/adminfarhanaftab/long_video_analysis
- Repository: https://github.com/adminfarhanaftab/long_video_analysis

## Overview

This is a video-processing application: a user uploads a video, starts a job, and views timestamp detections as runner chunks complete. The Worker signs object-storage requests, dispatches processing, tracks progress and timestamps, and deletes the source video after the configured completion count. The runner samples video frames for motion and posts chunk results. The HTML entry point is present but unsampled, so its interface and connections are not inferred; relationships shown are limited to those documented in the Worker and runner excerpts.

Main entry points: [`cloudflare/worker.js`](https://github.com/adminfarhanaftab/long_video_analysis/blob/main/cloudflare/worker.js) (Request Worker), [`runner/main.py`](https://github.com/adminfarhanaftab/long_video_analysis/blob/main/runner/main.py) (Motion runner), [`index.html`](https://github.com/adminfarhanaftab/long_video_analysis/blob/main/index.html) (Video interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Video interface<br/>[index.html]"]
end

subgraph group_control["Job coordination"]
  node_worker["Request Worker<br/>[worker.js]"]
end

subgraph group_processing["Video analysis"]
  node_runner["Motion runner<br/>[main.py]"]
end

subgraph group_services["External services"]
  node_storage[("Video object storage")]
  node_state[("Job state")]
  node_github["GitHub dispatch"]
end

node_user(("User"))

node_user -.->|"uses"| node_frontend
node_frontend -.->|"requests"| node_worker
node_worker -->|"signs requests"| node_storage
node_worker -->|"reads and writes"| node_state
node_worker -->|"dispatches job"| node_github
node_github -.->|"runs chunks"| node_runner
node_runner -.->|"reads video"| node_storage
node_runner -->|"posts detections"| node_worker

click node_frontend "https://github.com/adminfarhanaftab/long_video_analysis/blob/main/index.html"
click node_worker "https://github.com/adminfarhanaftab/long_video_analysis/blob/main/cloudflare/worker.js"
click node_runner "https://github.com/adminfarhanaftab/long_video_analysis/blob/main/runner/main.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_frontend,node_user toneBlue
class node_worker toneAmber
class node_runner toneMint
class node_storage,node_state,node_github toneRose
```

## Components

### User interface

- [Video interface](https://github.com/adminfarhanaftab/long_video_analysis/blob/main/index.html): `index.html`

### Job coordination

- [Request Worker](https://github.com/adminfarhanaftab/long_video_analysis/blob/main/cloudflare/worker.js): `cloudflare/worker.js`

### Video analysis

- [Motion runner](https://github.com/adminfarhanaftab/long_video_analysis/blob/main/runner/main.py): `runner/main.py`

### External services

- **Video object storage**
- **Job state**
- **GitHub dispatch**

### Other components

- **User**

## Connections

- User → Video interface: uses
- Video interface → Request Worker: requests
- Request Worker → Video object storage: signs requests (evidence: `cloudflare/worker.js`)
- Request Worker → Job state: reads and writes (evidence: `cloudflare/worker.js`)
- Request Worker → GitHub dispatch: dispatches job (evidence: `cloudflare/worker.js`)
- GitHub dispatch → Motion runner: runs chunks
- Motion runner → Video object storage: reads video
- Motion runner → Request Worker: posts detections (evidence: `runner/main.py`)
