Skip to content

feat(metrics): ✨ TRIMP #36#94

Draft
dvorka wants to merge 21 commits into
dev/1.58.0from
feat-36/trimp-revamp-ii
Draft

feat(metrics): ✨ TRIMP #36#94
dvorka wants to merge 21 commits into
dev/1.58.0from
feat-36/trimp-revamp-ii

Conversation

@dvorka

@dvorka dvorka commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

This PR brings:

  • TRIMP revamp w/ several new charts, insights, analyses.

Related:


Plan TRIMP:

  • slides to control k1, k2, t1 and t1
    • calibration section w/ explanation: per-sport calibration, per athlete calibration
    • sliders to have human friendly names ~ "adaptation to load", "regeneration speed"
    • athlete to move sliders & push Recalculate button to get update TRIMP
    • re-calibration cannot be on the separate page (as now), but on the page w/ the charts to have feedback
  • histogram of workout TRIMPs to see what's typical load
  • TRIMP w/o HR - solely based on the approximation

@dvorka dvorka self-assigned this Jun 24, 2026
@dvorka dvorka added the metrics label Jun 24, 2026
@dvorka dvorka changed the title feat(metrics): ✨ + TRIMP #36 feat(metrics): ✨ TRIMP #36 Jun 24, 2026
@dvorka
dvorka marked this pull request as draft June 24, 2026 09:34
@dvorka dvorka linked an issue Jun 24, 2026 that may be closed by this pull request
2 tasks
@dvorka
dvorka changed the base branch from dev/1.53.0 to dev/1.56.0 June 26, 2026 08:49
@dvorka
dvorka requested a review from Copilot July 1, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR expands MyTraL’s training analytics by introducing a power-based 3D impulse-response model (IRM3D) and a “TRIMP_ROCKS” Banister fitness–fatigue–performance revamp, including new pages, charts, caching, background warmup, and extended athlete metrics (CP / W′ / Pmax). It also updates docs and adds test coverage for the new models and routes.

Changes:

  • Add IRM3D computation, caching (file cache + background warmup task), and UI pages including a 3D activity classification chart.
  • Add Banister model entities/insights/impact analysis, a settings page for parameters, and enhanced TRIMP UI (KPIs + insight cards).
  • Extend athlete metrics persistence/derivation with critical power, W′, and Pmax + accompanying tests and documentation updates.

Reviewed changes

Copilot reviewed 66 out of 66 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/test_settings_athlete_metrics.py Adds assertions for new persisted athlete metrics fields.
tests/test_irm3d.py New unit tests for IRM3D math + pipeline + chart smoke.
tests/test_irm3d_route.py New route-level tests for IRM3D pages and helpers.
tests/test_irm3d_cache.py New tests for IRM3D file cache hashing/roundtrip/legacy handling.
tests/test_athlete_metrics.py Extends athlete metrics tests for CP/W′/Pmax estimation paths.
tests/conftest.py Ensures env vars are set before importing mytral.
mytral/templates/settings-banister.html New Banister parameter configuration page.
mytral/templates/macros/trimp-kpi-card.html New reusable KPI card macro for TRIMP/Banister pages.
mytral/templates/macros/trimp-insight-card.html New reusable “insight card” macro (gauges/boxplot markers).
mytral/templates/layout.html Updates Progress menu (adds IRM3D entry) and supports extra Bokeh scripts.
mytral/templates/insight-trimp.html Revamps TRIMP page with Banister mode, KPIs, insights, extra charts, and About section.
mytral/templates/insight-irm3d.html New IRM3D timeline page with cache-warming UX and explanatory footer.
mytral/templates/insight-irm3d-activities-3d-chart.html New Plotly-based 3D activity classification chart page.
mytral/templates/activity-get.html Adds TRIMP analysis shortcut button (and disabled state) on activity details.
mytral/templates/activity-analysis.html Reframes “classic” analysis and adds navigation to IRM3D/TRIMP analyses.
mytral/templates/activity-analysis-trimp.html New per-activity Banister/TRIMP impact analysis page.
mytral/templates/activity-analysis-irm3d.html New per-activity IRM3D per-second breakdown page with recording selector.
mytral/tasks/do/irm3d_cache_warmup.py New background task to warm IRM3D cache on first access.
mytral/static/documentation/sharing.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/normalization.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/metrics.html Adds Banister section/link and TOC entry in generated static metrics docs.
mytral/static/documentation/licenses.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/license.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/index.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/feature_metrics.html Adds Banister docs link + IRM3D bullet to metrics feature page.
mytral/static/documentation/feature_gpx_2d.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/feature_datasets.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/feature_3d_irm_metric_suite.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/digitalization.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/credits.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/changelog.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/architecture.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/analysis_tasks.html Adds Banister docs link to static docs navigation.
mytral/static/documentation/about.html Adds Banister docs link + minor wording update.
mytral/static/documentation/.feature_template.html Adds Banister docs link to the feature template nav.
mytral/settings.py Extends AthleteMetrics with CP/W′/Pmax + persists Banister params in UserProfile.
mytral/run.py Registers the new IRM3D blueprint.
mytral/run_desktop.py Registers the new IRM3D blueprint in desktop entry point.
mytral/routes.py Adds per-activity IRM3D analysis route.
mytral/releng.py Adds IRM3D + TRIMP_ROCKS feature flags and env vars.
mytral/metrics/irm3d_cache.py New IRM3D file cache implementation (hashing + JSON date handling).
mytral/metrics/banister/_insights.py New Banister insight-card generation logic.
mytral/metrics/banister/_impact.py New per-activity Banister impact analysis logic.
mytral/metrics/banister/_entities.py New Banister dataclasses (params/rows/annotations/insights/impact).
mytral/metrics/banister/init.py New Banister model runner/projector/annotator and re-exports.
mytral/metrics/init.py Introduces mytral.metrics package init.
mytral/forms.py Adds WTForms form for Banister parameter editing.
mytral/commons.py Adds shared Banister/TRIMP thresholds/constants.
mytral/blueprints/trimp_uri_space.py Adds Banister rows caching, TRIMP_ROCKS rendering path, per-activity TRIMP analysis, and Banister settings route.
mytral/blueprints/irm3d_uri_space.py New IRM3D blueprint: timeline, caching, warmup, and 3D chart page.
mytral/backends/dataset.py Exposes dataset cache via property (incl. setter for tests).
mytral/backends/caches/_cache_passthrough.py Adds Banister rows cache accessors (passthrough behavior).
mytral/backends/caches/_cache_inmemory.py Adds in-memory storage/eviction/memory sizing for Banister rows.
mytral/backends/cache.py Extends cache interface with Banister rows getter/setter.
mytral/athlete_metrics.py Adds Pmax estimator and derives CP/W′/Pmax estimated fields.
Makefile Enables IRM3D/TRIMP_ROCKS in dev/demo targets and updates “vibe” helper targets.
docs/METRICS.md Adds link/section for Banister model docs.
docs/METRICS.banister.md New Banister model documentation.
docs/FEATURE_METRICS.md Adds IRM3D bullet to metrics feature docs.
docs/FEATURE_ANALYSIS_METRICS_SET_OR_ESTIMATE.md Adjusts wording in the analysis/metrics planning doc.
docs/ABOUT.md Minor wording update to About doc.
docs/_SITEMAP.md Adds Banister model docs to sitemap.

Comment on lines +200 to +203
<script>
(function() {
var chartData = {{ chart_data_json|safe }};

overflow: visible !important;
}
</style>
<script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>
Comment on lines +39 to +40
from mytral.tasks import _entities as task_entities_mod
from mytral.tasks.do import irm3d_cache_warmup as cache_warmup_task # noqa: F401
Comment on lines +532 to +535
# invalidate cached Banister rows so they recompute with new params
user_cache = ds.cache.user(user_id)
user_cache.set_banister_rows(None)

Comment on lines +449 to +452
</div></div><div id="overview" class="card mb-3"><div class="card-body"><h2 id="banister-fitness-fatigue-performance-model">Banister Fitness-Fatigue-Performance Model</h2>
<p>MyTraL implements the Banister systems model for predicting performance from
training load. See the dedicated <a href="METRICS.banister.md">Banister Model documentation</a>
for the full mathematical model, performance zones, and per-activity analysis.</p>
Comment thread Makefile
Comment on lines +448 to +451
.PHONY: vibe-qwen
vibe-qwen-openrouter:
@cp -vf ./.github/copilot-instructions.md ./AGENT.md
qwen
CTRIMP (Chronic TRIMP, 42-day exponential moving average) and
TRIMPB (TRIMP balance CTRIMP - ATRIMP)
shows balance between short-term load, long-term load i.e. delta between fitness and fatigue.
<a href="https://journals.physiology.org/doi/full/10.1152/advan.00078.2011" class="link-primary" target="_blank">TRIMP (Training Impulse)</a>
Comment thread mytral/releng.py
# features to enable / disable
ACOACHES = "ACOACHES" # AI coaches
GSHEETS_DVORKA_IMPORT = "GSHEETS_DVORKA_IMPORT" # Dvorka's own GSheets import
IRM3D = "IRM3D" # 3D inpulse response model
@dvorka
dvorka changed the base branch from dev/1.56.0 to dev/1.58.0 July 6, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] TRIMP

2 participants