Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# exercises-dataset

## Purpose

Fork of `hasaneyldrm/exercises-dataset` (1,324 fitness exercises: JSON data + GIF/thumbnail media + instructions in 11 languages). This fork's job: add **European Portuguese (`pt`)** instructions via the pipeline in `scripts/`, then contribute the result upstream as a PR — mirroring how the French PR (commit `6f3031b`) was structured. Not an app; a data repo with a Python pipeline.

## Stack

- Python 3 (system `python3`, currently 3.9) — stdlib only for scripts 1/3/4; script 2 calls any OpenAI-compatible HTTP endpoint. No package manager, no venv, no Node.
- Data: `data/exercises.json` (18 MB) validated by `data/exercises.schema.json`.
- `index.html` (17 MB) embeds a full inline copy of the dataset in one `const EXERCISES = [...]` line.

```
data/ exercises.json + JSON Schema — the source of truth
scripts/ PT-PT translation pipeline (see scripts/README.md — read it first)
glossary_pt.json pinned PT-PT fitness terminology (~150 terms)
en_strings.json unique EN strings (generated by step 1)
translations*.json, chunks/ intermediate outputs — never hand-edit
images/ videos/ 1,324 thumbnails + GIFs (© Gym visual — licensed media, never modify)
index.html interactive browser with inline dataset copy
```

## Commands

Full pipeline, in order (details + env vars in `scripts/README.md`):

```bash
python3 scripts/1_extract_unique.py # dedup EN steps → en_strings.json
python3 scripts/2_translate.py # needs OPENAI_API_KEY; resumable
python3 scripts/3_apply.py # writes pt into exercises.json, enforces 6 invariants
python3 scripts/4_sync_index_html.py # regenerates inline JSON in index.html
python3 scripts/3_apply.py --check # verify — this is the test suite
```

## Conventions

- `scripts/README.md` is the pipeline's authoritative doc — keep it in sync with any script change.
- The 6 invariants in `3_apply.py` are hard rules (schema-valid; `pt` step count == `en`; `instructions.pt` joins the steps; pre-existing fields byte-identical; no empty strings; `pt` last key after `fr`). Never weaken them to make a run pass.
- Translation register is impersonal 3rd person, no subject pronoun (`Deite-se`, `Mantenha`, `Repita`) — PT-PT, never PT-BR. Terms in `glossary_pt.json` are pinned: if the English source contains a glossary term, the mapped translation is mandatory.
- Scripts are stdlib-only, `from __future__ import annotations`, runnable on Python 3.9 — don't add pip dependencies.
- README.md follows upstream's style (badges, emoji headers) — match it when editing; changes here should stay upstream-mergeable.

## Definition of Done

- [ ] `python3 scripts/3_apply.py --check` passes (all 6 invariants)
- [ ] If `data/exercises.json` changed, `python3 scripts/4_sync_index_html.py` was re-run (data and index.html must never diverge)
- [ ] No hand edits to generated files (`en_strings.json`, `translations*.json`, `chunks/`, the inline JSON in `index.html`)
- [ ] `git status` reviewed — media files (`images/`, `videos/`) untouched

## Gotchas

- **Never read `index.html` or `data/exercises.json` fully** — 17–18 MB each. Use `head`, `rg`, or `jq` for targeted slices; `jq '.[0]'` shows a record shape.
- The inline `EXERCISES` line in `index.html` is one 16 MB line — only `4_sync_index_html.py` may touch it.
- `translations_partial_*.json` and `chunks/` are resumable-run intermediates of `2_translate.py`; deleting them loses paid translation progress.
- `2_translate.py` costs money (LLM API) — never run it unprompted; it's resumable, so partial runs are safe to continue.
- **Preferred translation path: the assistant translates directly** (chunk by chunk from `scripts/chunks/`, glossary-pinned) — never pull another model (ollama etc.) or call a paid API for work you can do yourself. This was corrected explicitly.
- Media is © Gym visual with its own license terms (see LICENSE/NOTICE.md) — data is MIT, media is not.
- Upstream is `hasaneyldrm/exercises-dataset`; `origin` is the `tutods` fork. The end goal of local work is an upstream PR, so keep the diff minimal and PR-shaped (like the French PR `6f3031b`).
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<img src="videos/0334-DsgkuIt.gif" width="120" alt="dumbbell lateral raise" />
</p>

**A comprehensive, ready-to-use fitness exercise dataset with 1,324 exercises — each with an animation GIF, 180×180 thumbnail image, category, body-part, equipment, target and muscle-group data, and step-by-step instructions in 10 languages (English, Spanish, Italian, Turkish, Russian, Chinese, Hindi, Polish, Korean, French).**
**A comprehensive, ready-to-use fitness exercise dataset with 1,324 exercises — each with an animation GIF, 180×180 thumbnail image, category, body-part, equipment, target and muscle-group data, and step-by-step instructions in 12 languages (English, Spanish, Italian, Turkish, Russian, Chinese, Hindi, Polish, Korean, French, European Portuguese, Brazilian Portuguese).**

[![Exercises](https://img.shields.io/badge/Exercises-1324-blue?style=flat-square)](data/exercises.json)
[![Animation GIFs](https://img.shields.io/badge/Animation%20GIFs-1324-brightgreen?style=flat-square)](videos/)
[![Thumbnails](https://img.shields.io/badge/Thumbnails-1324-orange?style=flat-square)](images/)
[![Languages](https://img.shields.io/badge/Languages-10-green?style=flat-square)](#-overview)
[![Languages](https://img.shields.io/badge/Languages-12-green?style=flat-square)](#-overview)
[![Mobile App](https://img.shields.io/badge/App-LogPress-111111?style=flat-square&logo=react)](https://github.com/hasaneyldrm/logpress-public)
[![License](https://img.shields.io/badge/License-MIT%20%2B%20media%20terms-blue?style=flat-square)](LICENSE)

Expand All @@ -32,7 +32,7 @@

- 1,324 exercises with category, body-part, equipment, target and muscle-group data
- an animation GIF + 180×180 thumbnail for every exercise (media © [Gym visual](https://gymvisual.com/) — see [License](#-license--use))
- step-by-step instructions in 10 languages (🇬🇧 English, 🇪🇸 Spanish, 🇮🇹 Italian, 🇹🇷 Turkish, 🇷🇺 Russian, 🇨🇳 Chinese, 🇮🇳 Hindi, 🇵🇱 Polish, 🇰🇷 Korean, 🇫🇷 French)
- step-by-step instructions in 12 languages (🇬🇧 English, 🇪🇸 Spanish, 🇮🇹 Italian, 🇹🇷 Turkish, 🇷🇺 Russian, 🇨🇳 Chinese, 🇮🇳 Hindi, 🇵🇱 Polish, 🇰🇷 Korean, 🇫🇷 French, 🇵🇹 European Portuguese, 🇧🇷 Brazilian Portuguese)
- the interactive browser (`index.html`) and developer setup guide (`setup.html`)

---
Expand Down Expand Up @@ -71,7 +71,7 @@ Each exercise entry contains:
| Muscle Group | Supporting / synergist muscles |
| Equipment | Equipment required (or `body weight` for bodyweight) |
| Instructions | Step-by-step instructions for each exercise |
| Available Languages | 🇬🇧 English · 🇪🇸 Spanish · 🇮🇹 Italian · 🇹🇷 Turkish · 🇷🇺 Russian · 🇨🇳 Chinese · 🇮🇳 Hindi · 🇵🇱 Polish · 🇰🇷 Korean · 🇫🇷 French |
| Available Languages | 🇬🇧 English · 🇪🇸 Spanish · 🇮🇹 Italian · 🇹🇷 Turkish · 🇷🇺 Russian · 🇨🇳 Chinese · 🇮🇳 Hindi · 🇵🇱 Polish · 🇰🇷 Korean · 🇫🇷 French · 🇵🇹 European Portuguese · 🇧🇷 Brazilian Portuguese |
| Media | 180×180 thumbnail (`image`) + animation GIF (`gif_url`) per exercise — media © Gym visual, see [License](#-license--use) |

---
Expand All @@ -88,7 +88,7 @@ A fully client-side exercise explorer with:
- Live search across all 1,324 exercises
- Filter by category, equipment, and target muscle
- Infinite scroll grid
- Click any card to see full details and instructions in English, Spanish, Italian, Turkish, Russian, Chinese, Hindi, Polish, Korean, or French
- Click any card to see full details and instructions in English, Spanish, Italian, Turkish, Russian, Chinese, Hindi, Polish, Korean, French, European Portuguese, or Brazilian Portuguese

### `setup.html` — Developer Setup Guide

Expand Down Expand Up @@ -131,7 +131,7 @@ exercises-dataset/
| Metric | Count |
|---|---|
| Total Exercises | **1,324** |
| Instruction Languages | **10** |
| Instruction Languages | **12** |

### Exercises by Body Part

Expand Down Expand Up @@ -190,7 +190,9 @@ Each record in `data/exercises.json` follows this structure. A machine-readable
| `instructions.pl` | `string` | Full step-by-step instructions in Polish |
| `instructions.ko` | `string` | Full step-by-step instructions in Korean |
| `instructions.fr` | `string` | Full step-by-step instructions in French |
| `instruction_steps.<lang>` | `array[string]` | Same instructions split into an ordered array of steps, per language (`en`, `es`, `it`, `tr`, `ru`, `zh`, `hi`, `pl`, `ko`, `fr`) |
| `instructions.ptPT` | `string` | Full step-by-step instructions in European Portuguese |
| `instructions.ptBR` | `string` | Full step-by-step instructions in Brazilian Portuguese |
| `instruction_steps.<lang>` | `array[string]` | Same instructions split into an ordered array of steps, per language (`en`, `es`, `it`, `tr`, `ru`, `zh`, `hi`, `pl`, `ko`, `fr`, `ptPT`, `ptBR`) |
| `muscle_group` | `string` | Primary synergist muscle group |
| `secondary_muscles` | `array[string]` | Additional muscles involved |
| `target` | `string` | Primary target muscle (e.g. `"biceps"`, `"pectoralis major"`) |
Expand Down Expand Up @@ -219,7 +221,9 @@ Each record in `data/exercises.json` follows this structure. A machine-readable
"hi": "अपने घुटनों को मोड़कर और पैरों को ज़मीन पर सपाट रखते हुए अपनी पीठ के बल लेट जाएँ।...",
"pl": "Połóż się płasko na plecach, ugnij kolana i oprzyj stopy płasko na pod ...",
"ko": "등을 바닥에 누워 무릎을 구부리고 발을 바닥에 붙입니다. ...",
"fr": "Allonge-toi sur le dos, les genoux fléchis et les pieds à plat au sol. ..."
"fr": "Allonge-toi sur le dos, les genoux fléchis et les pieds à plat au sol. ...",
"ptPT": "Deite-se de costas com os joelhos fletidos e os pés apoiados no chão. ...",
"ptBR": "Deite-se de costas com os joelhos flexionados e os pés apoiados no chão. ..."
},
"muscle_group": "hip flexors",
"secondary_muscles": ["hip flexors", "lower back"],
Expand Down Expand Up @@ -338,6 +342,8 @@ print(ex["instructions"]["hi"]) # Hindi
print(ex["instructions"]["pl"]) # Polish
print(ex["instructions"]["ko"]) # Korean
print(ex["instructions"]["fr"]) # French
print(ex["instructions"]["ptPT"]) # European Portuguese
print(ex["instructions"]["ptBR"]) # Brazilian Portuguese
```

### Python — Load with Pandas
Expand Down Expand Up @@ -390,6 +396,8 @@ console.log(ex.instructions.hi); // Hindi
console.log(ex.instructions.pl); // Polish
console.log(ex.instructions.ko); // Korean
console.log(ex.instructions.fr); // French
console.log(ex.instructions.ptPT); // European Portuguese
console.log(ex.instructions.ptBR); // Brazilian Portuguese
```

### TypeScript — Type-safe Usage
Expand All @@ -412,6 +420,8 @@ interface Exercise {
pl: string;
ko: string;
fr: string;
ptPT: string;
ptBR: string;
};
instruction_steps: {
en: string[];
Expand All @@ -424,6 +434,8 @@ interface Exercise {
pl: string[];
ko: string[];
fr: string[];
ptPT: string[];
ptBR: string[];
};
muscle_group: string;
secondary_muscles: string[];
Expand Down
Loading