# ro-han12/neha-test architecture

> Architecture diagram of the GitHub repository ro-han12/neha-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ro-han12/neha-test
- Repository: https://github.com/ro-han12/neha-test

## Overview

##### Project Type and Purpose
- This is a full‐stack (monolithic) analytics dashboard built with Python and Streamlit.
- Purpose: extract data from YouTube (via API), store it locally in Excel, analyze comments and video stats, schedule future posts, and present results in interactive pages.

##### File Structure
Top‐level files & directories:
- app.py – entrypoint (Streamlit main).
- analyze_comments.py – comment‐analysis logic.
- channelDataExtraction.py / channelVideoDataExtraction.py – scripts to call YouTube Data API and persist results.
- pages/🎥_Video_Data.py, pages/📅_Post_Scheduler.py – Streamlit multipage UI.
- Excel files (all_comments.xlsx, all_video_Data.xlsx, scheduled_posts.xlsx) – local data stores.
- requirements.txt – dependencies.
- all_video_Data.xlsx – raw video metadata; all_comments.xlsx – raw comment data.

##### README for Insights
- Built on Streamlit (v1.42.2) and deployed as a Hugging Face Space.
- No external microservices beyond the YouTube API.

##### Main Components & Interactions
a. Frontend/UI Layer
- Streamlit app (app.py) loads the sidebar/nav, integrates pages folder.
- UI Pages:
– Video Data Page (🎥_Video_Data.py)
– Post Scheduler Page (📅_Post_Scheduler.py)
b. Data Extraction Layer
- channelDataExtraction.py → fetches channel metadata → writes to all_video_Data.xlsx
- channelVideoDataExtraction.py → fetches per‐video details & comments → writes to all_comments.xlsx
c. Analysis Layer
- analyze_comments.py → reads all_comments.xlsx, performs sentiment/topic analysis, outputs results (in memory or new file)
d. Data Stores
- Local Excel files for raw and scheduled data
e. External Services
- YouTube Data API
f. Deployment Environment
- Hugging Face Spaces (hosted Streamlit)

##### Relationships & Data Flows
- User (Browser) ↔ Streamlit Frontend
- Frontend triggers extraction scripts or calls pre‐run data layer on each load
- Extraction scripts ↔ YouTube API → Excel files
- Analysis script → reads Excel → returns processed metrics
- Frontend reads both raw and processed data → visualizations, tables
- Scheduler page writes to scheduled_posts.xlsx → used by future extraction/notifications (if extended)

##### Architectural Patterns & Design Principles
- Monolithic MVC‐like separation (UI “views” in pages/, business logic in extraction & analysis scripts, data in Excel)
- Single process web server (Streamlit) hosting both backend logic and UI
- File‐based persistence (no database—Excel files as data layer)
- Extensibility: new pages or scripts can be added under pages/ or as new modules

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User["User (Browser)"]:::external

    %% Deployment Boundary
    subgraph "Hugging Face Spaces"
      direction TB

      %% Frontend/UI Layer
      subgraph "Frontend/UI Layer"
        direction TB
        App["Streamlit App (app.py)"]:::ui
        VideoPage["Video Data Page (🎥_Video_Data.py)"]:::ui
        SchedulerPage["Post Scheduler Page (📅_Post_Scheduler.py)"]:::ui
      end

      %% Business Logic Layer
      subgraph "Business Logic Layer"
        direction TB
        ChannelMeta["Channel Metadata Extraction (channelDataExtraction.py)"]:::extraction
        ChannelVideo["Video Details & Comments Extraction (channelVideoDataExtraction.py)"]:::extraction
        Analyze["Comment Analysis (analyze_comments.py)"]:::analysis
      end

      %% Data Layer
      subgraph "Data Layer"
        direction TB
        RawVideo["all_video_Data.xlsx"]:::datastore
        RawComments["all_comments.xlsx"]:::datastore
        Scheduled["scheduled_posts.xlsx"]:::datastore
      end

      %% Documentation & Dependencies
      Requirements["requirements.txt"]:::docs
      Readme["README.md"]:::docs
    end

    %% External Services
    YouTube["YouTube Data API"]:::external

    %% Relationships
    User --> App
    App --> VideoPage
    App --> SchedulerPage

    VideoPage --> ChannelMeta
    ChannelMeta --> YouTube
    YouTube --> ChannelMeta
    ChannelMeta --> RawVideo

    VideoPage --> ChannelVideo
    ChannelVideo --> YouTube
    YouTube --> ChannelVideo
    ChannelVideo --> RawComments

    SchedulerPage --> Scheduled

    App --> Analyze
    Analyze --> RawComments
    Analyze --> App

    App --> RawVideo
    App --> RawComments
    App --> Scheduled

    %% Click Events
    click App "https://github.com/ro-han12/neha-test/blob/main/app.py"
    click VideoPage "https://github.com/ro-han12/neha-test/blob/main/pages/🎥_Video_Data.py"
    click SchedulerPage "https://github.com/ro-han12/neha-test/blob/main/pages/📅_Post_Scheduler.py"
    click ChannelMeta "https://github.com/ro-han12/neha-test/blob/main/channelDataExtraction.py"
    click ChannelVideo "https://github.com/ro-han12/neha-test/blob/main/channelVideoDataExtraction.py"
    click Analyze "https://github.com/ro-han12/neha-test/blob/main/analyze_comments.py"
    click RawVideo "https://github.com/ro-han12/neha-test/blob/main/all_video_Data.xlsx"
    click RawComments "https://github.com/ro-han12/neha-test/blob/main/all_comments.xlsx"
    click Scheduled "https://github.com/ro-han12/neha-test/blob/main/scheduled_posts.xlsx"
    click Requirements "https://github.com/ro-han12/neha-test/blob/main/requirements.txt"
    click Readme "https://github.com/ro-han12/neha-test/blob/main/README.md"

    %% Styles
    classDef ui fill:#FFD580,stroke:#333,stroke-width:1px
    classDef extraction fill:#80BFFF,stroke:#333,stroke-width:1px
    classDef analysis fill:#80FF80,stroke:#333,stroke-width:1px
    classDef datastore fill:#FF8080,stroke:#333,stroke-width:1px
    classDef external fill:#C0C0C0,stroke:#333,stroke-width:1px
    classDef docs fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef deployment fill:none,stroke:#333,stroke-dasharray:5 5,stroke-width:1px
```
