Skip to content

Comments

feat: Add user-managed genre preferences with catalog picker#6

Open
ericdjm wants to merge 1 commit intomainfrom
user-genre-cusotmization
Open

feat: Add user-managed genre preferences with catalog picker#6
ericdjm wants to merge 1 commit intomainfrom
user-genre-cusotmization

Conversation

@ericdjm
Copy link
Owner

@ericdjm ericdjm commented Jan 5, 2026

Implement comprehensive genre management system allowing users to customize their top genres beyond Spotify's auto-detected preferences. This enables better control over generation quality and personalized taste profiles.

Backend Changes:

  • Add Genre and UserGenre models with normalized name indexing
  • Create database migration (f3a4b5c6d7e8) with seed genres catalog
  • Implement genre catalog service with seeding and get-or-create helpers
  • Add genre management routes (GET catalog, POST add, DELETE remove)
  • Update Spotify profile endpoint to load and persist user genres
  • Refactor taste_analyzer to extract reusable helper functions:
    • compute_avg_popularity: Calculate average artist popularity
    • derive_mood_tags: Generate mood tags from genres and popularity
    • generate_summary: Create taste summary sentence
  • Update taste_analyzer logic to use user-managed genres when available
  • Add new schemas for genre catalog and user genre operations
  • Enforce 20 genre maximum limit per user

Database Schema:

  • genres table: id, name, normalized_name (unique), created_at
  • user_genres table: id, user_id, genre_id (composite unique), created_at
  • Unique constraints to prevent duplicates
  • Cascade delete on user and genre removal
  • Indexes on foreign keys for query performance

Frontend Changes:

  • Add genre picker UI to TasteDisplay component
  • Implement add/remove genre functionality with IconButton controls
  • Add genre catalog dropdown with search/filter
  • Display genre removal buttons on each tag
  • Add loading states for catalog and genre actions
  • Implement optimistic UI updates with profile refresh
  • Add toast notifications for errors and limits
  • Add API methods: getGenreCatalog, addUserGenre, deleteUserGenre
  • Wire up genre updates to profile state management in App.tsx

User Experience Improvements:

  • Users can now curate their top genres list manually
  • Genre changes automatically refresh taste profile analysis
  • Mood tags and summary sentence update based on selected genres
  • Visual feedback for all genre operations
  • Clear messaging when hitting the 20 genre limit
  • Persisted preferences across sessions

Technical Details:

  • Genre normalization ensures consistent matching (lowercase, trimmed)
  • Seed catalog includes 20 starter genres (ambient, art pop, etc.)
  • Auto-seed user genres from Spotify on first profile load
  • Parallel genre catalog loading to avoid blocking profile display
  • Proper error handling with rollback on integrity violations
  • Type-safe operations with Pydantic schemas and TypeScript interfaces

Documentation:

  • Add generation.md with comprehensive flow documentation
  • Document input concept, lyrics topic, and full generation flows
  • Explain single-step vs two-step generation paths
  • Detail auto-save behavior and instrumental short-circuit logic

Implement comprehensive genre management system allowing users to customize
their top genres beyond Spotify's auto-detected preferences. This enables
better control over generation quality and personalized taste profiles.

Backend Changes:
- Add Genre and UserGenre models with normalized name indexing
- Create database migration (f3a4b5c6d7e8) with seed genres catalog
- Implement genre catalog service with seeding and get-or-create helpers
- Add genre management routes (GET catalog, POST add, DELETE remove)
- Update Spotify profile endpoint to load and persist user genres
- Refactor taste_analyzer to extract reusable helper functions:
  - compute_avg_popularity: Calculate average artist popularity
  - derive_mood_tags: Generate mood tags from genres and popularity
  - generate_summary: Create taste summary sentence
- Update taste_analyzer logic to use user-managed genres when available
- Add new schemas for genre catalog and user genre operations
- Enforce 20 genre maximum limit per user

Database Schema:
- genres table: id, name, normalized_name (unique), created_at
- user_genres table: id, user_id, genre_id (composite unique), created_at
- Unique constraints to prevent duplicates
- Cascade delete on user and genre removal
- Indexes on foreign keys for query performance

Frontend Changes:
- Add genre picker UI to TasteDisplay component
- Implement add/remove genre functionality with IconButton controls
- Add genre catalog dropdown with search/filter
- Display genre removal buttons on each tag
- Add loading states for catalog and genre actions
- Implement optimistic UI updates with profile refresh
- Add toast notifications for errors and limits
- Add API methods: getGenreCatalog, addUserGenre, deleteUserGenre
- Wire up genre updates to profile state management in App.tsx

User Experience Improvements:
- Users can now curate their top genres list manually
- Genre changes automatically refresh taste profile analysis
- Mood tags and summary sentence update based on selected genres
- Visual feedback for all genre operations
- Clear messaging when hitting the 20 genre limit
- Persisted preferences across sessions

Technical Details:
- Genre normalization ensures consistent matching (lowercase, trimmed)
- Seed catalog includes 20 starter genres (ambient, art pop, etc.)
- Auto-seed user genres from Spotify on first profile load
- Parallel genre catalog loading to avoid blocking profile display
- Proper error handling with rollback on integrity violations
- Type-safe operations with Pydantic schemas and TypeScript interfaces

Documentation:
- Add generation.md with comprehensive flow documentation
- Document input concept, lyrics topic, and full generation flows
- Explain single-step vs two-step generation paths
- Detail auto-save behavior and instrumental short-circuit logic
@ericdjm ericdjm requested a review from CalderLund January 5, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant