A data analytics project that extracts Coldplay's music data from Spotify, stores it in DuckDB, and creates interactive dashboards using Visivo.
This project uses:
- DLT (Data Load Tool) to extract data from Spotify's Web API
- DuckDB as the data warehouse
- Visivo for creating interactive data visualizations
- UV for Python dependency management
The pipeline extracts:
- Artist information (followers, popularity, genres)
- All albums (110+ albums including singles and compilations)
- All tracks (405+ tracks with metadata)
- Top 10 most popular tracks
Note: Due to Spotify API restrictions as of November 2024, audio features and related artists data are not available for new applications.
coldplay-spotify/
├── .env # Spotify API credentials
├── pyproject.toml # UV project configuration
├── extract_spotify_data.py # DLT pipeline script
├── spotify_coldplay.duckdb # DuckDB database (generated)
├── project.visivo.yml # Main Visivo configuration
├── artist_overview.visivo.yml # Artist metrics dashboard
├── album_analysis.visivo.yml # Album analysis dashboard
├── musical_evolution.visivo.yml # Musical evolution over time
├── top_tracks.visivo.yml # Top tracks analysis
├── TASKS.MD # Project task tracking
└── README.md # This file
- Python 3.10 or higher
- UV package manager
- Spotify Developer Account
git clone <repository-url>
cd coldplay-spotify- Go to Spotify Developer Dashboard
- Create a new app
- Copy your Client ID and Client Secret
- Update the
.envfile with your credentials:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_hereuv syncThis will create a virtual environment and install all required packages.
Run the DLT pipeline to extract Coldplay's data:
uv run python extract_spotify_data.pyThis will:
- Authenticate with Spotify using Client Credentials flow
- Extract artist, album, track, and top tracks data
- Store everything in
spotify_coldplay.duckdb
Expected output:
Pipeline completed successfully!
Data loaded to: spotify_coldplay.duckdb
Data Statistics:
artists: 1 records
albums: 110 records
tracks: 405 records
top_tracks: 10 records
Start the Visivo server:
uv run visivo serveThen open your browser to: http://localhost:8000
- Total follower count
- Spotify popularity score gauge
- Genre distribution
- Artist name display
- Album release timeline scatter plot
- Album type distribution (albums vs singles vs compilations)
- Releases by year and type
- Recent studio albums overview
- Average track duration over time
- Album structure changes (tracks per album)
- Release strategy evolution
- All tracks scatter plot (duration vs year, colored by popularity)
- Top 10 tracks ranking by popularity
- Track popularity vs duration analysis
- Duration distribution histogram for all tracks
- Interactive bubble chart of top tracks
The database contains the following tables in the coldplay_data_20250718022923 schema:
id: Spotify artist IDname: Artist namepopularity: Popularity score (0-100)followers__total: Total follower countgenres: Array of genre tags
id: Spotify album IDname: Album namerelease_date: Release datetotal_tracks: Number of tracksalbum_type: Type (album/single/compilation)
id: Spotify track IDname: Track namealbum_id: Associated album IDalbum_name: Album nameduration_ms: Track duration in millisecondspopularity: Popularity score (0-100)track_number: Position on album
rank: Ranking position (1-10)name: Track namepopularity: Popularity scorealbum__name: Album name
If the Visivo server fails to start:
- Make sure you're in the project directory
- Check that the virtual environment is activated
- Verify that
spotify_coldplay.duckdbexists
If you get 401/403 errors:
- Verify your Spotify credentials in
.env - Make sure your app is active in Spotify Developer Dashboard
- Note that some endpoints (audio-features, related-artists) are restricted for new apps
To verify data integrity:
echo "SELECT COUNT(*) FROM coldplay_data_20250718022923.tracks;" | duckdb spotify_coldplay.duckdb- Add incremental data loading
- Implement automated refresh schedule
- Add more artists for comparison
- Create playlist analysis (if API access available)
- Add concert/tour data integration
This project is configured for easy deployment to Netlify. The repository includes:
netlify.toml- Netlify configurationbuild.sh- Build script that handles dependencies and site generation.github/workflows/deploy.yml- GitHub Actions workflow for automated deployments
-
Connect to Netlify:
- Log in to Netlify
- Click "Add new site" → "Import an existing project"
- Connect your GitHub account and select this repository
-
Configure Environment Variables:
- Go to Site settings → Environment variables
- Add the following (optional - site will work without them):
SPOTIFY_CLIENT_ID: Your Spotify app client IDSPOTIFY_CLIENT_SECRET: Your Spotify app client secret
-
Deploy:
- Netlify will automatically build and deploy your site
- Future pushes to
mainbranch will trigger automatic deployments
-
Get Netlify Credentials:
- In Netlify, go to User settings → Applications → Create new token
- Copy the token for
NETLIFY_AUTH_TOKEN - In your Netlify site, go to Site settings → General → Copy the Site ID
-
Configure GitHub Secrets:
- In your GitHub repository, go to Settings → Secrets and variables → Actions
- Add the following secrets:
NETLIFY_AUTH_TOKEN: Your Netlify personal access tokenNETLIFY_SITE_ID: Your Netlify site IDSPOTIFY_CLIENT_ID: (Optional) Your Spotify client IDSPOTIFY_CLIENT_SECRET: (Optional) Your Spotify client secret
-
Deploy:
- Push to the
mainbranch or manually trigger the workflow - Check the Actions tab to monitor deployment progress
- Push to the
To build the static site locally:
# Run the data pipeline and generate trace data
uv run visivo run
# Generate the static site
uv run visivo dist
# The static site will be in the dist/ directory
# You can serve it locally with:
python -m http.server -d dist 8080The project includes a pre-populated DuckDB database (spotify_coldplay.duckdb), so the site can be built and deployed without Spotify API credentials. The build process will:
- Use the existing database if no credentials are provided
- Optionally refresh data if credentials are available
This project is for educational and personal use only. Spotify data is subject to Spotify's Terms of Service.