Repository navigation
fix(explore): read sleep efficiency from the daily column as a percentage - #2939
Open
matthiasthomas wants to merge 1 commit into
Open
matthiasthomas wants to merge 1 commit into
matthiasthomas wants to merge 1 commit into
Conversation
…tage A sleep_efficiency metricSeries point is WHOOP's 0-100 percentage and the catalogs label the key "%", but the daily-column layer under it returned DailyMetric.efficiency, normally a 0-1 fraction. Days the series does not cover read about "1 %", next to imported days in the 90s on Apple and for every day on Android, whose importer writes no such series. Averages, deltas, the ring gauge and the correlation scan took both scales. dailyColumn now returns a percentage on both platforms. The column is not uniformly a fraction (the Fitbit, Oura-export and Mi Band importers and the demo seeders write a percentage), so values above 1.5 pass through, the same split the existing efficiency heal migrations use. Android's Compare and Explore column maps go through dailyColumn instead of the raw column. Stored data is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
n1c
pushed a commit
to n1c/noop
that referenced
this pull request
Nov 26, 2026
…om the daily column as a percentage ryanbr#2939 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CZyrZuBf2575a3s8MZTqNZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Sleep Efficiency reads about "1 %" in Explore and Compare: on strap-only days on macOS/iOS, and on every day whose efficiency is stored as a fraction on Android.
Cause: a
sleep_efficiencymetricSeries point is WHOOP's 0–100 percentage and the catalogs label the key "%". The daily-column layer underneath returnedDailyMetric.efficiencyas is, which is normally a 0–1 fraction. On Apple the two scales were mixed in one series, so the average, min/max, delta, ring gauge and correlation scan took both. Android's CSV importer writes no such series, so every day came from the column.Fix:
dailyColumnreturns a percentage on both platforms. The column is not uniformly a fraction (the Fitbit, Oura-export and Mi Band importers and the demo seeders write a percentage), so a bare* 100would show 8900 %. Values above 1.5 pass through, the same split the existing efficiency heal migrations use.Scope:
dailyColumn.Type of change
How it was tested
SleepEfficiencyUnitTests(Swift) andSleepEfficiencyUnitTest(Kotlin) cover mixed imported and strap-only days, a percentage-scale row, and 19 values whose expected results are the stdout of the Swift expression compiled standalone.SleepEfficiencyCallSiteAuditTestchecks that Android's two screens do not read the raw column.StrandTests(macOS): 2,270 tests. The only failures are the two timezone tests fix(dates): show day-keyed dates on their own day in every time zone #2723 fixes; they also fail without this change.NOOPiOSbuilds.testFullDebugUnitTest: 6,641 tests, 2 failures, both inRecoveryDriversTest, which also fail locally without this change.Checklist
swift testinPackages/<name>): n/a, no package touchedandroid/: all but the 2RecoveryDriversTestfailures aboveStrandDesigntokens: n/a, no styling changedocs/CONTRIBUTING.mdStrand.xcodeproj/) or any secrets/keystoresRelated issues
None found.
🤖 Generated with Claude Code