music-and-you/
βββ π README.md # Project overview and quick start
βββ π literature.MD # Comprehensive literature review
βββ π pyproject.toml # Python project configuration
βββ π requirements.txt # Python dependencies
βββ π .gitignore # Git ignore patterns
βββ π οΈ setup_dev.sh # Development environment setup
β
βββ π src/music_and_you/ # Main source code
β βββ π __init__.py # Package initialization
β βββ π core.py # Core constants and configurations
β βββ π config.py # Configuration management
β βββ π cli.py # Command-line interface
β β
β βββ π data/ # Data ingestion modules
β β βββ π __init__.py
β β βββ π base_client.py # Abstract base for API clients
β β βββ π spotify_client.py # Spotify API integration
β β βββ π lastfm_client.py # Last.fm API integration
β β βββ π youtube_music_client.py # YouTube Music integration
β β
β βββ π features/ # Feature extraction
β β βββ π __init__.py
β β βββ π acoustic_features.py # Audio feature extraction
β β βββ π behavioral_features.py # Listening behavior features
β β βββ π temporal_features.py # Time-based patterns
β β βββ π lyrical_features.py # Lyric analysis features
β β βββ π feature_pipeline.py # Complete feature pipeline
β β
β βββ π models/ # Machine learning models
β β βββ π __init__.py
β β βββ π personality_predictor.py # Base predictor class
β β βββ π ridge_model.py # Ridge regression implementation
β β βββ π random_forest_model.py # Random Forest implementation
β β βββ π model_ensemble.py # Ensemble methods
β β
β βββ π api/ # Web API (FastAPI)
β β βββ π __init__.py
β β βββ π main.py # FastAPI application
β β βββ π auth.py # Authentication routes
β β βββ π prediction.py # Prediction endpoints
β β βββ π admin.py # Admin/monitoring endpoints
β β
β βββ π utils/ # Utility functions
β βββ π __init__.py
β βββ π logging.py # Logging configuration
β βββ π database.py # Database utilities
β βββ π validation.py # Data validation
β βββ π encryption.py # Privacy/security utilities
β
βββ .env.example # Environment variables template
β
βββ π data/ # Data storage
β βββ π raw/ # Raw data from APIs
β βββ π processed/ # Processed/cleaned data
β βββ π external/ # External datasets
β βββ π features/ # Extracted features
β
βββ π models/ # Trained models
β βββ π saved/ # Production models
β βββ π checkpoints/ # Training checkpoints
β βββ π experiments/ # Experimental models
β
βββ π notebooks/ # Jupyter notebooks
β βββ π 01_data_exploration.ipynb
β βββ π 02_feature_engineering.ipynb
β βββ π 03_model_development.ipynb
β βββ π 04_evaluation.ipynb
β βββ π 05_privacy_analysis.ipynb
β
βββ π tests/ # Test suite
β βββ π conftest.py # Test configuration
β βββ π test_data_clients.py # API client tests
β βββ π test_features.py # Feature extraction tests
β βββ π test_models.py # Model tests
β βββ π test_api.py # API tests
β
βββ π experiments/ # Research experiments
β βββ π ablation_studies/ # Feature ablation experiments
β βββ π cross_cultural/ # Cross-cultural validation
β βββ π privacy_experiments/ # Privacy-preserving methods
β βββ π baselines/ # Baseline comparisons
β
βββ π reports/ # Analysis reports
β βββ π figures/ # Generated plots
β βββ π tables/ # Statistical tables
β βββ π analysis_report.md # Main analysis report
β
βββ π frontend/ # Web interface (future)
β βββ π package.json
β βββ π src/
β βββ π public/
β
βββ π docker/ # Containerization
βββ π Dockerfile # Main application container
βββ π docker-compose.yml # Multi-service setup
βββ π Dockerfile.research # Research environment
βββ π nginx.conf # Web server configuration
# Clone and setup
git clone https://github.com/tmarhguy/music-and-you.git
cd music-and-you
chmod +x setup_dev.sh
./setup_dev.sh
# Copy and configure environment
cp .env.example .env
# Edit with your API credentials
nano .env
# Authenticate with Spotify
music-and-you auth --platform spotify
# Collect listening data
music-and-you collect --user-id YOUR_USER_ID --days 180
# Extract features from listening data
music-and-you extract-features --input-file data/raw/listening_history.json
# Train personality prediction model
music-and-you train --features-file data/features/features.csv --survey-file data/survey_responses.csv
# Start the web server
music-and-you serve --host 0.0.0.0 --port 8000
# Run all tests
pytest
# Run specific test categories
pytest tests/test_features.py -v
pytest -m "not slow" # Skip slow tests
# Coverage report
pytest --cov=src/music_and_you --cov-report=html
# Format code
black src/ tests/
isort src/ tests/
# Lint code
flake8 src/ tests/
mypy src/
# Pre-commit hooks
pre-commit install
pre-commit run --all-files
# Build development container
docker-compose up --build
# Run in research mode
docker-compose -f docker/docker-compose.research.yml up
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββββ
β Music APIs β β Feature β β ML Models β
β β β Extraction β β β
β β’ Spotify βββββΆβ βββββΆβ β’ Ridge Regressionβ
β β’ Last.fm β β β’ Acoustic β β β’ Random Forest β
β β’ YouTube Music β β β’ Behavioral β β β’ Ensemble β
β β’ Apple Music β β β’ Temporal β β β’ Neural Networks β
βββββββββββββββββββ β β’ Lyrical β βββββββββββββββββββββ
ββββββββββββββββββββ β
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββββ
β Web API β β Data Storage β β Predictions β
β β β β β β
β β’ FastAPI ββββββ β’ PostgreSQL β β β’ Personality β
β β’ Authenticationβ β β’ Redis Cache β β Traits β
β β’ Rate Limiting β β β’ File Storage β β β’ Confidence β
β β’ Documentationβ β β’ Backups β β β’ Explanations β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββββ
Ready to contribute? Check out our Contributing Guide and Code of Conduct.
Questions? Open an issue or contact the maintainers.