Skip to content

feat(vo2max): Contextualized VO2max estimation (v1.9.8)#76

Merged
0jonjo merged 5 commits into
mainfrom
feat/vo2max-contextualized-v1.9.8
May 23, 2026
Merged

feat(vo2max): Contextualized VO2max estimation (v1.9.8)#76
0jonjo merged 5 commits into
mainfrom
feat/vo2max-contextualized-v1.9.8

Conversation

@0jonjo
Copy link
Copy Markdown
Owner

@0jonjo 0jonjo commented May 23, 2026

Summary

  • New estimate_detailed_vo2max method — retrocompatible (existing estimate_vo2max unchanged)
  • Returns Vo2maxResult struct: value, confidence, sub_maximal, adjusted_distance_km
  • Elevation adjustment via Naismith heuristic (100 m gain = +600 m flat-equivalent)
  • Confidence score based on effort duration (Daniels & Gilbert optimal window: 5–60 min)
  • Sub-maximal detection: avg HR < 85 % HRmax → sub_maximal: true + confidence downgraded to :low
  • Validates hr_avg > hr_max (raises Calcpace::Error)
  • Label classification references: Daniels (2014) Running Formula + ACSM guidelines

Test plan

  • 27 tests for Vo2maxEstimator (256 total, 0 failures)
  • Confidence :high / :medium / :low for representative efforts (10K, half, marathon)
  • Confidence :low for short effort (< 5 min, anaerobic zone)
  • Elevation adjustment increases estimated VO2max and adjusted distance correctly
  • Sub-maximal detection (70 % HRmax) and maximal detection (90 % HRmax)
  • hr_avg > hr_max raises Calcpace::Error
  • RuboCop clean (35 files)

Introduces `estimate_detailed_vo2max` alongside the existing `estimate_vo2max`
(unchanged, no breaking change). Returns a `Vo2maxResult` struct with:

- `value`: VO2max adjusted for elevation gain using Naismith heuristic
  (100m gain = +600m equivalent flat distance)
- `confidence`: :high / :medium / :low based on effort duration
  (Daniels & Gilbert optimal window: 5–60 min)
- `sub_maximal`: true when avg HR < 85% of HRmax, downgrades confidence to :low
- `adjusted_distance_km`: effective flat distance used in the calculation

Also validates that hr_avg cannot exceed hr_max (raises Calcpace::Error).

Label thresholds reference: Daniels (2014) Running Formula + ACSM guidelines.
Copilot AI review requested due to automatic review settings May 23, 2026 12:10
@0jonjo 0jonjo self-assigned this May 23, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new contextualized VO2max estimation API to Calcpace (while keeping the existing estimate_vo2max unchanged), returning richer metadata for consumers and documenting the new behavior as part of the v1.9.8 release.

Changes:

  • Introduces Vo2maxEstimator#estimate_detailed_vo2max returning a Vo2maxResult with elevation-adjusted distance, confidence, and sub-maximal flag.
  • Adds unit tests and README documentation for confidence bands, elevation adjustment, and HR-based sub-maximal detection.
  • Bumps gem version to 1.9.8 and records the feature in CHANGELOG.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/calcpace/test_vo2max_estimator.rb Adds test coverage for the new detailed VO2max result and metadata behaviors.
README.md Documents estimate_detailed_vo2max, including confidence semantics and examples.
lib/calcpace/vo2max_estimator.rb Implements Vo2maxResult, elevation adjustment, time-based confidence, and HR validation logic.
lib/calcpace/version.rb Version bump to 1.9.8.
CHANGELOG.md Changelog entry describing the newly added detailed VO2max estimation feature set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/calcpace/vo2max_estimator.rb Outdated
Comment thread README.md Outdated
@0jonjo 0jonjo merged commit 96bc1f4 into main May 23, 2026
8 checks passed
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