feat(vo2max): Contextualized VO2max estimation (v1.9.8)#76
Merged
Conversation
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.
There was a problem hiding this comment.
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_vo2maxreturning aVo2maxResultwith 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.8and records the feature inCHANGELOG.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
estimate_detailed_vo2maxmethod — retrocompatible (existingestimate_vo2maxunchanged)Vo2maxResultstruct:value,confidence,sub_maximal,adjusted_distance_kmsub_maximal: true+ confidence downgraded to:lowhr_avg > hr_max(raisesCalcpace::Error)Test plan
Vo2maxEstimator(256 total, 0 failures):high/:medium/:lowfor representative efforts (10K, half, marathon):lowfor short effort (< 5 min, anaerobic zone)hr_avg > hr_maxraisesCalcpace::Error