Files
nuzlocke-tracker/.beans/nuzlocke-tracker-c6ly--build-name-suggestion-engine.md
Julian Tabel 2ac6c23577 Add name suggestion engine with API endpoint and tests
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>
2026-02-11 21:45:04 +01:00

1.6 KiB

title, status, type, priority, created_at, updated_at, parent, blocking
title status type priority created_at updated_at parent blocking
Build name suggestion engine completed task normal 2026-02-11T15:56:44Z 2026-02-11T20:44:27Z nuzlocke-tracker-igl3
nuzlocke-tracker-bi4e

Build the backend service and API endpoint that picks random name suggestions from the dictionary based on a selected naming scheme.

Requirements

  • Given a category and a run ID, return 5-10 unique suggestions
  • The engine queries the run's existing encounter nicknames and excludes them from suggestions
  • Support regeneration (return a fresh batch, avoiding previously shown suggestions where possible)
  • Handle edge case where category is nearly exhausted gracefully (return fewer suggestions)

Implementation Notes

  • Backend service: A Python module that loads the dictionary JSON, filters by category, excludes used names, and picks random suggestions.
  • API endpoint: GET /api/v1/runs/{run_id}/name-suggestions?count=10 — reads the run's naming_scheme, fetches encounter nicknames, returns suggestions.
  • No new DB tables needed: Used names come from Encounter.nickname on the run's encounters.
  • Caching: Load the dictionary once and cache in memory (it's static data).

Checklist

  • Create a service module for name suggestion logic (e.g. services/name_suggestions.py)
  • Implement dictionary loading with in-memory caching
  • Implement random selection from a category with exclusion of used names
  • Add API endpoint for fetching suggestions
  • Add unit tests for the suggestion logic