Commit graph

2 commits

Author SHA1 Message Date
Danny
214596e26f feat: exercise_aliases table + lookup_exercise() alias-aware wrapper
New SQLite table `exercise_aliases (alias, canonical, source)` seeded
with ~40 common gym shorthand entries (OHP, RDL, "Bench", "Squat",
plural/singular drifts, slang). Lookups go through this table first,
then fall through to the strict exercise_db matcher — so the strict
matcher's "false negative for ambiguous single tokens" property is
preserved while still resolving every-day vocabulary.

Schema decision: every seed row is tagged `source='seed'` and re-seeded
on every init_db (deleted-then-reinserted), so editing the seed dict
in code is the one source of truth. User-inserted rows are tagged
`source='user'` and never touched by re-seeding. Migration path covers
existing DBs where the `source` column didn't exist (those rows tagged
'seed' on first migration, then refreshed from the current seed).

New helper db.lookup_exercise(name) wraps the alias resolution + the
exercise_db.lookup() call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 10:49:24 +03:00
Danny
ebd0016a62 feat: bundle Free-Exercise-DB + name matcher (step 1)
Adds the static exercise reference data (~870 entries, public
domain, source: github.com/yuhonas/free-exercise-db) plus a
conservative name matcher. New endpoint:

  GET /api/exercises/lookup?name=<name>
    → {"match": {"name", "primary_muscles", "secondary_muscles",
                 "equipment", "category", "level", ...}}
    → {"match": null}  when nothing plausibly matches.

Matcher tiers (priority order):
  1. exact (case-insensitive)
  2. compressed exact ("Pull-ups" → "Pullups")
  3. compressed substring, with a guard: single-token generics
     like "Bench"/"Squat" return null instead of misleading the
     user — the planned alias table will handle these properly.
  4. token-overlap with ≥50% coverage of the user's tokens.

UI integration ("Trains: chest · shoulders") comes in step 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 11:11:34 +02:00