Skip to content

Add weekly training load report (Strava runs + Garmin recovery) - #2

Open
onehoka wants to merge 2 commits into
masterfrom
claude/project-thread-4z66ld
Open

onehoka wants to merge 2 commits into
masterfrom
claude/project-thread-4z66ld

Conversation

@onehoka

@onehoka onehoka commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Requested by iwan · project thread

What

  • strava/: a CSV store for Strava activities (data/activities.csv) and scripts/upsert.py, which takes the Strava list_activities JSON and upserts by activity id, same pattern as garmin/scripts/upsert.py. Seeded with 39 activities from Aug to 23 Oct 2026.
  • training/weekly_report.py: builds a markdown report per Monday–Sunday week:
    • total km, run count, total relative effort (Run/TrailRun/VirtualRun only)
    • week-over-week km change, flagged ⚠️ when it's above +10%
    • back-to-back run days (a Monday run after a Sunday run counts)
    • average sleep, HRV and resting HR from garmin/data/daily.csv
    • a "this week" summary and a list of all >10% jumps
  • training/reports/2026-10-23.md: sample output for the last 8 weeks.
  • Unit tests in training/test_weekly_report.py.

Usage

python3 training/weekly_report.py --weeks 8 --out training/reports/$(date +%F).md
cd training && python3 -m unittest test_weekly_report

Notes

  • Garmin sleep/HRV history only starts on 15 Oct 2026, so earlier weeks show – for recovery.
  • Report text is in Indonesian to match the existing READMEs.

Generated by Claude Code

- strava/: CSV store for Strava activities plus an upsert script for
  list_activities output, seeded with Aug-Oct 2026 history
- training/weekly_report.py: weekly km, run count, relative effort,
  week-over-week change (flags >10% jumps), back-to-back run days, and
  average sleep/HRV/RHR from Garmin, rendered as markdown
- tests and a sample report for the week of 19 Oct 2026

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019gbRNwSBGyW7dwwxemNuPy

@onehoka onehoka left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed for correctness. Logic of the weekly report is right: tests pass (5/5), and I hand-checked the sample report against strava/data/activities.csv (e.g. 19–25 Oct: effort 26+19+39+13 = 97, back-to-back Mon/Tue/Wed because Sun 18 Oct had a run). It does not conflict with #1 (git merge-tree of both heads is clean, no shared files).

Two things to fix before merging:

  1. Timezone bug in the --today default: in UTC environments a morning run of the report picks yesterday's date, which on Monday mornings shows last week as "current". Suggestion inline.
  2. Committed __pycache__/*.pyc files should be removed and ignored.

One non-blocking nit about the Strava upsert reusing the improved compare/save from #1.


Generated by Claude Code

Comment thread training/weekly_report.py Resolved
Comment thread strava/scripts/upsert.py Resolved
- weekly_report.py: default --today is the current date in WIB, so a
  run from a UTC machine before 07:00 WIB no longer picks yesterday
- README: TZ=Asia/Jakarta for the report filename date
- remove committed __pycache__ and ignore it at the repo root
- strava upsert: compare numbers by value and write the CSV atomically,
  same as the hardened Garmin upsert

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019gbRNwSBGyW7dwwxemNuPy
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.

2 participants