Student-facing structured dataset toolkit for the UPC big data course.
Project description
UPC Datasets
This workspace contains a small Python toolkit for generating structured teaching datasets for the PachaMix course narrative.
The implementation is designed around:
- structured tables
- metadata
- audio-feature tables
- lyrics-derived features
- playlist interactions
- parquet outputs
It intentionally avoids:
- raw mp3 processing
- waveform pipelines
- dependence on live Spotify audio-feature endpoints
Data Sources
FMAfor metadata and audio featuresmusiXmatch/MSDfor lyrics-derived featuresPlaylist2vectable exports for playlist interactions and graph construction- optional
Spotify MPDsupport when access is already available
Official source references:
FMA: https://github.com/mdeff/fmamusiXmatch/MSD: https://millionsongdataset.com/musixmatch/Playlist2vec: https://zenodo.org/records/5002584Spotify MPD: https://research.atspotify.com/2020/9/the-million-playlist-dataset-remastered
The codebase is intentionally focused on structured data, not raw media. That means:
- no mp3 decoding
- no spectrogram generation
- no waveform feature extraction inside the course toolkit
Instead, the builders assume the inputs are already in the form of:
- csv metadata tables
- csv feature tables
- lyric token-count text exports
- playlist membership tables or json playlist metadata
Detailed source notes are documented in big_data_dataset_generation_plan.md.
The processed schema reference is documented in data_dictionary.md.
The student-oriented quickstart is documented in STUDENT_GUIDE.md.
Operational instructions are documented in runbooks/README.md.
Runtime Note
pyspark was evaluated for large-scale processing, but the current local environment cannot launch Spark because the installed Java runtime is older than the version required by Spark 4.1. For that reason, the working implementation uses polars plus pyarrow.
Quick Start
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/python -m upc_datasets.cli --help
.venv/bin/pytest
Student Package
The distribution name is upc-datasets.
If you want the shortest student path, read STUDENT_GUIDE.md.
Local development install:
pip install -e .
Student install after publishing to PyPI:
pip install upc-datasets
Python usage:
import upc_datasets
print(upc_datasets.list_datasets())
lyrics = upc_datasets.get_dataset_definition("pachamix_lyrics_long")
print(lyrics["grain"])
CLI usage:
upc-datasets list-datasets
upc-datasets show-dataset pachamix_lyrics_long
upc-datasets show-dataset pachamix_lyrics_long --format json
upc-datasets show-data-dictionary
One-Command Course Build
If your raw data is arranged under data/raw/ like this:
data/raw/
fma/
tracks.csv
features.csv
musixmatch_msd/
mxm_dataset_train.txt
mxm_dataset_test.txt
msd/
track_metadata.db
then build the core course dataset with:
.venv/bin/python -m upc_datasets.cli build-course-dataset \
--raw-root data/raw \
--processed-root data/processed
or:
make build-course-dataset RAW_ROOT=data/raw PROCESSED_ROOT=data/processed
This always builds:
data/processed/pachamix_audio_core.parquetdata/processed/pachamix_lyrics_long.parquet
When data/raw/msd/track_metadata.db is present, the lyrics dataset is enriched with MSD metadata columns such as:
titlesong_idreleaseartist_idartist_mbidartist_namedurationartist_familiarityartist_hotttnesssyeartrack_7digitalidshs_perfshs_work
If you also want recommendation and graph data, add one of these optional behavior sources.
Playlist2vec:
data/raw/playlist2vec/
playlist.csv
track.csv
track_playlist1.csv
Official MPD:
data/raw/mpd/
*.json
When either optional source is present, the same one-command build also writes:
data/processed/pachamix_playlists/playlist_events.parquetdata/processed/pachamix_song_graph_edges.parquet
When both are present, the pipeline prefers playlist2vec/.
Example Commands
.venv/bin/python -m upc_datasets.cli build-audio-core \
--tracks-csv data/raw/fma/tracks.csv \
--features-csv data/raw/fma/features.csv \
--output-parquet data/processed/pachamix_audio_core.parquet
.venv/bin/python -m upc_datasets.cli build-lyrics-core \
--lyrics-txt data/raw/musixmatch_msd \
--output-parquet data/processed/pachamix_lyrics_long.parquet \
--metadata-db data/raw/msd/track_metadata.db
.venv/bin/python -m upc_datasets.cli build-playlist-events \
--mpd-json data/raw/playlist2vec \
--output-dir data/processed/pachamix_playlists
.venv/bin/python -m upc_datasets.cli build-song-graph \
--playlist-events-parquet data/processed/pachamix_playlists/playlist_events.parquet \
--output-parquet data/processed/pachamix_song_graph_edges.parquet
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file upc_datasets-0.2.0.tar.gz.
File metadata
- Download URL: upc_datasets-0.2.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed1a6f11ea35c6550dbe07457ceb30e508d2db3e091c59c498e0618619f0b65e
|
|
| MD5 |
e7be34022c9076072352a6cba578caae
|
|
| BLAKE2b-256 |
3f0a87083f76f741009c610dab7d062f10eca1bbf92e1dbbe5a7fa488acca1d1
|
File details
Details for the file upc_datasets-0.2.0-py3-none-any.whl.
File metadata
- Download URL: upc_datasets-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6dbf52a541de6e029d25165d106b0a67492dab6b5936dc67948031b3dfb9b51
|
|
| MD5 |
6925ec052b85da5a98e7765d17fc94a7
|
|
| BLAKE2b-256 |
a6ce8d3c3c96347dc5156f6e58a1382f38e23eba7bfeeb495fd83cf79d65bb6d
|