Expand services/naming.py with suggest_names() that picks random words
from a category while excluding nicknames already used in the run. Add
GET /runs/{run_id}/name-suggestions?count=10 endpoint that reads the
run's naming_scheme and returns filtered suggestions. Includes 12 unit
tests covering selection, exclusion, exhaustion, and cross-category
independence.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
2.2 KiB
Markdown
34 lines
2.2 KiB
Markdown
---
|
|
# nuzlocke-tracker-igl3
|
|
title: Name Generation
|
|
status: todo
|
|
type: epic
|
|
priority: normal
|
|
created_at: 2026-02-05T13:45:15Z
|
|
updated_at: 2026-02-11T20:44:23Z
|
|
---
|
|
|
|
Implement a dictionary-based nickname generation system for Nuzlocke runs. Instead of using an LLM API to generate names on the fly, provide a static dictionary of words categorised by theme. A word can belong to multiple categories, making it usable across different naming schemes.
|
|
|
|
## Architecture Decisions
|
|
|
|
- **Dictionary storage**: Static JSON file in `backend/src/app/seeds/data/`, alongside other seed data. Not exposed to frontend directly.
|
|
- **Dictionary format**: Category-keyed structure (`{ "mythology": ["Apollo", ...], "space": ["Nova", ...] }`) for fast lookup by naming scheme. Words may appear in multiple categories.
|
|
- **Suggestion logic**: Backend service with API endpoint. Frontend calls the backend to get suggestions.
|
|
- **Used-name tracking**: No new storage needed. The existing `Encounter.nickname` field already tracks assigned names. The suggestion engine queries encounter nicknames for the current run and excludes them.
|
|
- **Naming scheme per run**: Dedicated nullable `naming_scheme` column on `NuzlockeRun` (not in the `rules` JSONB).
|
|
|
|
## Approach
|
|
|
|
- **Static dictionary**: A local data file (JSON) containing words organised by category (e.g. mythology, food, space, nature, warriors, music, etc.)
|
|
- **~150-200 words per category**: A typical Nuzlocke has ~100 encounters, so this provides ample variety without repetition.
|
|
- **Name suggestion UX**: When registering a new encounter, the user is shown 5-10 suggested names from their chosen naming scheme. They can click one to select it, or regenerate for a fresh batch.
|
|
- **Naming scheme selection**: Users pick a naming scheme (category) per run, either at run creation or in run settings.
|
|
|
|
## Success Criteria
|
|
|
|
- [x] Word dictionary data file exists with multiple categories, each containing 150-200 words
|
|
- [x] Name suggestion engine picks random names from the selected category, avoiding duplicates already used in the run
|
|
- [ ] Encounter registration UI shows 5-10 clickable name suggestions
|
|
- [ ] User can regenerate suggestions if none fit
|
|
- [x] User can select a naming scheme per run |