Adjust sports heat stress risk scale#304
Conversation
…rom 0.0-3.0 to 1.0-4.0
…heat-stress-risk-scale Fix/sports heat stress risk scale
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 20 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
WalkthroughThis release updates the pythermalcomfort package from version 3.9.1 to 3.9.2, implementing two key algorithmic changes to the Changes
Sequence Diagram(s)Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pythermalcomfort/models/sports_heat_stress_risk.py`:
- Line 153: The docstring examples for sports_heat_stress_risk currently never
exercise the vr clamp; add at least one minimal runnable example in the
sports_heat_stress_risk docstring that passes vr < sport.vr (use the Sports
enum, e.g. sport=Sports.RUNNING) so the function uses sport.vr as the minimum;
update the example input to show vr below the sport.vr threshold and include the
expected printed/returned result to demonstrate the clamped behavior (adjust the
examples at the locations around the existing examples to include this case).
- Around line 156-158: The example threshold prints are inconsistent with the
implemented midpoint logic (t_high is computed as the midpoint between t_medium
and t_extreme in the block around lines 331-336); re-run the example to capture
real values for result.t_medium, result.t_high and result.t_extreme and update
the three printed sample outputs so they mathematically match (i.e., t_high ≈
(t_medium + t_extreme)/2), and while here add applicability limits and a minimal
runnable example to the relevant model function/class docstring that
demonstrates creating the model, calling it, and reading
result.t_medium/result.t_high/result.t_extreme so the examples are accurate and
executable.
In `@tests/test_sports_heat_stress_risk.py`:
- Around line 22-23: The inline comment for the parametrized test case with
tuple (35, 35, 50, 0.5, Sports.RUNNING, 2.1) is incorrect: it labels the case as
"extreme risk" while the expected value 2.1 corresponds to the moderate band;
update the comment to say "moderate risk" (or otherwise make the comment
consistent with the expected 2.1 value) so the inline description matches the
test expectation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3400adc7-ffa4-47cb-9275-252997d88ac1
⛔ Files ignored due to path filters (1)
Pipfile.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
.bumpversion.tomlCHANGELOG.rstPipfiledocs/conf.pypythermalcomfort/__init__.pypythermalcomfort/classes_input.pypythermalcomfort/classes_return.pypythermalcomfort/models/sports_heat_stress_risk.pysetup.pytests/test_sports_heat_stress_risk.py
There was a problem hiding this comment.
Pull request overview
Updates the sports_heat_stress_risk model to use a 1.0–4.0 risk scale (instead of 0.0–3.0), clamps input air speed to a sport-specific minimum (sport.vr), and aligns documentation/tests and project versioning with the new behavior.
Changes:
- Shifted
risk_level_interpolatedscaling and updated recommendation thresholds to match1.0–4.0. - Enforced a sport-specific minimum relative air speed by clamping
vrtomax(vr, sport.vr)during calculation. - Updated docstrings, tests, changelog, and version metadata to reflect the revised model behavior.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
pythermalcomfort/models/sports_heat_stress_risk.py |
Updates risk scaling, recommendation mapping, and clamps vr to sport.vr. |
pythermalcomfort/classes_return.py |
Updates returned model documentation for the new 1.0–4.0 risk scale. |
pythermalcomfort/classes_input.py |
Documents that vr < sport.vr is accepted and clamped by the model function. |
tests/test_sports_heat_stress_risk.py |
Updates expectations for the new risk scale and adds a test for vr clamping behavior. |
CHANGELOG.rst |
Adds a 3.9.2 entry describing the risk scale and vr clamping changes. |
setup.py |
Bumps package version to 3.9.2. |
pythermalcomfort/__init__.py |
Bumps __version__ to 3.9.2. |
docs/conf.py |
Bumps documentation version/release to 3.9.2. |
.bumpversion.toml |
Bumps current_version to 3.9.2. |
Pipfile |
Moves pydantic into runtime packages. |
Pipfile.lock |
Updates the lockfile to match dependency/version changes. |
… and contribution sections
This pull request updates the
sports_heat_stress_riskmodel to improve the accuracy and clarity of its risk level calculation and recommendations. The main changes are a shift of the risk level scale from0.0–3.0to1.0–4.0, updated logic for wind speed handling, improved documentation, and comprehensive updates to the test suite to match the new logic.Sports Heat Stress Risk Model Updates
risk_level_interpolatedis now1.0–4.0(was0.0–3.0), with corresponding updates to thresholds, recommendations, and documentation. [1] [2] [3] [4]vris lower thansport.vr, it is clamped tosport.vrfor calculations. [1] [2] [3]Documentation and Example Updates
Test Suite Adjustments
sports_heat_stress_riskhave been updated to expect the new risk level scale and logic, including new tests for the air speed clamping behavior. [1] [2] [3] [4] [5] [6] [7] [8] [9]Versioning and Metadata
3.9.2in all relevant files, and the changelog has been updated to summarize these changes. [1] [2] [3] [4] [5]pydanticmoved from dev-packages to main packages inPipfile. [1] [2]Summary by CodeRabbit
Bug Fixes
Documentation
Tests
Chores