Sports Lib API - v23.12.1
    Preparing search index...
    import { DataDistance, DynamicDataLoader, ActivityUtilities } from '@sports-alliance/sports-lib/metrics';
    import type { ActivityInterface, UserUnitSettingsInterface } from '@sports-alliance/sports-lib/metrics';

    The public metrics entry includes the existing data catalog, canonical data classes and loaders, activity types, stream conversion utilities, lap types and unit/chart settings. Its values are the exact same exports as the package root, including DataStore and DynamicDataLoader. Existing metric validation, conversion, display and JSON behavior remain unchanged. TypeScript declarations support NodeNext, Bundler and legacy Node module resolution.

    File importers, route exporters and the SportsLib facade remain on the root entry. Keep runtime root imports out of the entire worker dependency graph: even a root import in a transitive helper can make a splitting bundler emit unused parser chunks. Inspect all emitted chunks, not only the worker's initial imports. The package verification checks every metrics-worker output and verifies runtime/format/type compatibility. No source reparse, derived-summary regeneration or persisted-data migration is needed. This entry exposes no new metric or MCP consumer contract.

    Effort Pace uses pace semantics (min/km), not speed semantics (m/s). Its average, minimum, maximum, and unit-variant metric types follow paceUnits.

    DynamicDataLoader.dataTypeAvgDataType, dataTypeMinDataType and dataTypeMaxDataType map a base or converted metric type to its existing summary siblings. The maps include speed and grade-adjusted speed in feet per minute, plus swim pace in its base and per-100-yard units, air power, depth and dive-rate summaries. Pressure SAC, Volume SAC and RMV expose their existing average siblings. Consumers can group available average, minimum and maximum summaries even when an average is absent. Partial families expose only recorded metric types: depth and dive rates have no minimum sibling, and dive descent has no standalone stream metric. Missing observations remain unavailable; these maps do not calculate values or select UI icons.

    getUnitBasedDataTypesFromDataType and getUnitBasedDataTypesFromDataTypes return the selected speed, pace, grade-adjusted speed/pace, swim pace and vertical-speed summary variants that getUnitBasedDataFromDataInstance actually produces. The bulk lookup also retains explicitly requested pace, grade-adjusted pace and swim pace without requiring a speed input. Existing speed-derived output ordering is retained; includeDerivedTypes: false still permits explicitly requested metrics. Empty unit selections return no variants, including effort pace and jump speed. With no settings, the single lookup keeps its canonical input and the bulk lookup retains its existing empty result. For effort pace and jump speed, a non-empty saved selection containing only unrecognized units retains the original metric through the single lookup and value-conversion APIs, as before; the bulk variant selector returns no supported choices. Mixed selections still convert the recognized units. Summary conversion ignores saved unit selections from other metric families rather than relabelling their values.

    Feet-, mile- and yard-based distance, speed and pace classes report UnitSystem.Imperial from getUnitSystem(). Their average/minimum/maximum and jump/effort variants inherit that metadata. This does not change their stored numeric values, unit strings or display conversions; metric class metadata stays metric.

    These corrections change lookup and unit-system metadata only. Canonical tokens, units, validation, calculations and JSON are unchanged. Existing activities need no reparse, summary regeneration or migration for these metadata fixes. Quantified Self's MCP numeric catalog membership and persisted-stat availability are unchanged. Its existing unitSystem descriptor changes to imperial for the corrected variants when a consumer adopts this package; no metric identifier, unit string, schema field, sensitive field or consent scope is added.

    Generation of a missing Average swim pace in minutes per 100 yard now converts Average Swim Pace, independently of running Average Pace. A real zero swim average remains zero. Running pace alone cannot create this swim summary, and an existing per-yard summary remains authoritative.

    This calculation correction is separate from the metadata fixes above. Earlier imports can have an absent or incorrect derived per-yard swim average. Missing values can be regenerated from the retained canonical swim average. Existing saved per-yard values are not overwritten by JSON reloads: use a targeted original-source reparse to reconstruct affected derived summaries while preserving actual source-provided values. No JSON shape, metric token, unit, queue or permission changes are needed. Package adoption, deployment and any production reparse remain separate actions. In Quantified Self, keep frontend/Functions package versions aligned and use the existing sanitized, version-checked reparse lifecycle; this library fix does not start historical processing.

    RRHeartRateFilter estimates integer heart rate from a continuous sequence of raw R–R intervals in milliseconds. filterRRHeartRate(samples, durationMs) adds elapsed end timestamps, resets at gaps and invalid observations, and excludes intervals crossing the activity bounds. It uses the same 0.001 ms clock-rounding tolerance as R–R analysis; sub-microsecond rounding at the activity end is clamped to that end. The timed helper returns original intervals, their elapsed end times and nullable heartRate, without changing its input or joining disconnected recordings.

    import { RRHeartRateFilter, filterRRHeartRate } from '@sports-alliance/sports-lib';

    const filter = new RRHeartRateFilter();
    filter.update(500); // null: no consistent estimate yet
    filter.update(500); // 120 bpm
    filter.update(2500); // 120 bpm: out-of-range input holds the previous output
    filter.reset(); // start a new continuous recording

    const filtered = filterRRHeartRate([
    { time: 500, interval: 500 },
    { time: 1000, interval: 500 }
    ], 1000);
    // [{ time: 500, interval: 500, heartRate: null }, { time: 1000, interval: 500, heartRate: 120 }]

    The filter implements a supplied engineering description; it is not a verified reproduction of device firmware. It rounds positive inputs to integer milliseconds, accepts 250–2,000 ms inclusively and inserts positive out-of-range intervals into history before holding the output. Nonpositive/nonfinite values, or values that cannot round to a positive safe integer, reset the filter instead of entering arithmetic. Missing estimates are null, never a numeric 0 or 255 sentinel. Call reset() on a streaming instance after a disconnect; the timed helper handles recorded gaps.

    The circular history starts with forty 771 ms entries; its observed count saturates at 39. A reliable previous interval requires one match among the latest two intervals; otherwise the whole history is scanned and requires 1 + floor(count / 3) matches. Rounded integer HR comparisons must differ by strictly less than 7 bpm, and every match becomes the next comparison reference. Above 120 bpm, an estimate within strictly 10 bpm of half the previous candidate is held until 60 seconds of interval time have elapsed without an accepted update. The half-rate comparison truncates the previous candidate in 0.1 bpm units divided by 20. A change strictly below 10 bpm follows directly. Both smoothing stages apply 30% integer corrections with half-way values rounded away from zero; the second stage targets the candidate directly when its difference from the first stage is strictly below 5 bpm. The first established target initializes both smoothing states.

    Suunto JSON/SML imports use this filter for their existing R–R-derived HR replacement path, requiring more than ten in-range intervals with available estimates before replacing source HR. Held out-of-range outputs do not satisfy that count. The raw IBI stream stays intact and HR-only stream selection still works without returning IBI. FIT continues to preserve recorded HR; callers can pass its raw IBI samples to the same helper to calculate a separate estimate. This does not add an automatic FIT HR fallback, a new stream type or a new canonical numeric stat.

    This causal HR filter is separate from the unsmoothed HRV/quality analysis below. Artifact flags do not pre-filter its input; its 250 ms lower bound does not change the HRV quality classifier's 300 ms bound. R–R mean HR and rolling-window HR summaries retain their existing definitions. A filtered trace is an estimate, not independent reference evidence for device accuracy or rhythm diagnosis.

    Existing persisted streams and summaries are not rewritten on load. To update older Suunto-derived HR, consumers need an authorized original-file reparse and regeneration of affected derived HR summaries and calculated load through their normal reconciliation lifecycle; imported summaries retain existing precedence. Quantified Self adoption must align frontend/Functions package versions and review Help, on-demand HR chart/sample reads and any historical reparse. The existing numeric Heart Rate catalog/projection can carry normally persisted values; this adds no MCP metric, scope, tool, consent or automatic exposure of the detailed filter output. Health/Sleep, saved routes, HRV summaries and their persisted schemas are unchanged. Package publication, dependency adoption, reparses and deployments are separate actions.

    analyzeRRIntervals(samples, durationMs) analyzes unsmoothed beat intervals with elapsed-millisecond end timestamps. analyzeActivityRR(activity) reads an activity's raw IBIStream; resampled one-second chart streams are ineligible. Both return versioned summaries and optional classified beats/rolling windows. { includeDetails: false } omits detailed output while retaining summary DFA calculations. calculateDFAAlpha1(intervals) accepts an already quality-controlled continuous sequence.

    FIT HRV and Suunto JSON/SML imports generate the available numeric summaries before serialization. Timestamped Suunto batches preserve gaps. FIT HRV uses cumulative timing because decoded HRV records have no independent timestamps; internal disconnect locations cannot be recovered from that array. Unused FIT uint16 slots (null, or 65.535 seconds from older decoders) are ignored without advancing time or breaking beat adjacency, following Garmin's HRV array explanation. Later multisport legs use their own elapsed clock. Intervals crossing a leg boundary retain their original end timestamp for clipped coverage; they do not contribute partial beats to HRV or extend derived HR samples past the leg end. Untimestamped Suunto batches retain cumulative timing anchored to the source/activity start. Legacy SML XML interval arrays use the activity's first UTC sample as their anchor; a timezone-less header clock does not override it. When no UTC samples exist, the XML adapter retains its existing header-start fallback. Stream selection still controls IBI inclusion.

    Recording-quality rules use 300–2,000 ms inclusive, then compare each interval to the median of up to five in-range neighbors on each side within the same continuous segment. Values strictly below 80% or above 120% of that reference are short/long artifacts. Suspected ectopic pairs require two otherwise accepted consecutive intervals, the first strictly below 90% of its reference, the second strictly above 105%, and a combined duration within ±10% of one reference interval around twice that reference. Pairs are counted separately and excluded from HRV. These are algorithmic descriptions, not diagnoses or proof of a sensor failure.

    SDNN uses sample standard deviation. RMSSD and pNN50 use only adjacent accepted observations within the same segment; pNN50 counts absolute differences strictly greater than 50 ms. Accepted zero variability is preserved. Mean HR is 60,000 divided by accepted mean interval, distinct from source-recorded HR. Nonpositive/nonfinite observations are counted independently as invalid and break adjacency. Overlapping or backward timestamps are rejected. Clock rounding within 0.001 ms is tolerated; larger internal gaps break adjacency and contribute to gap count and longest gap.

    Recording coverage is the sum of clipped recorded interval durations divided by elapsed activity duration, including excluded positive intervals. Complete in-bounds beats alone contribute to beat statistics. Coverage is not a claim that an untimed interval array contains independently verified gap evidence. Legacy arrays keep cumulative timing. IBIStream(data, sampleTimes) optionally retains aligned elapsed end timestamps in additive native JSON sampleTimes; replacing stream data invalidates that timing. Consumers that regenerate stats from explicit IBI timing must preserve this optional field. Original-file reparse is needed to recover timestamps discarded by earlier imports.

    Regular Stream('IBI', ...) chart samples serialize with sampling: '1Hz'. Native JSON restoration keeps them on their one-second clock and ineligible for beat analysis. Raw IBIStream exports omit that field; existing raw arrays and legacy dictionaries retain their cumulative interpretation. Consumers must preserve both sampling and sampleTimes when present and adopt a reader that understands them. Older saved chart arrays without this distinction cannot reliably be distinguished from raw legacy beats; recover their raw intervals from the original file instead of guessing from sample values. This adds no metric name, unit or numeric MCP field.

    ActivityUtilities.cropTime retains raw IBI by interval timestamps and rebases their end times to the cropped start. Intervals crossing either boundary retain coverage evidence but remain excluded from full-beat HRV statistics. Internal gaps and invalid-observation barriers survive cropping and JSON reloads. Regular chart streams continue to use the existing inclusive one-second crop; the fractional-start rounding rule is unchanged. As with other cropped data, existing summaries are retained: callers must clear and regenerate affected summaries when desired.

    Rolling estimates use a five-second grid that never extends beyond activity end. Heart rate requires a complete ten-second lookback with at least 90% recorded coverage; its available windows define the summary minimum/maximum. RMSSD and artifact percentage require a complete one-minute lookback with at least 90% recorded coverage. DFA requires a complete two-minute window, at least 90% coverage, at least 50 accepted intervals, one continuous segment and at most 5% excluded intervals, including suspected-pair members. Isolated internal exclusions are linearly interpolated against accepted neighbors on the elapsed-time axis; windows with excluded endpoints are unavailable. No intervals are compacted across gaps. DFA centers and integrates the signal, linearly detrends forward and reverse non-overlapping segments at each integer scale 4–16, and fits log fluctuation versus log scale. The standalone function needs at least 32 intervals; constant signals have no finite scaling estimate. No intensity thresholds or recovery classifications are inferred.

    Data class Canonical token Unit
    DataRRIntervalCount R-R Interval Count count
    DataRRInvalidIntervalCount R-R Invalid Interval Count count
    DataRRArtifactCount R-R Artifact Count count
    DataRRArtifactPercentage R-R Artifact Percentage %
    DataRRSuspectedEctopicPairCount R-R Suspected Ectopic Pair Count count
    DataRRSuspectedEctopicPairRate R-R Suspected Ectopic Pair Rate pairs/h
    DataRRCoverage R-R Coverage %
    DataRRGapCount R-R Gap Count count
    DataRRLongestGap R-R Longest Gap s
    DataRRMeanInterval R-R Mean Interval ms
    DataRRHeartRateAvg R-R Average Heart Rate bpm
    DataRRHeartRateMin R-R Minimum Heart Rate bpm
    DataRRHeartRateMax R-R Maximum Heart Rate bpm
    DataRRRMSSD R-R RMSSD ms
    DataRRSDNN R-R SDNN ms
    DataRRPNN50 R-R pNN50 %
    DataRRDFAAlpha1Median R-R DFA Alpha1 Median dimensionless
    DataRRDFAAlpha1Min R-R DFA Alpha1 Minimum dimensionless
    DataRRDFAAlpha1Max R-R DFA Alpha1 Maximum dimensionless
    DataRRDFAWindowCount R-R DFA Window Count count

    Unavailable scalar estimates are omitted; zero counts and valid zero HRV remain numeric. Explicit persisted stats are preserved during missing-stat generation. A sole activity's summaries appear on its parent event. Multi-activity summaries omit these metrics rather than average HRV, percentages or DFA medians without sufficient evidence. Activity HRV is independent of Health and overnight HRV; their existing canonical tokens and semantics remain stable.

    All scalar classes are public, enumerated by DataStore, validated as finite numbers and restored through DynamicDataLoader and native event JSON. Quantified Self can discover their canonical names and units through its existing numeric catalog, and may expose only actually persisted stats through its existing permissions/projections. Detailed beats, timestamps and classifications are not new numeric metric classes or automatically authorized MCP output. No tool schema, scope, provider action or plugin change is implied by these exports.

    New imports gain the stats when their source includes IBI. Historical summary-only records require a controlled original-file reparse after consumers adopt the library version. Overnight HRV and saved routes are unchanged; no Training snapshot schema migration is needed. Corrected R–R-derived HR timestamps can change existing HR summaries or load on reparse, so consumers must use their normal activity/Training reconciliation lifecycle. A QS dependency adoption must align frontend/Functions versions and review Help and the safe numeric projection. No package publication, production reparse or deployment is automatic.

    EventUtilities.reGenerateStatsForEvent independently sums Timer time and Elapsed time when every leg supplies a finite nonnegative value for that clock. Zero is valid. A missing or invalid child value leaves that parent clock unavailable; wall-clock dates and other clocks are not substitutes. Child timing and rests are unchanged. Regenerating an existing event with complete child timing restores these totals without an original-file reparse. Generic event regeneration still rebuilds summaries from children; source-only parent observations must be retained separately by an original-file import workflow, never distributed among legs or treated as current values after edits or merges.

    Stamina and its Average, Minimum, and Maximum keys remain unchanged. Suunto JSON/SML Endurance continues to use this percentage family; Garmin Stamina and Potential Stamina retain their existing mappings. Consumers may label verified Suunto observations EnergySense Endurance without changing serialized keys. The Suunto importer now records creator.manufacturer = 'Suunto' from the source format. Friendly device names alone do not establish that provenance.

    DataEstimatedSustainableDistance adds canonical Estimated Sustainable Distance and DataEstimatedSustainableDistanceMin adds Minimum Estimated Sustainable Distance. Values are finite, nonnegative metres, with separate miles display variants registered in DynamicDataLoader; zero is valid. They represent estimates, never travelled distance or distance remaining to a target, and are not summed across activities. A sole activity's stats can appear unchanged on its parent event. No multi-activity estimate is derived.

    Suunto JSON/SML EnduranceDistance samples map directly to the distance stream. Object/array summaries map Cur to the end-of-scope scalar and Min to the provider minimum. Both take precedence over sampled observations; only a missing minimum is derived from the canonical one-second samples. The normal timestamp collision policy can make that sampled minimum differ from the minimum of all raw readings. Samples alone do not fabricate an ending scalar. Gaps and increases are preserved, while missing, null, nonnumeric, nonfinite and negative distances are omitted. There are no derived average/maximum variants. The undocumented EnduranceValid flag does not suppress populated observations or assert provider validation. Both Suunto formats now honor streams.includeTypes, including derivation dependencies.

    Source unit: EnduranceDistance is in metres, as confirmed by the maintainer in #158. The raw numeric values are retained without scaling; this confirmation requires no conversion change or data migration. Suunto's EnergySense explanation describes sustainable distance and remaining endurance but does not specify the export field's unit or validity flag. No speculative FIT mapping is added: an export without these observations remains unavailable.

    Label changes require no key migration. New persisted distance summaries and explicit Suunto manufacturer metadata require original-file reparse for historical records; retained JSON/SML can hydrate charts without a persistence rewrite. FIT-only records cannot recover omitted source fields. Downstream regeneration must preserve freshly parsed endurance summary values before deriving missing stats, and numeric discovery must require actual persisted availability.

    Runtime pace at zero speed remains infinite, preserving the existing calculation and display behavior. Event, activity, lap, route, and route-file summary JSON omits non-finite scalar numbers instead of persisting null-valued metrics. Native event/activity/lap/route/route-file JSON restoration ignores legacy null/non-finite scalar stats while preserving finite zero/negative values, structured data, and stream null gaps. Canonical metric names, aliases, units, formulas and the imported TSS policy remain unchanged. See native JSON round trips.

    The public numeric catalog remains enumerable/loadable through DataStore/DynamicDataLoader; finite values retain their canonical JSON keys and units. This correction adds no catalog entry. Consumers can read older invalid pace JSON without a source reparse; rewriting persisted data remains a separate consumer operation.

    DataSwimDistance keeps the canonical Distance token, meter value and JSON representation. Its optional SwimDistanceUnits constructor argument selects meters (the default) or yards for display only; long swims stay in those units instead of switching to kilometers or miles. For example, new DataSwimDistance(91.44, SwimDistanceUnits.Yards) displays 100 yd, while getValue() remains 91.44 and toJSON() remains { Distance: 91.44 }. DynamicDataLoader preserves this explicit display choice. Consumers can choose it from the first swim-pace preference without changing general distance preferences or stored values. This display option requires no activity/route reparse, derived recalculation, or persisted-data migration. Numeric discovery and canonical wire values remain unchanged; the display unit is not a new metric or persisted unit.

    EHPE is estimated horizontal position error; EVPE is estimated vertical position error. Both are device estimates in meters, not measured deviations from a known reference position. Their base, Average, Minimum and Maximum classes return m from getUnit() and getDisplayUnit(), and format getDisplayValue() to one decimal place. For example, new DataEHPEAvg(3.87654) displays 3.9 m. Values remain in meters even above 1000; position error does not use the general distance formatter's kilometer switching. Suunto sample import preserves its recorded numeric values.

    Only display formatting and the formerly empty unit metadata change. getValue(), summary calculations, canonical type tokens and JSON numeric values retain full precision. Existing persisted stats gain the corrected display when loaded with this version, without activity/route reparsing, summary regeneration or a persisted-data migration.

    All eight existing classes remain package-root exports, enumerable through DataStore and loadable through DynamicDataLoader using their existing canonical tokens. The numeric catalog's unit metadata changes from empty to m; numeric query values and persisted stat keys do not change.

    Sports Lib currently exposes a broad metric surface from the public data barrel (src/data/index.ts) and concrete data classes (static type declarations).

    • Exported data modules from src/data/index.ts
    • Concrete canonical metric type strings (Data*.type) from exported Data classes
    • Minimum/Maximum/Average family types
    • Unit variant types (... in ...)
    • Zone/target types

    The library exposes these metrics through streams, stats, laps/events, and event summaries. Canonical type strings are the same values used by ActivityParsingOptions.streams.includeTypes. Some legacy metric types include intentional whitespace in their token (for example Steps), so copy tokens exactly.

    Time metric semantics:

    • Duration (unit: s): active duration (timer time).
    • Timer time (unit: s): explicit timer/active time.
    • Elapsed time (unit: s): wall-clock elapsed time (includes pauses).
    • Pause Time (unit: s): supported paused time; inconsistent source timing must not produce a negative value.
    • Moving time (unit: s): movement-only time; separate from pause semantics.

    For a sole FIT session whose complete timer timeline and ordered records corroborate longer chronology, Elapsed time includes the full span and Pause Time its inactive portion; the recorded Duration and Timer time stay active-only. See recorded timing for evidence requirements, precision tolerance, duration limits and original-file reparse requirements. No metric token, unit or JSON schema changes; downstream numeric reads receive the corrected existing values after reparse.

    Suunto JSON/SML windows keep active time separate from their interval's elapsed time. Contradictory active timing requires independent header or timer-event evidence; otherwise active/timer/pause summaries and duration-dependent TSS candidates and durability evidence remain unavailable. Multisport active/pause totals require every leg; ordinary native JSON retains missing summaries without manufacturing zeros. See the Suunto import contract for scope, source precision and original-file regeneration requirements. Imported TSS retains priority; calculated HR still requires valid active timing as well as calibration and sample coverage.

    High-level metric domains include:

    • Core streams/stats: time, distance, speed, pace, swim pace, heart rate, cadence, stroke rate, power, altitude, depth, grade, vertical metrics
    • Zones and targets: heart-rate/power/speed zone durations and zone targets
    • Device/context: battery, pressure, satellites, sensor/pod flags, fused location flags, device metadata
    • Performance analytics: normalized power, power curve, FTP, IF, TSS, critical power, W', power work, stamina, durability evidence, legacy three-dimensional strain evidence
    • Running/cycling/swim dynamics: ground contact, flight time, ground-contact balance, oscillation, ratio, SWOLF, efficiency-related metrics
    • Jump analytics: jump count/events and min/max/avg families for jump height, distance, speed, score, rotations, hang time
    • Provider-neutral Health and sleep: daily movement and energy, cardiovascular samples, wellness, body composition, sleep stages, sleep scores, and sleep-qualified vital aggregates

    Ground Contact Time is the canonical Sports Lib terminology. FIT protocol names remain importer details:

    Source field Canonical metric Source unit Stored unit
    FIT stance_time / avg_stance_time Ground Contact Time / Average Ground Contact Time ms ms
    FIT stance_time_percent / avg_stance_time_percent Ground Contact Time Percentage / Average Ground Contact Time Percentage % %
    FIT stance_time_balance / avg_stance_time_balance Ground Contact Time Balance Left and Ground Contact Time Balance Right % %
    Suunto GroundContactTime Ground Contact Time s ms
    Suunto LeftGroundContactBalance / RightGroundContactBalance Ground Contact Time Balance Left / Ground Contact Time Balance Right % %
    Suunto FlightTime Running Flight Time s ms
    Suunto ContactTimeRatio Contact Time to Flight Time Ratio % %

    FIT ground-contact-time percentage is the fraction of the running cycle spent in ground contact. Suunto contact time to flight time ratio is a separate source measurement and may exceed 100%; Sports Lib neither aliases nor converts it to FIT ground-contact-time percentage. Running flight time is also distinct from jump hang time and Stryd ground time. Suunto non-positive flight-time and contact-time-ratio values are treated as missing provider sentinels; the corpus contains running files with all-zero flight samples and null flight summaries.

    Suunto running-dynamics summaries accept both header objects ({ Avg, Min, Max }) and window arrays containing that object. Deprecated Stance Time classes remain loadable for historical native JSON, but FIT imports emit only the canonical Ground Contact Time streams. Existing persisted activities must be reparsed from their FIT or Suunto source files to gain metrics newly supported here; no existing canonical values require migration.

    Sports Lib exposes provider-neutral scalar Data* classes for Health and sleep values. These classes define stable canonical type tokens, units, display formatting, aliases, DataStore enumeration, dynamic loading, and native JSON round trips. They do not add a provider transport, a Health record container, or a sleep-session container. A consumer decides whether a value belongs in a stream, statistic, Health source record, or sleep session.

    Numeric classes in the Health and sleep catalog accept finite numbers only, including reused activity primitives such as steps, distance, altitude, heart rate, weight, VO₂ max, and fitness age. NaN and infinite values are rejected before JSON serialization. Score, count, category, and duration units remain available through getUnit(), while count, score, category, and duration display units intentionally omit a suffix. Duration display uses the standard Sports Lib human-readable duration formatter.

    Each Health and sleep scalar supports a storage-safe round trip through its canonical JSON object. toJSON() emits one canonical type key, while the concrete class's fromJSON() validates that exact single-key shape before constructing the metric. Alias keys and objects with additional properties are rejected instead of being persisted ambiguously.

    const stored = JSON.stringify(new DataSleepDuration(28_800).toJSON());
    const restored = DataSleepDuration.fromJSON(JSON.parse(stored));

    The provider-neutral Health catalog is:

    Canonical type Stored unit Display behavior
    Steps count Rounded count, no suffix
    Wheelchair Pushes count Rounded count, no suffix
    Distance m Existing meter/kilometer distance display
    Wheelchair Push Distance m Existing meter/kilometer distance display
    Floors Climbed count Rounded count, no suffix
    Active Duration s Human-readable duration
    Moderate Intensity Duration s Human-readable duration
    Vigorous Intensity Duration s Human-readable duration
    Altitude m Existing rounded altitude display
    Active Energy kcal Rounded kilocalories
    Basal Energy kcal Rounded kilocalories
    Total Energy kcal Rounded kilocalories
    Heart Rate bpm Existing rounded heart-rate display
    Resting Heart Rate bpm Rounded beats per minute
    Heart Rate Variability ms One decimal; displayed as HRV
    Blood Oxygen Saturation % One decimal; displayed as SpO₂
    Respiration Rate br/min One decimal
    Stress Level score One decimal, no suffix
    Stress State category Source category, no suffix
    Stress Duration s Human-readable duration
    Body Energy % One decimal; Body Battery is an alias
    Body Energy Change % Signed, one decimal
    Recovery Score score One decimal, no suffix
    Weight kg Canonical one-decimal display; Body Weight is an alias
    Body Mass Index kg/m² One decimal; displayed as BMI
    Body Fat % One decimal
    Body Water % One decimal
    Muscle Mass kg One decimal
    Bone Mass kg Two decimals
    Systolic Blood Pressure mmHg Rounded millimeters of mercury
    Diastolic Blood Pressure mmHg Rounded millimeters of mercury
    Pulse Rate bpm Rounded beats per minute
    Skin Temperature Deviation °C Signed, one decimal
    VO2 Max ml/kg/min Two decimals; displayed as VO₂ Max
    Fitness Age years Numeric years

    UserUnitSettingsInterface.elevationUnits independently selects ElevationUnits.Meters (the backward-compatible fallback) or ElevationUnits.Feet. DynamicDataLoader.getUnitBasedDataFromDataInstance returns the same concrete altitude, GPS/Stryd/smoothed altitude, minimum/maximum/average/start/end altitude, ascent or descent metric with the selected presentation. Distance and vertical-speed preferences remain independent. Accuracy/error distances, diving depth and the boolean Fused Altitude flag retain their own existing semantics.

    The exact conversion is 0.3048 metres per foot. getDisplayValue() and getDisplayUnit() show the selected unit; getDisplayNumericValue() supplies an unrounded numeric input value. DataAltitude.fromDisplayValue(value, units) (and its inherited concrete-metric variants) converts user input back to canonical metres. getValue(), getUnit(), canonical metric tokens and toJSON() are unchanged, including on display-configured instances. JSON hydration defaults to metres; reapply the viewer's preference after hydration. No source reparse, derived-summary regeneration or stored activity migration is required. Existing MCP numeric catalog names and canonical metre values remain unchanged.

    This follows the canonical weight display preference pattern. Use getDisplayNumericValue() for editable inputs, not the rounded getDisplayValue(). Input conversion has ordinary floating-point precision; preference changes and JSON round trips retain the original canonical number exactly rather than converting a rounded display back into storage. Explicit constructors reject unsupported display units, and input factories reject nonnumeric or non-finite values before conversion. Missing or invalid user preferences still fall back to metres through DynamicDataLoader.

    Mass display for planned exercise loads uses the existing canonical DataWeight primitive in kilograms, not a new planned-workout metric or event-stat field. WeightUnits.Pounds asks DynamicDataLoader.getUnitBasedDataFromDataInstance for a display-only DataWeight instance; its visible value uses the exact 0.45359237 kg/lb conversion and displays to one decimal place. WeightUnits.Kilograms and older settings without weightUnits keep kilograms, independently of distance preference. The instance's getValue(), getUnit(), getType() and toJSON() remain canonical kilograms. This additive display change needs no source reparse, derived-summary regeneration, or persisted-data migration. DataWeight.fromDisplayValue(value, units) converts a user-entered kg or lb number back to canonical kilograms; callers still validate workout-specific load bounds before persistence. No consumer needs its own kg/lb conversion constant.

    Other planned-workout scalars already use the existing duration (seconds), distance (metres), heart rate (bpm), power (watts), speed (m/s), pace (seconds per distance), cadence (rpm), and power work (kJ) classes. A rowing 500 m split is composed from duration and distance display; repetitions and relative percentages remain recipe semantics rather than recorded Data* metrics. Sports Lib does not store schedules, exercise sets, provider delivery, or account state.

    Sleep sessions use the following aggregate types:

    Canonical type Stored unit Source meaning
    Sleep Duration s Total sleep duration
    Sleep In-Bed Duration s Total time in bed
    Deep Sleep Duration s Deep-stage duration
    Light Sleep Duration s Light-stage duration
    REM Sleep Duration s Rapid-eye-movement-stage duration
    Awake Sleep Duration s Awake duration within the session
    Unmeasurable Sleep Duration s Provider-marked unmeasurable duration
    Unknown Sleep Duration s Unknown-stage duration
    Sleep Score score One-decimal provider-normalized score
    Average Sleep Heart Rate bpm Average sleep heart rate
    Minimum Sleep Heart Rate bpm Minimum sleep heart rate
    Sleep Resting Heart Rate bpm Sleep-session resting heart rate
    Average Sleep HRV ms Average sleep HRV
    Overnight HRV ms Provider overnight HRV aggregate
    Sleep HRV Sample Count count Rounded contributing-sample count
    Maximum Sleep Blood Oxygen Saturation % Maximum sleep SpO₂; displayed as Maximum Sleep SpO₂
    Average Sleep Respiration Rate br/min Average sleep respiration

    Sleep respiration, SpO₂, and HRV sample series use the generic Respiration Rate, Blood Oxygen Saturation, and Heart Rate Variability classes. Sleep-qualified classes are reserved for aggregates so a sample is not confused with a whole-session statistic. Canonical Health snake-case identifiers and the documented sleep_* identifiers are loader aliases; sleep vital aggregates additionally accept their corresponding vitals.* field paths. Serialization always writes the canonical type shown above. Adding the classes alone does not change previously stored activities, so no activity reparse is required.

    FIT imports attach each dive_summary to the session or lap identified by its native reference_mesg and reference_index. Message order is irrelevant, lap summaries are never promoted to their activity, and missing summary fields are not calculated from record streams. The parser applies FIT profile scaling to depth and bottom-time fields before Sports Lib receives and stores those values without further conversion.

    Native dive-summary statistics are:

    • Average Depth (m), Maximum Depth (m), Surface Interval (s), Bottom Time (s), and Dive Number
    • Dive Descent Time (s), Dive Ascent Time (s), and Dive Hang Time (s)
    • Average Dive Ascent Rate, Average Dive Descent Rate, Maximum Dive Ascent Rate, and Maximum Dive Descent Rate (m/s)
    • Starting CNS Load, Ending CNS Load, Starting N2 Load, and Ending N2 Load (%)
    • Oxygen Toxicity (OTUs), Average Pressure SAC (bar/min), Average Volume SAC (L/min), and Average RMV (L/min)

    Native record streams are Depth and Next Stop Depth (m), Next Stop Time, Time to Surface, No-Decompression Limit, and Air Time Remaining (s), CNS Load and N2 Load (%), Pressure SAC (bar/min), Volume SAC and RMV (L/min), PO2 (%, displayed as PO₂), and Dive Ascent Rate (m/s). These streams retain only samples present in the source file: Sports Lib does not fill, smooth, clamp, or derive them. In particular, Air Time Remaining preserves every non-invalid unsigned FIT value exactly as decoded. Multi-gas and tank messages are exposed as ordered ActivityInterface.getDiveSourceRecords() records: gases retain message-index flags, mixture contents, status, and mode; tank summaries retain their timestamps, sensor IDs, pressures, and volume used; and tank updates retain their timestamps, sensor IDs, and pressures. They are not flattened into scalar statistics, linked to one another, or derived into consumption values. They round-trip as structured ActivityJSONInterface.diveSourceRecords data rather than numeric metrics.

    Presentation preserves the FIT profile precision: depth values and dive rates use three decimal places, pressure/volume SAC and RMV use two, and PO₂ uses two rather than the generic one-decimal percentage format. The first swim-pace preference selects a single coherent dive unit family: /100m keeps depth and rates in m and m/s, while /100yd converts depth and rates to ft and ft/s. Canonical stored values and serialized JSON remain in the FIT profile units above.

    The presentation-only exported variants are Average Depth in feet, Next Stop Depth in feet, Dive ascent rate in feet per second, Average dive ascent rate in feet per second, Maximum dive ascent rate in feet per second, Average dive descent rate in feet per second, and Maximum dive descent rate in feet per second.

    The following formulas describe how missing streams/stats are computed in:

    • src/events/utilities/activity.utilities.ts
    • src/events/utilities/grade-calculator/grade-calculator.ts
    • src/events/utilities/tss/tss-calculator.ts
    • src/events/utilities/helpers.ts
    1. Distance, GNSS distance, speed, pace, swim pace
    Distance[t] = Distance[t-1] + geodesic(Position[t-1], Position[t])
    Speed[t] = (Distance[t] - Distance[t-1]) / deltaTimeSeconds
    Pace (sec/km) = 1000 / Speed(m/s)
    Swim Pace (sec/100m) = 100 / Speed(m/s)
    
    • Distance/GNSS distance are generated from latitude/longitude when missing.
    • Generated GPS distances use geolib 4's haversine calculation with a 6,378,137 metre Earth radius and round each position interval to 0.1 metres by default. The distance adapter returns unrounded intervals when accuracy is zero; its optional precise mode continues to use geolib's ellipsoidal calculation. Haversine can differ slightly from the previous spherical cosine calculation near rounding boundaries and for very close points. The former formula could produce a positive rounded distance for identical coordinates; haversine returns zero. Generated speed, pace, grade-adjusted metrics and moving time can consequently change, with movement thresholds unchanged. Recorded distances remain authoritative. Existing saved values are not rewritten; reparse retained sources and regenerate affected derived summaries only when applying the new calculation to historical GPS-derived distances. Metric tokens, units and JSON schemas are unchanged.
    • Missing Distance readings remain null at their original elapsed timestamps. A recorded zero or repeated distance stays a real observation. Unit conversion preserves the same mask. Generic sensor filling does not fill Distance.
    • Where GPS-derived speed is eligible, speed is generated between successive finite, nonnegative distance observations within the same active timer segment: deltaDistance / deltaTimeSeconds. The rate is stored at the ending observation. There is no speed before the second observation, across a counter reset, or across an explicit timer pause. A zero distance delta gives a valid zero speed. No arbitrary sample-gap cutoff or stationary seconds are invented.
    • GPS distance begins at the first valid position, including time zero when a position exists there. No leading distance zero is inserted before the first position. Existing recorded distance and speed streams remain authoritative.
    • Unit stream variants are derived via helper conversion factors (km/h, mph, ft/s, m/min, knots, min/mi, min/100yd, miles).
    • The FIT parser applies the profile's 1000 depth scale before import; Sports Lib stores record depth and next-stop depth directly in meters without another conversion. Canonical depth streams and maximum depth stats remain meters. The first swimPaceUnits preference selects display variants: Swim Pace keeps meters, while Swim Pace in minutes per 100 yard selects feet.
    • Missing minimum, maximum, and average pace-family stats are hydrated from canonical speed stats for events, activities, and laps. Pace and swim pace invert the speed extrema (maximum speed -> minimum pace); grade-adjusted pace follows the same rule while retaining the existing raw-speed bounds. Explicit pace stats are never replaced. Native JSON applies this hydration after canonical and legacy stat keys have been resolved, so older speed-only summaries gain the same in-memory behavior without requiring a stored-data migration.
    1. Altitude smoothing, grade, grade smoothing, grade-adjusted speed/pace
    AltitudeSmooth = medianFilter(11) -> lowPassFilter
    Grade(%) = clamp((deltaAltitude / deltaDistance) * 100, -50, +50)
                 with lookAheadDistance = 10 m, rounded to 0.1
    GradeSmooth = KalmanFilter(R=0.01, Q=0.5) over Grade
    
    GradeAdjustedSpeed = Speed * (kA + kB*g + kC*g^2 + kD*g^3 + kE*g^4 + kF*g^5)
      where:
        kA=1
        kB=0.029290920646623777
        kC=0.0018083953212790634
        kD=4.0662425671715924e-7
        kE=-3.686186584867523e-7
        kF=-2.6628107325930747e-9
    
    GradeAdjustedPace = 1000 / GradeAdjustedSpeed
    

    Activity grade uses observations where both distance and altitude are available. Its look-ahead and smoothing reset at distance-counter resets and timer pauses. A look-ahead with zero distance change and terminal points cannot establish a slope. Genuine repeated distance readings retain the existing 10-metre look-ahead: they can occur while recorded speed is positive and must not automatically be classified as stationary. Calculated grade stays sparse. Adjusted speed and pace-based TSS use terrain only inside its supported interval. A recorded speed point may use the enclosing terrain interval; a calculated speed interval must fit wholly inside it. This also handles one-second speed with two-second altitude readings without inventing flat terrain between them. This lookup does not fill the stored streams. Missing terrain support leaves positive adjusted speed unavailable; a known stationary zero remains zero. The separate point-indexed route-grade algorithm is unchanged.

    Strava compatibility is measured separately for raw grade, smoothed grade and the GAP adjustment factor. The existing GAP polynomial approximates a published Strava curve; it is not an exact implementation of Strava's service. See reference coverage and remaining discrepancies before interpreting a passing regression suite as numerical equivalence.

    Generated Speed, Grade/Grade Smooth and interval-derived Grade Adjusted Speed retain optional intervalSupport evidence. Their averages use sum(value × supportedSeconds) / sum(supportedSeconds), including stationary zeros. Lap averages include only supported intervals wholly inside that lap, without guessing a position at a cropped boundary. Recorded streams and legacy JSON without this evidence retain their existing summary policy. Native JSON retains these weights; see persistence and migration.

    Recorded Moving time remains authoritative. Otherwise, complete contiguous source laps can supply it; failing that, observed speed intervals above the existing sport-specific moving threshold supply a supported-time estimate. It is not extrapolated before the first reading, after the last reading or across explicit timer pauses. Zero is valid; no usable interval leaves Moving time unavailable rather than substituting Timer time. Distance endpoints establish an interval-average speed, not the exact location of movement within that interval. For recorded speed, the existing between-sample integration remains an estimate; it cannot resolve missing observations or conflicting source readings. Multisport moving-time totals require a value on every leg, including valid zeros; partial totals remain unavailable.

    These changes can affect generated speed/pace, grade/GAP, moving time, pace-based TSS, durability evidence, and the existing power-work fallback that uses moving time. Imported summaries and imported TSS are retained. HR, power and MET TSS formulas and eligibility are unchanged. Previously filled JSON cannot reveal which distance readings were invented: reparse retained original files and refresh affected derived summaries after consumer adoption. The existing strict running-pace policy (enableHeuristicFallbacks: false) still requires terrain for every speed observation; retaining unknown grade can therefore make that candidate unavailable. The optional flat-grade heuristic and complete-window TSS rules are unchanged.

    1. Left/right split and ground-contact balance
    PowerRight = Power * (RightBalance / 100)
    PowerLeft  = Power * (LeftBalance / 100)
    GroundContactTimeBalanceRight = 100 - GroundContactTimeBalanceLeft
    
    1. Generic stat families and ascent/descent gain-loss
    Average = sum(filteredFiniteValues) / count
    Maximum = max(filteredFiniteValues)
    Minimum = min(filteredFiniteValues)
    
    Ascent/Loss uses thresholded step accumulation (default minDiff = 2):
    - Gain: accumulate positive deltas when previous + minDiff <= next
    - Loss: accumulate negative deltas when previous - minDiff >= next
    

    The generic mean above applies to recorded streams. Calculated interval streams use the duration-weighted rule above.

    Activity and lap min/max/average derivation uses one explicit internal policy registry. It currently covers altitude, heart rate, cadence, stroke rate, speed, effort pace, grade-adjusted speed, grade, vertical speed, power, air power, absolute pressure, EVPE/EHPE, satellite SNR/count, temperature, ground contact time and its percentage, running flight time, contact-time-to-flight-time ratio, leg stiffness, vertical oscillation/ratio, stamina, and potential stamina. Registering a metric relationship in DataStore alone does not opt a new family into stream-summary generation.

    • Every target is filled independently. An imported minimum, maximum, or average remains authoritative while missing siblings may still be derived.

    • Only finite samples that pass the family policy contribute. No summary is added when no eligible samples exist.

    • Heart-rate, cadence, and stroke-rate averages are rounded to whole values. Cadence and stroke-rate minimums and averages exclude zero. Ground-contact-time percentages must be greater than zero and at most 100; running flight time and contact-time-to-flight-time ratio accept non-negative values.

    • Altitude and grade prefer their smoothed streams when present. Their summary families remain excluded for Diving activity types.

    • Existing laps use their activity's normalized 1 Hz streams. Lap windows are half-open ([start, end)), assigning an exact recorded-sample boundary to the next lap; a lap ending at the activity endpoint includes that final endpoint. Calculated interval streams instead use wholly contained intervals for both extrema and averages: a rate ending exactly at the lap end belongs to the interval that just finished. Overlapping laps are evaluated independently. A lap beginning before the containing activity keeps source summaries, but does not derive whole-lap averages from that leg's partial streams. Existing terminal clipping remains unchanged. Speed-derived pace can still use its own source speed.

    • Generated lap summaries store canonical stats only. Unit variants are resolved by consumers from the canonical stat and current unit settings; activity unit-stat generation remains unchanged for compatibility.

    • Native JSON restoration remains snapshot-based and does not regenerate these lap summaries from included streams. Newly imported source files, or callers that explicitly run activity stat generation, receive the additional lap summaries. Existing persisted activities therefore require source-file reparsing when their JSON has neither the summaries nor the source streams needed for explicit regeneration.

    • Terrain ascent/descent, altitude min/max/avg, and grade min/max/avg are intentionally excluded for the Diving activity group (Diving, Scuba Diving, Free Diving, Snorkeling, and Mermaiding), whether present in a source summary, restored from native JSON, regenerated into an all-diving event summary, or otherwise derived from streams. Mixed event summaries aggregate these metrics only from non-diving activities. Their vertical movement is represented by depth, not terrain elevation.

    • Suunto DeviceLog JSON applies this same exclusion after merging the workout header, so all-diving event summaries agree before and after a native JSON roundtrip. Raw altitude/depth streams and explicit header summaries for non-diving or mixed events are preserved. There are no metric-key or JSON-schema changes. Existing native JSON already removes these all-diving terrain summaries on restoration; refresh persisted summary projections through the consumer's normal save/reparse workflow if needed.

    • Cadence and stroke-rate minimum/average values exclude zero values.

    • Grade max/min/avg prefers Grade Smooth when present.

    Cadence and stroke-rate semantics are activity-aware:

    • Cadence uses revolutions per minute (rpm) for activities such as running and cycling.
    • Stroke Rate uses strokes or paddle cycles per minute (spm) for Swimming, Open Water Swimming, Rowing, Indoor Rowing, Kayaking, Canoeing, Paddling, and Stand Up Paddling.
    • Source formats may call both concepts cadence. Importers retain those protocol field names, then one centralized activity-type resolver produces the canonical metric family. The canonical activity has one family, not duplicate cadence and stroke-rate streams or summaries.
    • Native JSON hydration applies the same resolver to activity and lap streams/stats. Existing stored Sports Lib JSON therefore does not need source-file reparsing; serializing the hydrated model writes the canonical stroke-rate types. A lap beginning before its containing activity is not reinterpreted using only its containing leg's sport; the same exception applies to terrain exclusions. A homogeneous event summary is normalized as well. Ambiguous historical mixed-event summaries remain unchanged, while newly generated mixed events aggregate cadence and stroke rate separately.
    • Summary-only native event JSON removes Diving-group terrain summaries when its Activity Types stat is present, while other summary semantics remain opt-in. Applications can call normalizeActivityMetricSemanticsForStats(summary, contributingActivityTypes) after hydration. This opt-in boundary canonicalizes unambiguous stroke-rate summaries and removes terrain summaries only for homogeneous Diving-group projections, keeping application persistence concerns outside Sports Lib while reusing its centralized sport-family policy.
    • Pool-swim length JSON retains the avgCadence key for storage compatibility, but its in-memory value is DataStrokeRate and its unit is spm.
    1. Power analytics (NP, power curve, FTP, IF, and capacity models)
    NormalizedPower (NP):
    - Compute every complete rolling 30-second mean on the one-second power grid
    - Raise each mean to the 4th power
    NP = 4th_root(average(mean30s^4))
    
    PowerCurve(duration d): max rolling mean power over window d
    Estimated FTP stat = round(0.95 * best_20min_power)
    IF = NP / independently supplied FTP
    

    FIT, TCX and GPX retain absent, blank, invalid and negative power as null; an explicit 0 W remains a recorded observation. Derived left/right power requires both total power and balance at the same timestamp; missing pairs remain explicit nulls, including trailing gaps and after JSON restoration. Recorded left/right streams retain priority. No interpolation or cadence-based filling is applied. Each observed power sample supports its own one-second interval, clipped to the activity end and located timer/lap boundaries. The endpoint itself has no additional duration. Explicit pauses are excluded; summary-only pause durations do not establish where a pause occurred.

    NP and power-curve points require complete contiguous windows. Gaps and timer boundaries break windows instead of contributing zero, including a stop and resume at the same timestamp. A repeated start while already running does not split an effort. A curve duration with no complete window is omitted, so an unsupported 20-minute effort cannot supply the same-activity FTP estimate. NP retains real coasting zeroes and requires a full 30-second window. Positive device NP keeps priority even with sparse samples. Unavailable calculations are omitted from serialized statistics. The existing curve-only rule for a solitary positive spike bounded by recorded zeroes applies within each active segment; missing neighbors or readings across a timer boundary do not qualify as its two neighbors.

    ActivityUtilities.getPowerCoverage(activity) returns observed support without changing the activity or storing metadata. Coverage, power-window calculations, activity/lap power extrema, derived left/right watts and missing balance summaries read the original samples, independently of any attached Stream.useFilter view. A filter cannot fill gaps, move sample times or change watts or balance for these calculations. Replacing the actual samples with Stream.setData still changes their inputs. Existing filters remain attached and source data stays intact.

    At a fractional lap start, power extrema also include the preceding reading when part of its one-second interval supports active time inside that lap. For example, 300 W followed by 100 W gives a 200 W average over 0.5–1.5 seconds, with a 100 W minimum and 300 W maximum. Missing readings and a timer pause cannot provide that leading support. Exact boundaries keep their half-open ownership, and a terminal lap retains the endpoint for extrema only. Supplied lap summaries keep priority; other sensors retain their existing sample-boundary rules.

    The coverage result contains:

    • durationSeconds: located active interval duration, or the larger explicit activity timer duration when supplied.
    • coveredDurationSeconds and coverageRatio: time supported by observed power, including recorded zeroes.
    • observedAveragePowerWatts: duration-weighted mean over supported intervals, or null without support.
    • observedWorkKilojoules: sum of observed watts multiplied by supported seconds, divided by 1000.

    Calculated Average Power is the observed-period mean, not an estimate of missing seconds. Partial observed work is available from the coverage helper; it is not stored as a complete Power Work total. Calculated Power Work requires complete coverage and consistent active timing; file-supplied work and average power remain authoritative. Supported work retains precision; display rounding does not change the value. Stationary activities can produce work, so positional moving time is not used as a substitute for power support. A summary timer with finer precision than the located intervals can leave a small unsupported remainder; the library does not invent its power.

    For example, 800 observed seconds at 200 W in a 1,200-second activity gives 66.7% coverage, a 200 W observed average and 160 kJ of observed work, with no complete work total. If the remaining 400 seconds explicitly record 0 W, coverage is complete: average power is 133.33 W and total work is 160 kJ.

    const coverage = ActivityUtilities.getPowerCoverage(activity);
    // Only describe observedWorkKilojoules as supported work when coverage is partial.
    // Use the ordinary Power Work stat for a supplied or complete calculated total.

    For multisport workouts, inspect each leg separately. Laps that start before their containing leg retain source summaries; an ending leg cannot supply a whole-lap average. No metric is added to DataStore or Quantified Self's MCP catalog, and there are no new MCP fields, scopes or mutations. Existing numeric metrics keep their names and units.

    FIT record balance requires a finite percentage from 0 through 100 and an explicit boolean side flag. Invalid or incomplete balance becomes missing on both sides; it is never clamped to an endpoint. Valid zero, 100 and fractional percentages retain their meaning. Missing balance leaves derived side watts unavailable for that sample, even when total power is zero. The recorded total-power stream and its coverage, work, NP, power curve and TSS are unaffected. A balance of 101% therefore cannot produce a complementary −1% or negative side watts. This is validation of the decoded percentage in Sports Lib, not a change to FIT bit decoding. Existing invalid saved streams require an original-file reparse and refresh of affected summaries; native JSON restoration does not silently rewrite them.

    FIT session and lap left_right_balance100 summaries are decoded in hundredths of a percent, with the side flag selecting left or right. A valid summary supplies both canonical balance statistics and keeps its precision in JSON; it does not replace per-record balance or derived left/right watts. The existing display rounding is unchanged. Missing or invalid summaries retain the activity stream-based fallback; unsupported lap balance stays unavailable. If a small summary supports both a whole-percent record encoding (including its side bit) and hundredths interpretation, and scoped record bounds exclude only the canonical interpretation, the library treats it as ambiguous and keeps the stream fallback. It never guesses a new scale. Genuine fractional balances and 0%/100% remain supported. This distinction follows Garmin's explanation of summary versus record balance.

    For multiple legs, event Average Power and PowerWattsPerKg are duration-weighted means of their valid nonnegative leg summaries: sum(leg average × leg timer seconds) / sum(leg timer seconds). This summarizes the leg means; it does not rescan samples or extrapolate their missing values. It is not an observed-sample mean across the entire event when leg coverage differs. Legs without power do not contribute zeros. Zero-duration legs contribute no weight; an unknown or invalid duration on a power-bearing leg makes the event average unavailable. Legacy active Duration is used only when no explicit timer statistic exists, never elapsed time or dates. Event maximum power retains genuine zero. Equal-duration legs at 100, 200 and 300 W produce 200 W in any order. W/kg uses each leg’s supplied W/kg, including zero, or its average watts divided by its own positive body mass (rounded to the existing two decimal places). A leg with no available W/kg is omitted from that mean, even if it has watts. Individual leg summaries and streams stay intact.

    The legacy FTP statistic can still contain a same-activity 20-minute estimate. That estimate is not evidence of an athlete threshold and cannot supply IF or power TSS. Only an explicit functionalThresholdPower override or original-file calibration can do so. A restored FTP JSON stat is not promoted to calibration during recalculation. When IF is calculated, the FTP stat reflects the calibration used even if an imported TSS is preserved.

    DataPowerCurve preserves explicit zero wattsPerKg values through JSON restoration; missing W/kg stays absent. Existing saved zeros are readable without reparsing. This keeps source statistics stable when consumers restore activities for Training load validation; the structured curve remains outside the numeric event-metric catalog.

    samplePowerCurveAtDuration samples exact points or interpolates in reciprocal-duration (1/t) space. Interpolation requires neighboring durations within the default 1.25 ratio (configurable up to the hard maximum of 2), keeps the strongest duplicate, and never extrapolates. comparePowerCurveWindows reports recent/reference retention percentage and its percentage-point delta from 100 while normalizing each input curve only once.

    Parsing does not infer CriticalPower or WPrime from one activity. The deprecated ActivityUtilities.calculateCriticalPowerAndWPrime helper remains temporarily available as a low-level Monod-Scherrer calculation for callers who deliberately supply a maximal test curve; its output is not evidence that an arbitrary workout measured current athlete capacity. Existing CriticalPower and WPrime data classes and historical JSON remain readable.

    Durability Evidence is a compact, versioned activity stat. Running, cycling, standard mountain biking, and open-water evidence compares output/heart-rate efficiency across fixed early and late time halves after warm-up/cool-down exclusion. Enduro MTB and Downhill Cycling remain part of the mountain-biking activity family, but their whole-activity context is not comparable through this steady aerobic protocol; they persist explicit unsupported-context evidence instead of a durability result. Pool evidence compares the outer thirds of like-for-like active lengths using the dominant stroke and pool length. Timelines and source streams are never stored in the stat; a deterministic protocol-input fingerprint invalidates stale evidence, including earlier gravity-MTB evidence, and ineligible activities retain an explicit reason and coverage instead of zero values. This policy remains protocol version 1 and does not change the persisted shape.

    Three Dimensional Strain Evidence is a legacy, versioned activity stat retained only so historical native JSON remains readable. FIT, TCX, GPX, and provider parsing no longer generates or regenerates it: one workout cannot establish a current CP/W′/Pmax capacity model. Reprocessing an original source therefore retains its power evidence but produces no new strain stat. Historic v1 and v2 records remain readable and excluded from event summaries.

    For the literature provenance, complete equations, estimator gates, external-algorithm comparison, validation boundary, and known limitations, read the three-dimensional power and training-response model guide.

    buildPowerDurationEnvelope accepts dated activity power curves and samples their maximum envelope at fixed short-duration and CP/W′ anchors. fitThreeDimensionalCapacityModel then applies evidence, fit-quality, and leave-one-anchor-out stability gates. The default contract requires at least three distinct activities spanning 14 days, sufficient 2–20-minute evidence, and sufficient 1–30-second evidence. It returns a complete model only for ready; partial can expose a stable CP while withholding unstable W′ and dependent Pmax, or expose stable CP/W′ while withholding Pmax and the complete model.

    Diagnostics distinguish usable input curves (sourceCount) from the distinct activities that actually supplied the retained sustained and short-duration envelope points (criticalPowerContributingSourceCount and maximumPowerContributingSourceCount). These contributor counts reveal when a component is concentrated in one workout. Whole-source removal diagnostics also report how much CP and W′ change when each sustained-envelope contributor is removed. These values do not impose an additional readiness threshold. Anchor and contributor coverage is reported even when an earlier CP/W′ quality gate stops the fit.

    The estimator also rejects the characteristic 1–3-second arithmetic-decay signature of one isolated power sample and includes a 720-second point in newly generated default power curves. Rejected short points are reported separately from malformed points.

    Inputs must all belong to one exact canonical activity type. Activity groups are not a pooling boundary: Cycling, Indoor Cycling, Running, rowing types, and every other power-bearing type maintain independent histories. Every curve must also predate effectiveDate, so accidentally supplied future evidence returns invalid-input instead of changing an older capacity snapshot.

    The consuming application owns window selection and persistence. A practical policy is to fit each Monday from the previous 42 completed UTC days, use that snapshot for workouts until the next Monday, and retain the input dates, source IDs, source fingerprint, result, and diagnostics. Do not use a later snapshot to rescore an earlier workout as though that capacity had been known at the time.

    import {
    calculateThreeDimensionalStrain,
    fitThreeDimensionalCapacityModel,
    type DatedActivityPowerCurve,
    type ThreeDimensionalPowerSample
    } from '@sports-alliance/sports-lib';

    function scoreWorkout(
    history: readonly DatedActivityPowerCurve[],
    workoutPower: readonly ThreeDimensionalPowerSample[],
    snapshotEffectiveDate: string
    ) {
    const capacity = fitThreeDimensionalCapacityModel(history, {
    effectiveDate: snapshotEffectiveDate
    });
    if (capacity.status !== 'ready' || !capacity.model) {
    return { capacity, strain: null };
    }
    return {
    capacity,
    strain: calculateThreeDimensionalStrain(workoutPower, capacity.model)
    };
    }

    An activity's strain must be calculated with the ready snapshot effective on that activity's date. Aggregate only ready workout results, keep the CP, W′, and Pmax components separate, and never substitute FTP, historic parser CP/W′, another activity type, or a future model when capacity is unavailable.

    Three-dimensional impulse-response utilities:

    • fitThreeParameterCriticalPowerModel fits the Morton three-parameter power-duration model from a mean-max curve, returning CP, W′, Pmax, fit quality, and convergence state. It needs several distinct maximal-duration efforts; a mathematically successful fit is not proof those efforts represent current capacity.
    • calculateThreeDimensionalStrain takes continuous power plus those externally chosen model parameters. It uses W′ balance, maximum power available (MPA), and the CP/W′/Pmax power allocation to return total strain and the three components. It never fills missing power samples: insufficient coverage, missing power, and power above Pmax leave scores unavailable.
    • The default MPA relation is the linear form in Equation 4 of Kontro et al., evaluated from the W′ state before the current sample. To reproduce the modified supporting-workbook Fig 4/5 calculation, use both the exponent-two option and wPrimeBalanceTiming: 'after-sample'; consumers must persist both choices. When observed power exceeds MPA, the strain calculation floors MPA at observed power so the strain coefficient remains at or below one.
    • calculateThreeDimensionalImpulseResponse applies independent exponential fitness-fatigue responses to the three strain series using caller-supplied parameters.

    The three-dimensional power and training-response model guide distinguishes the published response model, the authors' illustrative R fitter, and Sports Lib's chronological validation contract.

    fitThreeDimensionalImpulseResponseParameters calibrates three independent fitness-fatigue responses from pre-aggregated, date-keyed CP, W′, and Pmax strain loads. The three outputs represent distinct energy-system-specific responses; a strong CP fit does not validate W′ or Pmax. The model is a training-response model, not an FTP estimate and not a source of generic fitness, fatigue, gains, or time constants.

    Observations must be independent performance measurements from a stable, documented test protocol. Do not use a power-curve self-fit, a device estimate, or another value derived from the same activities used to produce the strain loads: that would let the model validate against its own input. Omitted dates within the supplied history are rest days and are zero-filled, so do not omit a date to represent unknown or incomplete activity data. The latest observations for each output are held out chronologically, so the fitter evaluates whether the learned response predicts later testing instead of merely describing the history used to fit it.

    The fitter returns ready only for outputs that pass this held-out quality gate. partial, poor-fit, and insufficient-evidence do not supply predictive parameters for their unavailable outputs; invalid-input indicates that the supplied data cannot be interpreted safely. It also withholds a model with no measurable training response, time constants at the configured search boundary, or a nonpositive baseline or predicted daily performance. Defaults are data-sufficiency, numerical-bound, physical-plausibility, and validation safeguards—not population parameters.

    Aggregate the three strain components from eligible activities of one canonical activity type into one ThreeDimensionalDailyStrainLoad per calendar day. Include every date with an activity of that type; rest days may be omitted because they are zero-filled. Record independent CP, W′, and Pmax test results on their actual date using the same type-specific protocol. Do not represent an unparsed or unavailable activity as a rest day. The default policy requires at least 16 observations per output, including 12 fitting observations, four latest held-out observations, and a 56-day fitting span.

    import {
    fitThreeDimensionalImpulseResponseParameters,
    type ThreeDimensionalDailyStrainLoad,
    type ThreeDimensionalPerformanceObservation
    } from '@sports-alliance/sports-lib';

    function calibrateFromRetainedHistory(
    dailyLoads: readonly ThreeDimensionalDailyStrainLoad[],
    observations: readonly ThreeDimensionalPerformanceObservation[]
    ) {
    // dailyLoads contains one summed strain record per activity date.
    // observations contains independently administered CP/W′/Pmax test results.
    const calibration = fitThreeDimensionalImpulseResponseParameters(dailyLoads, observations);
    return {
    calibration,
    criticalPowerParameters:
    calibration.criticalPower.status === 'ready' ? calibration.criticalPower.parameters : null
    };
    }

    Persist calibration data in the consuming application, not as a sports-lib storage contract: retain the raw daily loads, independent observations, test-protocol and version metadata, result, and diagnostics. Retain all history from the first test onward, inspect held-out error after every fit, and recalibrate when new independent test results arrive. Persist a component's parameters as predictive parameters only when its individual status is ready; retain non-ready results and diagnostics for audit. A top-level partial result may still contain valid parameters for one or two components.

    1. Training Stress Score (TSS) methods and priority

    Priority order:

    • Valid nonnegative imported TSS always wins, including zero. Imported scores skip unused calculations. Eligible running pace is evaluated once so it can be selected even when power or HR wins Automatic.
    • Walking, Indoor Walking, Nordic Walking, Speed Walking, Hiking and Trekking: IMPORTED -> POWER -> HR -> calorie-derived MET -> unavailable.
    • Pool and open-water swimming: IMPORTED -> SWIM_PACE with independent CSS -> HR -> MET -> unavailable. Calculated power TSS is ineligible for swimming, even if power and FTP are present.
    • Other eligible sports: IMPORTED -> POWER -> HR -> PACE -> MET -> unavailable.

    Walking and hiking use power when usable power and a valid threshold are available; they do not use running pace TSS. HR uses Banister with complete calibration, or the threshold-only estimate for every sport eligible for calculated TSS. HR, MET, SWIM_PACE (for swimming) and RUNNING_PACE (for eligible running sports) select their available method first, then fall back through the sport's eligible Automatic order. Known calculated scores are recomputed, and removed when no candidate is available; they are never reinterpreted as imports. Unmarked legacy scores retain imported semantics. The legacy preserveImportedTss option is deprecated: remove an imported stat explicitly for a calculation-only comparison.

    Regenerating summaries can update previously calculated walking or hiking TSS to POWER when the retained inputs support it. Valid nonnegative provider TSS remains unchanged for every legacy flag setting. No metric token, unit or JSON schema changes; consumers without retained calculation inputs must reparse the source to recalculate.

    DataTrainingStressScore.getDisplayValue(1) opts into one-decimal load-editor display. Calling it without arguments retains the existing integer display; canonical values, JSON keys and numeric metric discovery are unchanged.

    Motorized and Adaptive Mobility activities, and the Video Gaming, Paramotoring, and RC Drone Flying types, do not receive library-calculated TSS, even when calculation inputs or explicit overrides are available. A valid nonnegative source-provided TSS remains available and is labeled IMPORTED, including when preserveImportedTss is false. A legacy score without a method retains the existing imported-score interpretation. Previously calculated TSS and its method are removed during summary generation for these activities. Other Unspecified and Aerial Sports activities remain eligible for calculated TSS. These excluded groups and three types have no durability adapter. Existing canonical Training Stress Score and Training Stress Score Method tokens, numeric units, JSON representation and numeric metric discovery remain unchanged.

    Walking, Indoor Walking, and Nordic Walking share WalkingGroup while preserving the existing walking pace/speed, average pace/speed, vertical-speed, and default movement threshold. Only Indoor Walking has the indoor hint. Walking has no grade-adjusted running derivation or durability adapter. Obstacle Racing and Ultra Running use Running's existing grade-adjusted metrics, TSS selection, and durability protocol, with its usual eligibility checks. Enduro MTB continues to emit unsupported-context gravity-MTB durability evidence and keeps its existing TSS eligibility. Rally inherits the Motorized calculated-TSS exclusion and imported-score policy above. These classifications add no metric token, unit, formula, or durability protocol; see Import activities for source and adoption requirements.

    BMX inherits Cycling's existing calculations and power/heart-rate durability eligibility checks. Indoor Skiing and Pool Triathlon retain Indoor Sports' and Performance's existing TSS selection, respectively; neither has a durability adapter. Pool Triathlon is not treated as a standalone swimming type. ATV and Motocross inherit Motorized's calculated-TSS exclusion, stale-score removal, and finite imported-score preservation. These classifications add no numeric metric token, unit, formula, or durability protocol.

    E-Enduro MTB retains Enduro MTB's unsupported-context gravity-MTB durability policy and ordinary TSS eligibility. Track Cycling and Recumbent Cycling retain Cycling's power/heart-rate durability eligibility checks; their names do not imply indoor activities. Speed Walking retains Walking's pace/speed and vertical-speed behavior. Whitewater Kayaking retains Kayaking's stroke-rate semantics, and Whitewater Rafting retains Rafting's cadence semantics. Wingsuit Flying, Brick Training, and Hunting with Dogs retain the existing Aerial Sports, Performance, and Outdoor Adventures metric families, respectively. These six types have no durability adapter. Explicit Indoor Track names reuse Indoor Running and its existing running durability policy. No metric token, unit, formula, or durability protocol changes.

    FIT Spin reuses Indoor Cycling's indoor hint and cycling calculations. E-bike Mountain reuses E-Mountain Biking's cycling calculations. Both use the existing cycling durability protocol. Adventure Race and Fly Paraglide reuse Adventure Racing and Paragliding with their existing Performance and Aerial Sports calculations. Broad Hockey, Winter Sport, Team Sport, and Water Sport use their respective groups without inferring a specific sport, indoor venue, or stroke-rate semantics. Water Sport retains Water Sports' speed/swim-pace display families. Paramotoring remains in Aerial Sports and RC Drone Flying in Unspecified, with the type-specific TSS exclusion above; neither has a durability adapter. No metric token, unit, numeric formula, persisted field, or durability protocol changes.

    POWER TSS:

    IF = NP / FTP
    TSS = 100 * (durationWithoutPauses / 3600) * IF^2
    

    Power uses the full eligible duration, without subtracting the NP window warm-up. One hour with NP equal to FTP is 100 TSS. FIT FTP comes from explicit session threshold_power, uniquely matched session time_in_zone FTP, or unambiguous zones_target FTP. Conflicting same-session values, duplicate session references and invalid scoped values are rejected. Valid scoped FTP takes precedence over unrelated global settings, including conflicting sport defaults. Global FTP must be valid and unambiguous when no scoped FTP exists. File FTP calibration stays private on the parsed instance, survives clearing/regenerating its statistics, and is not serialized into ordinary Activity JSON. Missing calibration reports missing-power-inputs and falls through to eligible HR, pace or MET candidates; no threshold is inferred from the ride or its intensity factor.

    Calculated NP can supply power TSS only when observed power covers at least 80% of the larger located active or eligible TSS duration. The full eligible duration remains the multiplier. Partial computed-power TSS is marked estimated: true; 80% is an eligibility safeguard, not a guarantee of accuracy when hard efforts are missing. Below that coverage, the candidate reports calculation-unavailable and uses the existing eligible fallback. No complete NP window reports missing-power-inputs. Independent FTP is still required in both cases.

    Complete recorded zero-power coverage can establish NP 0 and POWER TSS 0. A zero summary alone or a short zero-power fragment cannot establish zero whole-workout load. Positive device-supplied NP is not subject to the computed-NP gate; valid imported TSS, including zero, remains authoritative. FIT complementary same-timestamp records retain their field-merging rules before mapping; missing power fields do not erase another record's explicit power value.

    Explicit TSS reevaluation refreshes calculated NP and intensity factor from current streams and timers on the parsed instance. It preserves supplied or explicitly replaced summaries. The cached getter is unchanged. Existing NP/IF calculation provenance and original-file FTP calibration remain private and are not serialized. Native JSON hydration preserves saved summaries; it does not identify their original source or automatically regenerate them. Use an original-file reparse to refresh historical power summaries and evaluations.

    When a FIT session has a missing or zero timer summary, unambiguous recorded timer intervals can supply its active duration instead of treating all elapsed time as active. Explicit all-paused timing retains zero active duration. Valid independent timer summaries retain priority; conflicting or insufficient event evidence is not guessed. The same recovery applies to sessionless FIT files: synthesized elapsed time is not treated as a recorded timer summary. Only complete, contiguous lap timer coverage can supply a synthesized timer before recorded-event recovery.

    HR TSS:

    Continuous, threshold-normalized Banister TRIMP requires explicit 0 < resting HR < threshold HR < maximum HR. One hour at threshold is 100. Full valid calibration continues to use Banister, including a valid zero score.

    Every sport eligible for calculated TSS can instead use the sports-lib threshold-HR estimate when resting or maximum HR is missing and an explicit, unambiguous threshold remains valid. This includes pool/open-water swimming, strength training, rowing, skiing, walking/hiking, and generic or unknown activity types. There is no additional sport allowlist for HR. The existing calculated-load exclusions remain: Motorized and Adaptive Mobility groups, Video Gaming, Paramotoring and RC Drone Flying. Their valid imported TSS is still preserved.

    The estimate occupies the HR position in each sport's Automatic order and supplies the preferred HR candidate. Swimming tries independent CSS pace before HR; other sports try eligible power before HR, then eligible running pace and MET. Imported TSS always wins. Sport-specific FIT maximum-HR selection is unchanged. Missing threshold, conflicting selected settings, rejected complete calibration and absent observed HR coverage cannot be rescued by this fallback.

    TrainingPeaks describes hrTSS as applicable to all workout types and explicitly supports it for swimming. This supports broad eligibility, not a claim that sports-lib reproduces its complete calculation or selection policy: TrainingPeaks normally prefers available pace-based scores over hrTSS. Sports-lib prefers independent CSS pace for swimming and retains HR before running pace. Only retained file calibration or explicit caller overrides supply our threshold; no account defaults are invented or borrowed from another activity.

    The threshold estimate integrates each observed active interval using the following rates. Exactly 100% of threshold earns 100 TSS/hour; all other exact boundaries retain the lower band. For a threshold of 165 bpm, one observed hour at a constant 164, 165 or 166 bpm earns 80, 100 or 100 TSS respectively. These three cycling test cases match observed TrainingPeaks hrTSS results; they do not establish equivalence across all bands, settings or workout types.

    HR as a fraction of threshold (r) TSS per observed hour
    0 < r ≤ 0.27 20
    0.27 < r ≤ 0.54 30
    0.54 < r ≤ 0.82 40
    0.82 < r ≤ 0.855 50
    0.855 < r ≤ 0.89 60
    0.89 < r ≤ 0.94 70
    0.94 < r < 1.00 80
    1.00 ≤ r ≤ 1.03 100
    1.03 < r ≤ 1.06 120
    r > 1.06 140

    This banded estimate is not normalized Banister and retains a positive low-intensity floor. One observed hour at 100 bpm with threshold 165 produces 40 TSS across eligible sports. Controlled Walking and Hiking FIT uploads both produced 40 hrTSS in TrainingPeaks, which classified both as Walk; these observations do not establish separate Nordic Walking or Trekking algorithms or physiological accuracy for recovery workouts. The formulas are not interchangeable physiological measurements. No observed peak, assumed threshold ratio, inferred zone boundary, or default resting HR supplies calibration. The public evaluation adds optional hrAlgorithm: 'BANISTER' | 'THRESHOLD'; threshold results set estimated: true and include threshold-hr-fallback. Existing HR method/preferences and evaluation version 1 remain compatible. Older saved evaluations can omit the algorithm: consumers must not infer one from the score. Imported and non-HR results have no HR algorithm. This metadata and raw calibration remain absent from ordinary Activity JSON.

    For this fallback only, numeric zero in an otherwise selected FIT resting/maximum setting means unused/missing. Threshold zero remains invalid, and negative, nonnumeric, nonfinite or conflicting selected settings remain rejected. Session matching and sport-specific maximum selection are unchanged. This exception never enables Banister from a previously rejected tuple. Existing physiological override interfaces remain supported; consumers may continue to supply no athlete settings. An explicitly supplied invalid HR override rejects both HR candidates rather than silently borrowing its file value; a complete valid override can still replace rejected file calibration. Source formats without a mapped explicit threshold remain ineligible.

    Previously saved evaluations require original-file reparse and the consuming application's normal derived-load refresh to gain the fallback. Native JSON cannot recover discarded file calibration. Imported TSS remains authoritative. Consumers retain their saved modeled-load controls and method policy when refreshing candidates; no statistic names, units or serialized fields change.

    HR integration uses a timer-active clock: explicit start/stop events remove paused time, including gaps spanning a pause. HR readings inside a pause are excluded; a reading exactly at a stop may close the preceding active interval. FIT stop, stop_all, stop_disable and stop_disable_all are supported. Forty active minutes at threshold plus a twenty-minute pause produce 66.7 Banister TSS, whether recording continues during the pause or resumes afterward. Both HR algorithms use the same observed timer-active intervals. If every HR reading is inside a pause, HR is unavailable and the normal fallback order applies. Imported scores remain authoritative. HR also requires a positive-duration interval between usable observations. The first observation starts coverage; it does not supply HR for the preceding portion of the workout. Explicit invalid/zero HR readings break integration, and compatibility display backfill cannot extend the observed bounds. A single isolated reading is therefore unavailable and allows the normal fallback, while fully observed resting-HR intervals can legitimately score zero. Ordinary interior smart-recording gaps retain their existing treatment; no arbitrary sample-gap cutoff is introduced.

    Suunto JSON and SML imports retain explicit boolean Pause.State pause/resume events, including events alongside other entries in the same sample. Events use the activity's relative clock, and an explicitly paused state can span a sport change. These positions control sample eligibility without replacing valid aggregate duration statistics. Valid Suunto duration/pause summaries that prove zero active time also prevent elapsed-time TSS fallback, even without individual pause events. Activity, lap, stop and altitude events are selected by kind regardless of their array position; conflicting activity types within one sample retain an unknown-sport boundary instead of selecting one arbitrarily. Multisport zone durations come only from each activity window. Shared header thresholds remain usable, but whole-workout zone durations are used only for a single activity and are never distributed across legs.

    Without explicit timer events, HR retains elapsed-time integration. Ordinary recording gaps and aggregate timer/moving duration alone do not identify pause positions; they are not converted into guessed pauses or proportional rescaling.

    FIT calibration comes from a uniquely referenced session time_in_zone, then unambiguous zones_target and applicable profile fields. Cycling, MTB, downhill and enduro use the biking-specific profile maximum, falling back to the general setting when absent. Walking uses the general profile maximum, never its running maximum. Ambiguous session references, conflicting selected settings and inconsistent calibration are rejected. Existing explicit physiological overrides remain supported; absent settings cannot be inferred from activity samples or zone boundaries.

    A uniquely matched session supplies the authoritative calibration for its leg. Lower-priority global/profile fields are read only to fill missing values, so unrelated sport defaults cannot invalidate a complete session calibration. Any field needed from a lower-priority source must still be valid and unambiguous, and the completed HR tuple must satisfy the ordering above for Banister. Invalid selected values are never rescued by global defaults, apart from the threshold fallback's explicit treatment of unused zero resting/maximum settings described above.

    For a session using percent-maximum-HR zones, an explicit threshold below the lowest boundary of a valid, strictly increasing zone set bounded by the calibrated maximum is rejected as invalid-hr-calibration. This is a consistency check only: no zone weights, inferred threshold ratios, or replacement physiological values are introduced. Custom zone sets do not imply this relationship. Valid independent candidates can still supply TSS, and imported scores always retain priority.

    For percent-heart-rate-reserve (percent_hrr) zones, a narrower consistency check applies only when one uniquely matched session time_in_zone record explicitly supplies all three valid HR calibration values and exactly six positive, strictly increasing boundaries. Every boundary must exactly equal round(restingHR + fraction * (maximumHR - restingHR)) for fractions 0.5, 0.6, 0.7, 0.8, 0.9, 1.0. If its threshold is strictly below the first boundary, HR is unavailable with invalid-hr-calibration, and Automatic or preferred HR uses the existing sport-eligible fallback order. The MET fallback remains explicitly estimated; without an eligible fallback the result is unavailable, not zero. Imported TSS, including zero, remains authoritative.

    This is a conservative safeguard for questionable file calibration, not a universal physiological threshold minimum or a measurement of the athlete's true threshold. Different modes, customized/incomplete patterns, and calibration assembled from global/profile defaults do not trigger this HRR check. No boundary is rounded into a match, no missing threshold is inferred, and no score is capped or replaced with an assumed physiological value. Complete explicit physiological overrides retain their existing precedence. Recorded samples and calibration fields are not rewritten. Existing persisted scores require an original-file reparse to apply the check, followed by refreshed derived Training summaries. Ordinary JSON restoration cannot recover this private calibration evidence. Canonical metric tokens, units, JSON schemas, evaluation fields and reason codes remain unchanged.

    PACE TSS (running/trail groups):

    • Uses Minetti running-cost grade adjustment, then NP-like complete rolling 30-second/4th-power normalization.
    • Uphill increases equivalent flat speed; moderate downhill lowers it, while steep downhill follows the model's increasing braking cost within the existing grade limits.
    • Recorded zero speed remains valid. Invalid readings, recording gaps and explicit timer boundaries reset the window; paused readings and incomplete windows contribute no normalized-speed window. Without a complete window, pace is unavailable and the existing eligible fallback order applies. An all-zero complete window can produce valid zero TSS.
    • The full eligible active duration supplies the duration factor; it is not the timestamp of the last positive-speed reading. Explicit timer events identify pauses; aggregate duration does not invent the location of a recording gap.
    Cost(g) = 155.4*g^5 - 30.4*g^4 - 43.3*g^3 + 46.3*g^2 + 19.5*g + 3.6
    AdjustedSpeed = Speed * (Cost(g) / 3.6)
    IF = NormalizedAdjustedSpeed / ThresholdSpeed
    TSS = 100 * (durationWithoutPauses/3600) * IF^2
    

    The cost ratio follows the equal-energy relation Cost(g) * Speed = Cost(0) * AdjustedSpeed from the Minetti running-cost model. Forty active minutes at threshold pace with a twenty-minute explicit pause produce 66.7 TSS.

    Consumers with dated athlete settings can call ActivityUtilities.evaluateTrainingStressScoreWithCalibration(activity, calibration) after initializing getTrainingStressScoreEvaluations(activity) while parsed inputs are available. The public TrainingStressScoreCalibration accepts optional independent FTP (functionalThresholdPower, watts), threshold HR (lactateThresholdHR, bpm), CSS (thresholdSwimSpeed, metres/second) and body mass (bodyMassKg, kilograms). All supplied numeric values must be positive and finite. Imported TSS, including zero, always wins. Valid original-file calibration precedes these fallback inputs; a recorded activity FTP estimate is still not independent calibration. Without an explicit HR formula choice, user threshold HR uses the existing threshold-band estimate without combining it with file resting/maximum HR. Body mass only fills missing file weight for calorie-derived MET. No resting calories, weight or threshold is invented.

    Optional restingHeartRate and maxHeartRate (bpm) support the explicit hrAlgorithm: 'BANISTER' | 'THRESHOLD' choice. Omitting the choice preserves existing file-first behavior and consumer threshold-only estimates, even when consumer rest/max fields are supplied. Banister uses a complete valid applicable file tuple, otherwise a complete consumer tuple with 0 < restingHeartRate < lactateThresholdHR < maxHeartRate. It never completes a file tuple with consumer values. isValidTrainingStressScoreHrCalibration(calibration) checks this complete finite tuple for consumer editors. Threshold mode prefers an independently valid file threshold, then the consumer threshold; it never invents rest/max. The choice controls the HR candidate, not Automatic method order or imported-score precedence. If the requested formula cannot run, another usable HR formula precedes the sport's ordinary method fallbacks, with requested-hr-algorithm-unavailable and the actual hrAlgorithm in the result. Existing formulas, coefficients, recorded sample coverage and timer pauses remain unchanged. The models need not agree, especially at low intensity; Banister is not a universal accuracy upgrade. Retain the dated choice or its absence when saving workout inputs.

    The API returns modeled evaluations without changing recorded statistics, streams, parse options or the cached file-only evaluations. Existing power coverage, pauses, gaps, sport eligibility and calculator limits still apply. Power coverage is reused within each evaluation for eligibility and the estimate flag; it is not a persistent cache. It does not manage setting dates or persistence: consumers must select and retain the settings applicable to each workout. Existing saved results need no migration or recalculation. The compatible evaluateTrainingStressScoreWithSwimThreshold API retains its supplied-CSS precedence for existing consumers.

    For eligible running sports, consumer calibration also accepts thresholdRunningSpeed in metres/second. This is an independently measured threshold, never the workout's average or best pace. Existing file/parse threshold inputs retain priority. The legacy calculator input functionalThresholdPace also means speed in metres/second. runningPace is an additive optional evaluation with preference RUNNING_PACE and actual method PACE when usable. It is calculated once even when power or HR wins Automatic; Automatic keeps its existing power → HR → pace → MET order. An unavailable preferred pace candidate falls back through that order and retains its reason. Imported TSS, including zero, always wins. supportsRunningPaceTrainingStressScore(type) exposes the unchanged Running/Trail Running group and Track and Field eligibility; walking, hiking and swimming do not acquire running-pace calculations. The existing grade, timer, gap, rolling-window and range checks are unchanged. No input streams, recorded stats, ordinary file-only cache or JSON fields are modified by consumer evaluation. Older saved evaluations without runningPace remain readable. Consumers need original-file parsing to prepare missing candidates, and must retain the historically applied threshold or its absence; adding a setting does not authorize recalculating old workouts.

    SWIM_PACE TSS:

    Swimming requires an independent threshold from thresholdSwimSpeed, the compatible refSwimSpeed override, or the existing swim-pace/speed zone threshold. The activity's observed average speed is never its own threshold, including when enableHeuristicFallbacks is true. Without a threshold, swim pace is skipped and the evaluation reports missing-swim-threshold; eligible HR/MET candidates can still provide a score. A supplied threshold with missing speed or duration instead reports missing-pace-inputs. Imported scores, including zero, always retain priority.

    Automatic and the explicit SWIM_PACE preference select available swim pace ahead of HR and MET; imported scores still win. ActivityUtilities.evaluateTrainingStressScoreWithSwimThreshold(activity, speed) can apply a consumer's dated, independent CSS in metres/second after the ordinary evaluations have been initialized. It returns modeled evaluations without changing activity JSON, recorded statistics, parse options or cached file-only evaluations. See consumer CSS for usage and compatibility.

    Pool and open-water swimming also support the threshold-HR fallback described above. When CSS or its calculation is unavailable, Automatic falls back to calibrated HR, then MET. Explicit HR and MET retain their available candidates. HR uses the same observed timer-active intervals for swimming as for other sports. A pool rest is not treated as a timer pause unless recorded timing evidence marks it as one; this change does not infer pauses from laps or remove valid rest records.

    Suunto header speed zones are shared only within a file containing one resolved sport type. Mixed-sport legs retain applicable local boundaries and durations without copying unscoped header boundaries; a running threshold cannot serve as a swim threshold. This scope also survives native JSON restoration. Existing affected Suunto imports require an original-file reparse; no change to the pace formulas or generic fallback order is involved.

    IF = SwimSpeed / ThresholdSwimSpeed
    TSS = 100 * (duration/3600) * IF^3
    

    This correction does not change the existing duration or speed resolvers. Pool timer time can include rests, and length records can be inconsistent; consumers supplying a threshold must ensure speed and duration represent the intended swimming interval. The shared duration resolver and calorie-derived MET formula remain unchanged.

    FIT pool-length generation preserves a valid recorded HR stream instead of replacing it with lap/length averages. When valid recorded HR exists, explicit zero/invalid readings are retained as integration boundaries alongside it; load cannot bridge those dropouts. Recorded gaps remain gaps through stream/statistic regeneration on the parsed activity instance; this private source evidence is not serialized into Activity JSON. Length/lap HR is used only when valid recorded HR is wholly absent. A single length-bearing lap can supply generated streams, while its existing recorded streams retain priority. Pool summary end times that are missing or do not follow their start can be repaired from valid positive file durations before assigning lengths, retaining same-session recorded samples within the next session and duration bounds. Unambiguous start-time windows and compatible explicit length indexes keep boundary lengths in their session/lap, including final rests; conflicting ownership is not guessed. Generated distance is allocated to active lengths only, and idle lengths add no distance or speed. An incomplete/ambiguous length assignment cannot establish a complete generated distance total. If lap timing leaves positive recorded lap distance without an assigned active length, use the recorded distance stream when available instead of a partial generated total. When earlier active laps omit distance and the final active lap carries the complete pool-length total, that final value must not be added to the preceding lengths again. Recovery requires complete, uniquely owned active lengths: prefer a monotonic recorded counter covering the full swim and agreeing with that geometry; otherwise generate from the geometry only when the session total independently agrees. Partial, reset, late, or invalid counters cannot establish complete recorded coverage. Consistent per-lap distance handling remains unchanged. Reparse affected originals and regenerate derived summaries to replace previously inflated distance streams. FIT pool_length is stored in meters regardless of its display-unit flag. A bounded compatibility correction remains for Suunto statute exports only when independent recorded length/lap evidence consistently supports the yards conversion and does not support the native meter value. Recorded total distance remains authoritative.

    Length-based FIT imports retain session-owned recorded Power for both single- and multi-lap activities. Only finite, nonnegative observations are retained, including recorded zeros; missing/invalid readings remain gaps instead of being padded at other sensors' timestamps. Those gaps survive Activity JSON and regeneration. Power samples cannot extend length-derived distance or other filled swim streams into rests or missing length intervals. Recorded power can supply existing power summaries and calculations; NP still requires complete recorded windows and respects timer stops. These recorded power statistics remain available, but calculated power TSS is ineligible for swimming. Valid imported TSS and device-supplied summaries keep their existing precedence. Reparse original files to recover previously omitted power, then regenerate consuming summaries as appropriate. Existing metric tokens, units, public APIs and JSON structure remain compatible; an old saved JSON cannot recover omitted observations on its own.

    The swim Automatic priority change applies on calculation/recalculation. To refresh historical calculated swim TSS, reparse original files with the original independent threshold inputs and rebuild consuming load summaries. Existing saved results are not rewritten on read. Imported TSS is preserved; missing CSS is never filled from today's settings.

    FIT multisport imports retain a stopped initial timer state from before a leg when its session timer duration unambiguously supports that state. This prevents paused HR/power from counting as active load across a sport change. Conflicting/missing duration evidence does not invent a pause; a full-duration session can retain an implicit restart when a device omits the corresponding start event.

    Adjacent FIT sessions do not share the next leg's first recorded sample. A terminal record remains eligible for a standalone or final session. This prevents heart rate and reset distance counters from leaking into the preceding leg. Session time_in_zone durations match the session's FIT message index rather than its position in an array; ambiguous references are rejected instead of assigning another leg's zone totals. Complete, unique session-to-lap references likewise preserve lap ownership when session summaries appear out of order. When explicit lap indexes are absent, unambiguous timing can retain ownership; conflicting explicit references do not fall back to the parser's order-dependent cascade.

    MET TSS:

    METScore = (3600 * Energy) / (Weight * Duration)
    IF = METScore / ThresholdMET
    TSS = 100 * (duration/3600) * IF^2
    

    The default MET reference is 10. File calories, body mass and duration must be positive and finite; no default mass, resting-calorie adjustment or sport MET table is supplied. This is explicitly an estimate: 210 kcal / (70 kg × 1 hour) is MET 3 and 9 TSS.

    ActivityUtilities.getTrainingStressScoreEvaluations(activity) returns the cached parse-time Automatic/HR/MET/Swim pace results with actual method, score (null when unavailable), provenance, estimate flag and stable fallback reason codes. Missing or unusable required inputs retain their method-specific missing-input reasons. When an eligible calculation receives its inputs but cannot return a valid result (including the existing calculated-score range guard), it reports calculation-unavailable instead. This distinction changes diagnostics only: formulas, score limits, valid zero, imported priority and fallback order remain unchanged. Reevaluation needs the parsed inputs; refresh saved evaluation metadata through the consumer’s source-file lifecycle when those inputs are no longer available. evaluateTrainingStressScore(activity) explicitly recomputes all candidates from the current inputs. Capture the cached results before replacing the parsed activity object; the compact evaluations and raw calibration are intentionally absent from ordinary Activity JSON and DataStore. Historical persisted calculated scores need an original-file reparse to gain corrected eligibility and evaluation metadata; ordinary JSON restoration does not silently rewrite them. Reparse original files to apply corrected running grade, zero-speed, window and pause handling, preserve recorded pool HR, and recover unambiguous multisport initial timer states. Original-file reparse also applies FIT boundary ownership, session zone matching, timer-summary fallback, Suunto pause events and recorded positive-power coverage. It also applies Suunto event-kind selection, proven zero active duration and correctly scoped multisport zone durations. Apply an original-file reparse for corrected HR observation coverage, FIT pool units, reordered lap ownership and sessionless timer recovery. Explicit evaluation or activity regeneration refreshes calculated NP on an already parsed instance; it cannot recover missing file calibration from restored JSON. Original-file reparse also applies scoped calibration precedence, complementary FIT record merging, pool HR dropout boundaries, and whole-lap TCX track bounds. TCX elapsed time spans all tracks from the explicit lap start (or earliest valid point when unavailable). A stated start overlapping the previous lap is rejected when all of this lap’s points follow that previous lap, avoiding double counting from inconsistent timer-clock start attributes. In either case, TotalTimeSeconds remains the active duration and the minimum elapsed duration. A gap between tracks does not contribute moving time. These bounds retain delayed first samples and do not depend on track ordering. Reparse also applies explicit HR-pause exclusion, independent-FTP eligibility, rolling NP, full-duration power TSS, cycling maximum-HR selection, HR calibration consistency and independent swimming-threshold requirements to historical workouts, then refresh consuming applications' derived Training summaries. No canonical metric token, unit, or Activity JSON schema changes are required. Consumers displaying reason codes should handle the additive missing-swim-threshold code.

    1. SWOLF, moving time fallback, power work, battery, jumps
    SWOLF(poolLength) = round((secondsPerMeter + strokesPerMeter) * poolLength, 1)
    where:
      secondsPerMeter = (secondsPer100m / 100)
      strokesPerMeter = ((strokesPerMinute * (secondsPer100m / 60)) / 100)
    
    ObservedPowerWork(kJ) = sum(observedWatts * supportedActiveSeconds) / 1000
    BatteryConsumption = max(BatteryCharge) - min(BatteryCharge)
    BatteryLifeEstimation = ((activityDurationSeconds * 100) / BatteryConsumption)
    

    SWOLF uses Average Stroke Rate; the naming change does not alter the calculation.

    • Moving time fallback order: complete contiguous lap moving times -> supported speed intervals -> unavailable. Explicit stationary zero remains valid; Timer time is not substituted for missing movement evidence.
    • Calculated Power Work requires complete power coverage and consistent active timing. Partial work remains in the coverage helper; unknown watts are never zero or an extrapolated average. File-supplied work values stay authoritative.
    • Jump families (height, distance, speed, rotations, score, hang time) compute min/max/avg from jump events when available.
    1. Event-level aggregation behavior
    • Single-activity event: copies activity stats directly to event stats.
    • Multi-activity event:
      • Sums duration, pause, distance, ascent, descent, energy.
      • Aggregates zone durations by summation.
      • Averages many average-like stats using iterative pairwise averaging.
      • Keeps cadence and stroke-rate min/avg/max families separate.
      • Copies a positive Recovery Time from the chronologically final activity. Recovery is a post-activity estimate, so it is not summed, averaged, maximized, or promoted from an earlier activity when the final activity omits it.
      • Aggregates power curves by duration-wise maxima (power and W/kg) without inferring event-level CP/W′.
    Exhaustive canonical metric catalog (canonical Data*.type strings)

    Generated from modules re-exported by src/data/index.ts, then resolved to each module's concrete static type declarations.

    • Steps (leading space intentionally preserved; legacy alias)
    • Absolute Pressure (unit: hpa)
    • Accumulated Power (unit: watts)
    • Active Lap
    • Active Lengths
    • Activity Types
    • Aerobic Training Effect
    • Age (unit: years)
    • Air Power (unit: watt)
    • Alti Baro Profile
    • Altitude (unit: m)
    • Altitude (Stryd)
    • Altitude GPS (unit: m)
    • Altitude Smooth
    • Anaerobic Training Effect
    • Ascent
    • Ascent Time
    • Auto Lap
    • Auto Lap Distance (unit: m)
    • Auto Lap Duration
    • Auto Pause
    • Battery Charge (unit: %)
    • Battery Consumption (unit: %)
    • Battery Current (unit: mA)
    • Battery Life Est.
    • Battery Voltage (unit: V)
    • Beginning Potential Stamina (unit: %)
    • Bike Pod
    • Cadence (unit: rpm)
    • Contact Time to Flight Time Ratio (unit: %)
    • CriticalPower
    • Cycling Avg Seated Power (unit: watt)
    • Cycling Avg Standing Power (unit: watt)
    • Cycling Max Seated Power (unit: watt)
    • Cycling Max Standing Power (unit: watt)
    • Cycling Seated Time (unit: s)
    • Cycling Standing Time (unit: s)
    • Depth (unit: m)
    • Depth in feet (unit: ft)
    • Descent
    • Descent Time
    • Description
    • Device Location
    • Device Names
    • Distance (unit: m)
    • Distance (Stryd)
    • Durability Evidence
    • FIT Training File References (nonnumeric, explicit metadata reader only)
    • FIT Workout Definitions (nonnumeric, explicit metadata reader only)
    • SuuntoPlus Guide References (nonnumeric, explicit metadata reader only)
    • Duration (unit: s)
    • Elapsed time (unit: s)
    • Effort Pace
    • EHPE
    • Enabled Navigation Systems
    • End Altitude
    • End Position
    • Ending Potential Stamina (unit: %)
    • Energy (unit: KCal)
    • EPOC (unit: ml/kg)
    • Est Sweat Loss (unit: ml)
    • EVPE
    • Feeling
    • Fitness Age (unit: years)
    • Flow
    • Foot Pod
    • Form Power
    • FTP
    • Fused Altitude
    • Fused Location
    • Gender
    • GNSS Distance
    • Grade
    • Grade Adjusted Pace (unit: min/km)
    • Grade Adjusted Speed
    • Grade Smooth
    • Grit
    • Ground Contact Time (unit: ms)
    • Ground Contact Time Balance Left
    • Ground Contact Time Balance Right
    • Ground Contact Time Percentage (unit: %)
    • Ground Time (unit: ms)
    • Heart Rate (unit: bpm)
    • Heart Rate Used
    • Height (unit: m)
    • IBI (unit: ms)
    • Intensity
    • Impact Loading Rate Balance Left
    • Impact Loading Rate Balance Right
    • Jump Count
    • Jump Distance
    • Jump Event
    • Jump Score
    • Latitude (unit: degrees)
    • Left Pedal Smoothness (unit: %)
    • Left Torque Effectiveness (unit: %)
    • Leg Spring Stiffness (unit: "KN/m")
    • Leg Spring Stiffness Balance Left
    • Leg Spring Stiffness Balance Right
    • Leg Stiffness (unit: "KN/m")
    • Longitude (unit: degrees)
    • Metabolic Calories (unit: kcal)
    • Moving time
    • Number of Samples
    • Number of Satellites
    • Pace (unit: min/km)
    • Pause Time
    • Peak EPOC
    • Peak Training Effect
    • Pool Length (unit: m)
    • Position
    • Power (unit: watt)
    • Power Balance Left
    • Power Balance Right
    • Power Down Event
    • Power Intensity Factor
    • Power Left
    • Power Normalized
    • Power Pedal Smoothness Left
    • Power Pedal Smoothness Right
    • Power Pod
    • Power Right
    • Power Torque Effectiveness Left
    • Power Torque Effectiveness Right
    • Power Up Event
    • Power Work (unit: kJ)
    • PowerCurve
    • PowerWattsPerKg
    • Potential Stamina (unit: %)
    • Primary Benefit
    • Rated Perceived Exertion
    • Recovery Time
    • Resting Calories (unit: kcal)
    • Rider Position Change Event
    • Right Pedal Smoothness (unit: %)
    • Right Torque Effectiveness (unit: %)
    • Rotations
    • Running Flight Time (unit: ms)
    • Satellite 5 Best SNR
    • Sea Level Pressure (unit: hpa)
    • Speed (unit: m/s)
    • Speed (Stryd)
    • Sport Profile Name
    • Stamina (unit: %)
    • Stance Time (deprecated historical compatibility token; unit: ms)
    • Stance Time Balance Left (deprecated historical compatibility token)
    • Stance Time Balance Right (deprecated historical compatibility token)
    • Start Event
    • Start Position
    • Starting Altitude
    • Step Length
    • Steps (unit: count)
    • Stop ALL Event
    • Stop Event
    • Stroke Rate (unit: spm)
    • Swim Pace (unit: min/100m)
    • Temperature (unit: °C)
    • Time
    • Timer time
    • Three Dimensional Strain Evidence
    • Total Cycles
    • Total Flow
    • Total Grit
    • Training Load Peak
    • Training Stress Score
    • Training Stress Score Method
    • Vertical Oscillation (unit: mm)
    • Vertical Oscillation Balance Left
    • Vertical Oscillation Balance Right
    • Vertical Ratio (unit: %)
    • Vertical Speed (unit: m/s)
    • VO2 Max (unit: ml/kg/min)
    • Weight (unit: kg)
    • WPrime
    • Active Duration (unit: s)
    • Active Energy (unit: kcal)
    • Average Sleep Heart Rate (unit: bpm)
    • Average Sleep HRV (unit: ms)
    • Average Sleep Respiration Rate (unit: br/min)
    • Awake Sleep Duration (unit: s)
    • Basal Energy (unit: kcal)
    • Blood Oxygen Saturation (unit: %)
    • Body Energy (unit: %)
    • Body Energy Change (unit: %)
    • Body Fat (unit: %)
    • Body Mass Index (unit: kg/m²)
    • Body Water (unit: %)
    • Bone Mass (unit: kg)
    • Deep Sleep Duration (unit: s)
    • Diastolic Blood Pressure (unit: mmHg)
    • Floors Climbed (unit: count)
    • Heart Rate Variability (unit: ms)
    • Light Sleep Duration (unit: s)
    • Maximum Sleep Blood Oxygen Saturation (unit: %)
    • Minimum Sleep Heart Rate (unit: bpm)
    • Moderate Intensity Duration (unit: s)
    • Muscle Mass (unit: kg)
    • Overnight HRV (unit: ms)
    • Pulse Rate (unit: bpm)
    • Recovery Score (unit: score)
    • REM Sleep Duration (unit: s)
    • Respiration Rate (unit: br/min)
    • Resting Heart Rate (unit: bpm)
    • Skin Temperature Deviation (unit: °C)
    • Sleep Duration (unit: s)
    • Sleep HRV Sample Count (unit: count)
    • Sleep In-Bed Duration (unit: s)
    • Sleep Resting Heart Rate (unit: bpm)
    • Sleep Score (unit: score)
    • Stress Duration (unit: s)
    • Stress Level (unit: score)
    • Stress State (unit: category)
    • Systolic Blood Pressure (unit: mmHg)
    • Total Energy (unit: kcal)
    • Unknown Sleep Duration (unit: s)
    • Unmeasurable Sleep Duration (unit: s)
    • Vigorous Intensity Duration (unit: s)
    • Wheelchair Push Distance (unit: m)
    • Wheelchair Pushes (unit: count)
    • Distance Target
    • Heart Rate Zone Five Duration
    • Heart Rate Zone Four Duration
    • Heart Rate Zone One Duration
    • Heart Rate Zone Seven Duration
    • Heart Rate Zone Six Duration
    • Heart Rate Zone Target
    • Heart Rate Zone Three Duration
    • Heart Rate Zone Two Duration
    • Power Zone Five Duration
    • Power Zone Four Duration
    • Power Zone One Duration
    • Power Zone Seven Duration
    • Power Zone Six Duration
    • Power Zone Target
    • Power Zone Three Duration
    • Power Zone Two Duration
    • Speed Zone Five Duration
    • Speed Zone Four Duration
    • Speed Zone One Duration
    • Speed Zone Seven Duration
    • Speed Zone Six Duration
    • Speed Zone Target
    • Speed Zone Three Duration
    • Speed Zone Two Duration
    • Time Target
    • Average Absolute Pressure
    • Average Air Power
    • Average Altitude
    • Average Cadence
    • Average Contact Time to Flight Time Ratio (unit: %)
    • Average Effort Pace
    • Average Effort Pace in minutes per mile
    • Average EHPE
    • Average EVPE
    • Average Flow
    • Average Grade Adjusted Pace
    • Average Grade Adjusted Pace in minutes per mile (unit: min/m)
    • Average Grade Adjusted Speed
    • Average Grade Adjusted Speed in feet per minute
    • Average Grade Adjusted Speed in feet per second
    • Average Grade Adjusted Speed in kilometers per hour
    • Average Grade Adjusted Speed in knots
    • Average Grade Adjusted Speed in meters per minute
    • Average Grade Adjusted Speed in miles per hour
    • Average Grit
    • Average Ground Contact Time (unit: ms)
    • Average Ground Contact Time Percentage (unit: %)
    • Average Heart Rate
    • Average Jump Distance
    • Average Jump Hang Time
    • Average Jump Height (unit: m)
    • Average Jump Rotations
    • Average Jump Score
    • Average Jump Speed
    • Average jump speed in feet per minute
    • Average jump speed in feet per second
    • Average jump speed in kilometers per hour
    • Average jump speed in knots
    • Average jump speed in meters per minute
    • Average jump speed in miles per hour
    • Average Number of Satellites
    • Average Pace
    • Average pace in minutes per mile
    • Average Power
    • Average Potential Stamina (unit: %)
    • Average Respiration Rate (unit: br/min)
    • Average Running Flight Time (unit: ms)
    • Average Satellite 5 Best SNR
    • Average Speed
    • Average Stamina (unit: %)
    • Average speed in feet per minute
    • Average speed in feet per second
    • Average speed in kilometers per hour
    • Average speed in knots
    • Average speed in meters per minute
    • Average speed in miles per hour
    • Average Stride Length
    • Average Stroke Count
    • Average Stroke Distance
    • Average Stroke Rate (unit: spm)
    • Average Swim Pace
    • Average swim pace in minutes per 100 yard
    • Average SWOLF 25m
    • Average SWOLF 50m
    • Average Temperature
    • Average VAM (unit: m/h; FIT avg_vam source values in m/s are converted to this public unit)
    • Average Vertical Oscillation (unit: mm)
    • Average Vertical Speed
    • Average vertical speed in feet per hour
    • Average vertical speed in feet per minute
    • Average vertical speed in feet per second
    • Average vertical speed in kilometers per hour
    • Average vertical speed in meters per hour
    • Average vertical speed in meters per minute
    • Average vertical speed in miles per hour
    • Maximum Absolute Pressure
    • Maximum Air Power
    • Maximum Altitude
    • Maximum Cadence
    • Maximum Contact Time to Flight Time Ratio (unit: %)
    • Maximum Depth (unit: m)
    • Maximum Depth in feet (unit: ft)
    • Maximum Effort Pace
    • Maximum Effort Pace in minutes per mile
    • Maximum EHPE
    • Maximum EVPE
    • Maximum Grade Adjusted Pace
    • Maximum Grade Adjusted Pace in minutes per mile (unit: min/m)
    • Maximum Grade Adjusted Speed
    • Maximum Grade Adjusted Speed in feet per minute
    • Maximum Grade Adjusted Speed in feet per second
    • Maximum Grade Adjusted Speed in kilometers per hour
    • Maximum Grade Adjusted Speed in knots
    • Maximum Grade Adjusted Speed in meters per minute
    • Maximum Grade Adjusted Speed in miles per hour
    • Maximum Ground Contact Time (unit: ms)
    • Maximum Ground Contact Time Percentage (unit: %)
    • Maximum Heart Rate
    • Maximum HR Setting (unit: bpm)
    • Maximum Jump Distance
    • Maximum Jump Hang Time
    • Maximum Jump Height (unit: m)
    • Maximum Jump Rotations
    • Maximum Jump Score
    • Maximum Jump Speed
    • Maximum jump speed in feet per minute
    • Maximum jump speed in feet per second
    • Maximum jump speed in kilometers per hour
    • Maximum jump speed in knots
    • Maximum jump speed in meters per minute
    • Maximum jump speed in miles per hour
    • Maximum Number of Satellites
    • Maximum Pace
    • Maximum pace in minutes per mile
    • Maximum Power
    • Maximum Potential Stamina (unit: %)
    • Maximum Respiration Rate (unit: br/min)
    • Maximum Running Flight Time (unit: ms)
    • Maximum Satellite 5 Best SNR
    • Maximum Speed
    • Maximum Stamina (unit: %)
    • Maximum speed in feet per minute
    • Maximum speed in feet per second
    • Maximum speed in kilometers per hour
    • Maximum speed in knots
    • Maximum speed in meters per minute
    • Maximum speed in miles per hour
    • Maximum Stroke Rate (unit: spm)
    • Maximum Swim Pace
    • Maximum swim pace in minutes per 100 yard
    • Maximum Temperature
    • Maximum Vertical Oscillation (unit: mm)
    • Maximum Vertical Speed
    • Maximum vertical speed in feet per hour
    • Maximum vertical speed in feet per minute
    • Maximum vertical speed in feet per second
    • Maximum vertical speed in kilometers per hour
    • Maximum vertical speed in meters per hour
    • Maximum vertical speed in meters per minute
    • Maximum vertical speed in miles per hour
    • Minimum Absolute Pressure
    • Minimum Air Power
    • Minimum Altitude
    • Minimum Cadence
    • Minimum Contact Time to Flight Time Ratio (unit: %)
    • Minimum Effort Pace
    • Minimum Effort Pace in minutes per mile
    • Minimum EHPE
    • Minimum EVPE
    • Minimum Grade Adjusted Pace
    • Minimum Grade Adjusted pace in minutes per mile (unit: min/m)
    • Minimum Grade Adjusted Speed
    • Minimum Grade Adjusted Speed in feet per minute
    • Minimum Grade Adjusted Speed in feet per second
    • Minimum Grade Adjusted Speed in kilometers per hour
    • Minimum Grade Adjusted Speed in knots
    • Minimum Grade Adjusted Speed in meters per minute
    • Minimum Grade Adjusted Speed in miles per hour
    • Minimum Ground Contact Time (unit: ms)
    • Minimum Ground Contact Time Percentage (unit: %)
    • Minimum Heart Rate
    • Minimum Jump Distance
    • Minimum Jump Hang Time
    • Minimum Jump Height (unit: m)
    • Minimum Jump Rotations
    • Minimum Jump Score
    • Minimum Jump Speed
    • Minimum jump speed in feet per minute
    • Minimum jump speed in feet per second
    • Minimum jump speed in kilometers per hour
    • Minimum jump speed in knots
    • Minimum jump speed in meters per minute
    • Minimum jump speed in miles per hour
    • Minimum Number of Satellites
    • Minimum Pace
    • Minimum pace in minutes per mile
    • Minimum Power
    • Minimum Potential Stamina (unit: %)
    • Minimum Respiration Rate (unit: br/min)
    • Minimum Running Flight Time (unit: ms)
    • Minimum Satellite 5 Best SNR
    • Minimum Speed
    • Minimum Stamina (unit: %)
    • Minimum speed in feet per minute
    • Minimum speed in feet per second
    • Minimum speed in kilometers per hour
    • Minimum speed in knot
    • Minimum speed in meters per minute
    • Minimum speed in miles per hour
    • Minimum Stroke Rate (unit: spm)
    • Minimum Swim Pace
    • Minimum swim pace in minutes per 100 yard
    • Minimum Temperature
    • Minimum Vertical Oscillation (unit: mm)
    • Minimum Vertical Speed
    • Minimum vertical speed in feet per hour
    • Minimum vertical speed in feet per minute
    • Minimum vertical speed in feet per second
    • Minimum vertical speed in kilometers per hour
    • Minimum vertical speed in meters per hour
    • Minimum vertical speed in meters per minute
    • Minimum vertical speed in miles per hour
    • Distance in miles (unit: mi)
    • Effort Pace in minutes per mile
    • GNSS Distance in miles (unit: mi)
    • Grade Adjusted Pace in minutes per mile (unit: min/m)
    • Grade Adjusted Speed in feet per minute (unit: ft/min)
    • Grade Adjusted Speed in feet per second (unit: ft/s)
    • Grade Adjusted Speed in kilometers per hour (unit: km/h)
    • Grade Adjusted Speed in knots (unit: kn)
    • Grade Adjusted Speed in meters per minute (unit: m/min)
    • Grade Adjusted Speed in miles per hour (unit: mph)
    • Pace in minutes per mile (unit: min/m)
    • Speed in feet per minute (unit: ft/min)
    • Speed in feet per second (unit: ft/s)
    • Speed in kilometers per hour (unit: km/h)
    • Speed in knots (unit: kn)
    • Speed in meters per minute (unit: m/min)
    • Speed in miles per hour (unit: mph)
    • Swim Pace in minutes per 100 yard (unit: min/100yrd)
    • Vertical speed in feet per hour (unit: ft/h)
    • Vertical speed in feet per minute (unit: ft/min)
    • Vertical speed in feet per second (unit: ft/s)
    • Vertical speed in kilometers per hour (unit: km/h)
    • Vertical speed in meters per hour (unit: m/h)
    • Vertical speed in meters per minute (unit: m/min)
    • Vertical speed in miles per hour (unit: mph)