# nesakumarmohandass-pixel/cinepulse-ai architecture

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

- Interactive diagram: https://gitdiagram.com/nesakumarmohandass-pixel/cinepulse-ai
- Repository: https://github.com/nesakumarmohandass-pixel/cinepulse-ai

## Overview

CinePulse is a studio intelligence dashboard and API for querying box-office, streaming, retention, and audience data and producing executive recommendations. The principal workflow runs from an executive’s question through the Director agent, analytical SQL execution, and Studio Head synthesis, then displays a brief and visualizations. Separate capabilities expose visual-cognition telemetry, pacing simulation, frame-level analysis, and theatrical-versus-SVOD strategy. The excerpts establish the main calls and storage options; some dashboard and API details are documented or only partially sampled.

Main entry points: [`database/clickhouse_manager.py`](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py) (Query Manager), [`app.py`](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py) (Cinematic Dashboard), [`agents/director_agent.py`](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/director_agent.py) (Director Orchestrator), [`backend/api.py`](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/backend/api.py) (Studio API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_dashboard["Cinematic Dashboard<br/>[app.py]"]
  node_dashboard_views["Charts and Brief<br/>[app.py]"]
  node_api["Studio API<br/>[api.py]"]
end

subgraph group_agents["Agent Workflow"]
  node_director["Director Orchestrator<br/>[director_agent.py]"]
  node_gemini["Gemini Service"]
  node_sql_tools["SQL Tool Adapters<br/>[sql_tools.py]"]
  node_studio_head["Executive Synthesis<br/>[director_agent.py]"]
end

subgraph group_analytics["Analytics and Data"]
  node_db_manager["Query Manager"]
  node_cloud_db[("ClickHouse Cloud")]
  node_local_db[("In-Memory Engine")]
  node_seed_generators["Telemetry Generators<br/>[seed_data.py]"]
  node_telemetry[("Cinema Data Tables")]
end

subgraph group_capabilities["Studio Capabilities"]
  node_visual_stream["Visual Cognition<br/>[app.py]"]
  node_frame_alignment["Frame Script Alignment<br/>[app.py]"]
  node_release_strategy["Theatrical SVOD Strategy<br/>[app.py]"]
  node_pacing_sim["Director Cut Simulator<br/>[api.py]"]
end

node_executive(("Studio Executive"))

node_executive -->|"asks"| node_dashboard
node_dashboard -->|"runs workflow"| node_director
node_director -.->|"plans and synthesizes"| node_gemini
node_director -->|"executes queries"| node_db_manager
node_director -->|"prepares results for"| node_studio_head
node_studio_head -->|"returns brief"| node_dashboard_views
node_dashboard -->|"queries metrics"| node_db_manager
node_dashboard -->|"renders"| node_dashboard_views
node_dashboard -->|"plots"| node_visual_stream
node_dashboard -->|"plots"| node_frame_alignment
node_dashboard -->|"analyzes"| node_release_strategy
node_api -->|"dispatches query"| node_director
node_api -->|"queries stream"| node_db_manager
node_api -->|"calculates lift"| node_pacing_sim
node_director -.->|"uses adapters"| node_sql_tools
node_sql_tools -->|"executes SQL"| node_db_manager
node_db_manager -.->|"queries when configured"| node_cloud_db
node_db_manager -->|"queries fallback"| node_local_db
node_db_manager -->|"loads generated data"| node_seed_generators
node_db_manager -->|"registers tables"| node_telemetry

click node_dashboard "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py"
click node_dashboard_views "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py"
click node_api "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/backend/api.py"
click node_director "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/director_agent.py"
click node_sql_tools "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/sql_tools.py"
click node_studio_head "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/director_agent.py"
click node_db_manager "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py"
click node_local_db "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py"
click node_seed_generators "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/seed_data.py"
click node_telemetry "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py"
click node_visual_stream "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py"
click node_frame_alignment "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py"
click node_release_strategy "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py"
click node_pacing_sim "https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/backend/api.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_dashboard,node_dashboard_views,node_api toneBlue
class node_director,node_gemini,node_sql_tools,node_studio_head toneAmber
class node_db_manager,node_cloud_db,node_local_db,node_seed_generators,node_telemetry toneMint
class node_visual_stream,node_frame_alignment,node_release_strategy,node_pacing_sim toneRose
class node_executive toneIndigo
```

## Components

### User Experience

- [Cinematic Dashboard](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py): `app.py`
- [Charts and Brief](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py): `app.py`
- [Studio API](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/backend/api.py): `backend/api.py`

### Agent Workflow

- [Director Orchestrator](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/director_agent.py): `agents/director_agent.py`
- **Gemini Service**
- [SQL Tool Adapters](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/sql_tools.py): `agents/sql_tools.py`
- [Executive Synthesis](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/agents/director_agent.py): `agents/director_agent.py`

### Analytics and Data

- [Query Manager](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py): `database/clickhouse_manager.py`
- **ClickHouse Cloud**
- [In-Memory Engine](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py): `database/clickhouse_manager.py`
- [Telemetry Generators](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/seed_data.py): `database/seed_data.py`
- [Cinema Data Tables](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/database/clickhouse_manager.py): `database/clickhouse_manager.py`

### Studio Capabilities

- [Visual Cognition](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py): `app.py`
- [Frame Script Alignment](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py): `app.py`
- [Theatrical SVOD Strategy](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/app.py): `app.py`
- [Director Cut Simulator](https://github.com/nesakumarmohandass-pixel/cinepulse-ai/blob/main/backend/api.py): `backend/api.py`

### Other components

- **Studio Executive**

## Connections

- Studio Executive → Cinematic Dashboard: asks (evidence: `README.md`)
- Cinematic Dashboard → Director Orchestrator: runs workflow (evidence: `app.py`)
- Director Orchestrator → Gemini Service: plans and synthesizes
- Director Orchestrator → Query Manager: executes queries (evidence: `agents/director_agent.py`)
- Director Orchestrator → Executive Synthesis: prepares results for (evidence: `agents/director_agent.py`)
- Executive Synthesis → Charts and Brief: returns brief (evidence: `app.py`)
- Cinematic Dashboard → Query Manager: queries metrics (evidence: `app.py`)
- Cinematic Dashboard → Charts and Brief: renders (evidence: `app.py`)
- Cinematic Dashboard → Visual Cognition: plots (evidence: `app.py`)
- Cinematic Dashboard → Frame Script Alignment: plots (evidence: `app.py`)
- Cinematic Dashboard → Theatrical SVOD Strategy: analyzes (evidence: `app.py`)
- Studio API → Director Orchestrator: dispatches query (evidence: `backend/api.py`)
- Studio API → Query Manager: queries stream (evidence: `backend/api.py`)
- Studio API → Director Cut Simulator: calculates lift (evidence: `backend/api.py`)
- Director Orchestrator → SQL Tool Adapters: uses adapters (evidence: `agents/director_agent.py`)
- SQL Tool Adapters → Query Manager: executes SQL (evidence: `agents/sql_tools.py`)
- Query Manager → ClickHouse Cloud: queries when configured (evidence: `database/clickhouse_manager.py`)
- Query Manager → In-Memory Engine: queries fallback (evidence: `database/clickhouse_manager.py`)
- Query Manager → Telemetry Generators: loads generated data (evidence: `database/clickhouse_manager.py`)
- Query Manager → Cinema Data Tables: registers tables (evidence: `database/clickhouse_manager.py`)
