# sangeethkumar0903/spotify-data-analysis-powerbi architecture

> Architecture diagram of the GitHub repository sangeethkumar0903/spotify-data-analysis-powerbi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sangeethkumar0903/spotify-data-analysis-powerbi
- Repository: https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi

## Overview

##### Project Type and Purpose
- This project is focused on data analytics and visualization. It uses Python for processing/cleaning raw Spotify streaming data and Power BI for rich interactive visualizations.
- The purpose is to clean the dataset (originally sourced from Kaggle), enrich it (e.g., with album cover URLs via Spotify API), and then present insights using Power BI dashboards along with custom Vega-Lite visualizations (energy percentage circle and heatmap).

##### Analyzing the File Structure
- Top-level files include README.md and a folder (Spotify-Data-Analysis-project1) that contains subdirectories such as:
- Assets (stores static images like dashboard previews or design elements)
- Dataset (contains CSV files with Spotify data and at least one Python script for data processing)
- visualizations (holds Vega-Lite JSON files that define custom visualizations)
- A Power BI file (Spotify_Analysis.pbix) that is the main dashboard.
- Noticeable configuration elements:
- Python scripts (e.g., Spotifyscript.py or data_cleaning.py as mentioned in the README) that process the dataset.
- CSV dataset files (raw, updated, or cleaned versions) which serve as the primary data source.
- Vega-Lite JSON files define custom visual components in the dashboard.

##### Main Components
a. Data Sources:
- Raw Dataset (e.g., spotify-2023.csv / spotify_raw.csv)
- Updated/Cleaned Dataset (resulting from the Python script processing)
b. Data Processing Layer:
- Python Script (Spotifyscript.py / data_cleaning.py) that cleans data, enriches it by fetching details (using Spotify API with Client ID and Client Secret), and outputs a usable dataset.
c. Visualization Layer:
- Power BI Dashboard (Spotify_Analysis.pbix) that imports the cleaned dataset.
- Custom Visualizations (Vega-Lite JSON files such as energy_circle.json and heatmap.json) integrated into Power BI for specific chart types.
d. Supporting Components:
- Assets (static images and design elements for UI/UX cues in the dashboard)
- External Interaction: Spotify Developer API is used for dynamically obtaining album cover URLs.

##### Relationships and Data Flow
- The process starts with the raw dataset that is cleaned and processed by the Python script.
- The processed (cleaned) data is then stored as a CSV file which becomes the input for the Power BI dashboard.
- Within Power BI, standard charts (line charts, bar charts) are combined with custom visualizations (JSON-defined Vega-Lite components) to represent insights like track popularity trends and energy percentages.
- There’s an external dependency where the Python script makes API calls to Spotify to retrieve additional album data.

##### Architectural Patterns and Technologies
- The design follows a data pipeline architecture: Data Ingestion → Data Cleaning/Enrichment → Data Visualization.
- Separation-of-concerns: the dataset and its processing are distinct from the visualization layer.
- Technologies/Frameworks:
- Python with libraries like Pandas (and possibly Requests) for data processing.
- Power BI for creating and interacting with dashboards.
- Vega-Lite for advanced visualizations defined in JSON.
- External integration with Spotify API (secured with Client ID and Client Secret).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Data Ingestion & Processing Layer
    subgraph "Data Ingestion & Processing"
        RD["Raw Spotify Dataset"]:::dataset
        PS["Data Cleaning & Enrichment (Python Script)"]:::process
        CD["Cleaned Dataset (CSV)"]:::dataset
        API["Spotify API"]:::external
        RD -->|"Processed"| PS
        PS -->|"Generates"| CD
        PS -->|"Calls"| API
    end

    %% Visualization Layer
    subgraph "Visualization Layer"
        PB["Power BI Dashboard"]:::dashboard
        subgraph "Custom Visualizations"
            EN["Energy Circle Visualization"]:::visualization
            HT["Heatmap Visualization"]:::visualization
        end
        PB -->|"Integrates"| EN
        PB -->|"Integrates"| HT
    end

    %% Supporting Components
    subgraph "Supporting Components"
        AS["Supporting Assets"]:::asset
    end

    %% Data Flow
    CD -->|"FeedsData"| PB

    %% Click Events
    click RD "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/blob/main/Spotify-Data-Analysis-project1/Dataset/spotify-2023.csv"
    click PS "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/blob/main/Spotify-Data-Analysis-project1/Dataset/Spotifyscript.py"
    click CD "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/blob/main/Spotify-Data-Analysis-project1/Dataset/spotify-2023-updated.csv"
    click PB "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/blob/main/Spotify-Data-Analysis-project1/Spotify_Analysis.pbix"
    click EN "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/blob/main/Spotify-Data-Analysis-project1/visualizations/energy_circle.json"
    click HT "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/blob/main/Spotify-Data-Analysis-project1/visualizations/heatmap.json"
    click AS "https://github.com/sangeethkumar0903/spotify-data-analysis-powerbi/tree/main/Spotify-Data-Analysis-project1/Assets"

    %% Styles
    classDef dataset fill:#f9f,stroke:#333,stroke-width:2px;
    classDef process fill:#ccf,stroke:#333,stroke-width:2px;
    classDef external fill:#ff9,stroke:#333,stroke-width:2px;
    classDef dashboard fill:#9ff,stroke:#333,stroke-width:2px;
    classDef visualization fill:#fcf,stroke:#333,stroke-width:2px;
    classDef asset fill:#cff,stroke:#333,stroke-width:2px;
```
