Skip to content

Kevin-Mok/spotify-library-intelligence-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

175 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Library Visualizer

A full-stack web application that visualizes and analyzes your Spotify music library with interactive D3.js charts. Discover insights about your listening habits through artist distribution, genre breakdowns, and audio feature analysis.

Python Django PostgreSQL License

Features

  • Artist Distribution - Circle packing visualization showing which artists dominate your library
  • Genre Breakdown - Stacked bar charts displaying genre distribution with nested artist composition
  • Audio Feature Analysis - Scatter plots for track characteristics (danceability, energy, acousticness, valence)
  • Listening History Tracking - Persistent record of recently played tracks with CSV import/export
  • OAuth2 Authentication - Secure Spotify login with automatic token refresh

Tech Stack

Layer Technology
Backend Python 3, Django 2.2, Django REST Framework 3.9
Database PostgreSQL with psycopg2 adapter
Frontend D3.js, Bootstrap/Darkly theme, SASS/SCSS
API Integration Spotify Web API with OAuth2
Additional django-tables2, django-filter, django-compressor

Getting Started

Prerequisites

Installation

  1. Create and activate virtual environment:

    python3 -m venv venv
    source venv/bin/activate
  2. Clone the repository:

    git clone https://github.com/Kevin-Mok/spotify-lib-vis
    cd spotify-lib-vis
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set environment variables:

    export SPOTIFY_CLIENT_ID="your_client_id"
    export SPOTIFY_CLIENT_SECRET="your_client_secret"
  5. Initialize database and start server:

    cd src && ./reset_db.sh
  6. Access the application: Open http://localhost:8000 in your browser

Architecture

src/
├── login/          # OAuth2 authentication flow
├── api/            # Spotify API integration & data processing
├── graphs/         # D3.js visualization endpoints
└── templates/      # Django templates with embedded D3

Why This Project is Interesting

Technical Highlights

  1. Real-Time API Integration

    • Implements OAuth2 authorization code flow with automatic token refresh
    • Handles multiple concurrent Spotify API endpoints with rate limit awareness
    • Intelligent batching (50 tracks/request, 100 features/batch) for efficiency
  2. Interactive D3.js Visualizations

    • Circle packing algorithm with dynamic space allocation
    • Responsive SVG viewBox scaling for device compatibility
    • Dynamic color palette generation based on data cardinality
  3. Efficient Data Modeling

    • Normalized database schema with Many-to-Many relationships
    • Prevents data duplication across users while enabling per-user queries
    • Query optimization using Django ORM annotations and aggregations
  4. Queue-Based Batch Processing

    • Configurable batch limits for tracks, features, and artists
    • Processes queued items efficiently to maximize API throughput

Skills Demonstrated

  • Full-Stack Development: Django backend with D3.js frontend
  • API Integration: OAuth2 flows, rate limiting, batch processing
  • Database Design: Normalized schema, efficient queries
  • Data Visualization: Interactive charts with real-time updates
  • DevOps: Environment configuration, database management

Resume-ready points by variant

general

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

web-dev

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

aws

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

python

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

aws-web-dev

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

aws-python

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

web-dev-django

  • Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
  • Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
  • Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
  • Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
  • Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.

it-support

  • Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
  • Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
  • Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
  • Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
  • Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.

it-support-aws

  • Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
  • Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
  • Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
  • Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
  • Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.

sales

  • Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
  • Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
  • Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
  • Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
  • Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.

call-centre

  • Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
  • Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
  • Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
  • Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
  • Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.

Authors

License

This project is licensed under the GPL License - see the LICENSE.md file for details.

About

Full-stack Spotify analytics app with OAuth2 auth, PostgreSQL storage, and rich D3 visualizations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors