# darshan-baslani/yt-podcast-analyzer architecture

> Architecture diagram of the GitHub repository darshan-baslani/yt-podcast-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/darshan-baslani/yt-podcast-analyzer
- Repository: https://github.com/darshan-baslani/yt-podcast-analyzer

## Overview

This is a Streamlit research platform for analyzing YouTube videos and channels. Users can analyze a video into a refined transcript and Gemini report, then revisit cached results, chat about a video, compare claims across videos, or track a channel’s stance over time. The graph preserves the documented transcript/audio/knowledge fallback, claim comparison, and chronological drift stages. Several core modules and UI components were not sampled, so their internal calls are shown only where the README documents them; evidence for other links is limited to the entry point and narrative-drift UI excerpts.

Main entry points: [`app.py`](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/app.py) (App entry), [`core/processor.py`](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py) (Video processor), [`ui/narrative_drift_ui.py`](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/narrative_drift_ui.py) (Drift timeline view), [`database/db_manager.py`](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/database/db_manager.py) (Analysis repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Streamlit experience"]
  node_app["App entry<br/>[app.py]"]
  node_general_ui["Dashboard, chat, archive<br/>[components.py]"]
  node_kg_ui["Knowledge graph view"]
  node_drift_ui["Drift timeline view"]
end

subgraph group_video["Video analysis"]
  node_processor["Video processor<br/>[processor.py]"]
  node_transcripts["Transcript extraction<br/>[processor.py]"]
  node_refinement["Transcript refinement<br/>[processor.py]"]
  node_reporting["Gemini reports<br/>[processor.py]"]
  node_fallback["Audio and knowledge fallback<br/>[processor.py]"]
  node_chat["Video Q&amp;A<br/>[components.py]"]
end

subgraph group_analytics["Cross-video analytics"]
  node_topic_analysis["Topic analyser<br/>[knowledge_graph.py]"]
  node_claim_extraction["Claim triples<br/>[knowledge_graph.py]"]
  node_claim_comparison["Consensus and conflicts<br/>[knowledge_graph.py]"]
  node_graph_build["Knowledge graph<br/>[knowledge_graph.py]"]
  node_channel_feed["Channel feed resolver<br/>[helpers.py]"]
  node_channel_analysis["Channel analyser<br/>[narrative_drift.py]"]
  node_stance_extraction["Stance extraction<br/>[narrative_drift.py]"]
  node_drift_detection["Drift detection<br/>[narrative_drift.py]"]
end

subgraph group_persistence["Archival and utilities"]
  node_db_manager["Analysis repository<br/>[db_manager.py]"]
  node_sqlite[("SQLite archive")]
  node_helpers["Shared utilities<br/>[helpers.py]"]
end

node_researcher(("Researcher"))
node_youtube(("YouTube"))
node_gemini(("Google Gemini"))

node_researcher -->|"uses"| node_app
node_app -->|"renders"| node_general_ui
node_app -->|"renders"| node_kg_ui
node_app -->|"renders"| node_drift_ui
node_app -->|"creates"| node_processor
node_app -->|"creates"| node_topic_analysis
node_app -->|"creates"| node_channel_analysis
node_general_ui -.->|"processes videos"| node_processor
node_general_ui -.->|"reads and saves"| node_db_manager
node_processor -->|"extracts"| node_transcripts
node_processor -->|"refines"| node_refinement
node_processor -->|"summarizes"| node_reporting
node_processor -->|"falls back"| node_fallback
node_transcripts -->|"retrieves captions"| node_youtube
node_reporting -->|"requests analysis"| node_gemini
node_fallback -->|"requests audio analysis"| node_gemini
node_chat -->|"answers questions"| node_gemini
node_kg_ui -.->|"requests comparison"| node_topic_analysis
node_topic_analysis -->|"extracts claims"| node_claim_extraction
node_topic_analysis -->|"compares claims"| node_claim_comparison
node_claim_comparison -->|"checks agreement"| node_gemini
node_topic_analysis -->|"builds graph"| node_graph_build
node_graph_build -->|"displays graph"| node_kg_ui
node_drift_ui -->|"fetches uploads"| node_channel_feed
node_channel_feed -->|"reads channel feed"| node_youtube
node_drift_ui -->|"checks cached analyses"| node_db_manager
node_drift_ui -->|"analyzes cache misses"| node_processor
node_processor -->|"saves analysis"| node_db_manager
node_drift_ui -->|"analyzes channel"| node_channel_analysis
node_channel_analysis -->|"extracts stances"| node_stance_extraction
node_stance_extraction -->|"classifies positions"| node_gemini
node_channel_analysis -->|"analyzes timelines"| node_drift_detection
node_drift_detection -->|"evaluates shifts"| node_gemini
node_drift_ui -.->|"loads channel history"| node_db_manager
node_db_manager -->|"reads and writes"| node_sqlite
node_app -->|"configures logging"| node_helpers
node_db_manager -->|"uses utilities"| node_helpers

click node_app "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/app.py"
click node_general_ui "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/components.py"
click node_kg_ui "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/knowledge_graph_ui.py"
click node_drift_ui "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/narrative_drift_ui.py"
click node_processor "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py"
click node_transcripts "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py"
click node_refinement "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py"
click node_reporting "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py"
click node_fallback "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py"
click node_chat "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/components.py"
click node_topic_analysis "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py"
click node_claim_extraction "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py"
click node_claim_comparison "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py"
click node_graph_build "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py"
click node_channel_feed "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/utils/helpers.py"
click node_channel_analysis "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/narrative_drift.py"
click node_stance_extraction "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/narrative_drift.py"
click node_drift_detection "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/narrative_drift.py"
click node_db_manager "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/database/db_manager.py"
click node_helpers "https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/utils/helpers.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_app,node_general_ui,node_kg_ui,node_drift_ui toneBlue
class node_processor,node_transcripts,node_refinement,node_reporting,node_fallback,node_chat toneAmber
class node_topic_analysis,node_claim_extraction,node_claim_comparison,node_graph_build,node_channel_feed,node_channel_analysis,node_stance_extraction,node_drift_detection toneMint
class node_db_manager,node_sqlite,node_helpers toneRose
class node_researcher,node_youtube,node_gemini toneIndigo
```

## Components

### Streamlit experience

- [App entry](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/app.py): `app.py`
- [Dashboard, chat, archive](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/components.py): `ui/components.py`
- [Knowledge graph view](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/knowledge_graph_ui.py): `ui/knowledge_graph_ui.py`
- [Drift timeline view](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/narrative_drift_ui.py): `ui/narrative_drift_ui.py`

### Video analysis

- [Video processor](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py): `core/processor.py`
- [Transcript extraction](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py): `core/processor.py`
- [Transcript refinement](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py): `core/processor.py`
- [Gemini reports](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py): `core/processor.py`
- [Audio and knowledge fallback](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/processor.py): `core/processor.py`
- [Video Q&A](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/ui/components.py): `ui/components.py`

### Cross-video analytics

- [Topic analyser](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py): `core/knowledge_graph.py`
- [Claim triples](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py): `core/knowledge_graph.py`
- [Consensus and conflicts](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py): `core/knowledge_graph.py`
- [Knowledge graph](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/knowledge_graph.py): `core/knowledge_graph.py`
- [Channel feed resolver](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/utils/helpers.py): `utils/helpers.py`
- [Channel analyser](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/narrative_drift.py): `core/narrative_drift.py`
- [Stance extraction](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/narrative_drift.py): `core/narrative_drift.py`
- [Drift detection](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/core/narrative_drift.py): `core/narrative_drift.py`

### Archival and utilities

- [Analysis repository](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/database/db_manager.py): `database/db_manager.py`
- **SQLite archive**
- [Shared utilities](https://github.com/darshan-baslani/yt-podcast-analyzer/blob/main/utils/helpers.py): `utils/helpers.py`

### Other components

- **Researcher**
- **YouTube**
- **Google Gemini**

## Connections

- Researcher → App entry: uses (evidence: `README.md`)
- App entry → Dashboard, chat, archive: renders (evidence: `app.py`)
- App entry → Knowledge graph view: renders (evidence: `app.py`)
- App entry → Drift timeline view: renders (evidence: `app.py`)
- App entry → Video processor: creates (evidence: `app.py`)
- App entry → Topic analyser: creates (evidence: `app.py`)
- App entry → Channel analyser: creates (evidence: `app.py`)
- Dashboard, chat, archive → Video processor: processes videos
- Dashboard, chat, archive → Analysis repository: reads and saves
- Video processor → Transcript extraction: extracts (evidence: `README.md`)
- Video processor → Transcript refinement: refines (evidence: `README.md`)
- Video processor → Gemini reports: summarizes (evidence: `README.md`)
- Video processor → Audio and knowledge fallback: falls back (evidence: `README.md`)
- Transcript extraction → YouTube: retrieves captions (evidence: `README.md`)
- Gemini reports → Google Gemini: requests analysis (evidence: `README.md`)
- Audio and knowledge fallback → Google Gemini: requests audio analysis (evidence: `README.md`)
- Video Q&A → Google Gemini: answers questions (evidence: `README.md`)
- Knowledge graph view → Topic analyser: requests comparison
- Topic analyser → Claim triples: extracts claims (evidence: `README.md`)
- Topic analyser → Consensus and conflicts: compares claims (evidence: `README.md`)
- Consensus and conflicts → Google Gemini: checks agreement (evidence: `README.md`)
- Topic analyser → Knowledge graph: builds graph (evidence: `README.md`)
- Knowledge graph → Knowledge graph view: displays graph (evidence: `README.md`)
- Drift timeline view → Channel feed resolver: fetches uploads (evidence: `ui/narrative_drift_ui.py`)
- Channel feed resolver → YouTube: reads channel feed (evidence: `README.md`)
- Drift timeline view → Analysis repository: checks cached analyses (evidence: `README.md`)
- Drift timeline view → Video processor: analyzes cache misses (evidence: `ui/narrative_drift_ui.py`)
- Video processor → Analysis repository: saves analysis (evidence: `README.md`)
- Drift timeline view → Channel analyser: analyzes channel (evidence: `ui/narrative_drift_ui.py`)
- Channel analyser → Stance extraction: extracts stances (evidence: `core/narrative_drift.py`)
- Stance extraction → Google Gemini: classifies positions (evidence: `core/narrative_drift.py`)
- Channel analyser → Drift detection: analyzes timelines (evidence: `core/narrative_drift.py`)
- Drift detection → Google Gemini: evaluates shifts (evidence: `README.md`)
- Drift timeline view → Analysis repository: loads channel history (evidence: `ui/narrative_drift_ui.py`)
- Analysis repository → SQLite archive: reads and writes (evidence: `database/db_manager.py`)
- App entry → Shared utilities: configures logging (evidence: `app.py`)
- Analysis repository → Shared utilities: uses utilities (evidence: `database/db_manager.py`)
