Skip to content

doc(oura): correct §6.5 SpO2 overshoot stats - measured on collision-lossy data - #1465

Merged
ryanbr merged 1 commit into
ryanbr:mainfrom
pipiche38:doc/oura-spo2-overshoot-correction
Aug 20, 2026
Merged

ryanbr merged 1 commit into
ryanbr:mainfrom
pipiche38:doc/oura-spo2-overshoot-correction

Conversation

@pipiche38

Copy link
Copy Markdown

What this fixes

OURA_PROTOCOL.md §6.5 states the decoded 0x6F SpO2 stream reads ~51% of samples over 100%, and
that no offset/clamp pair reconciles it against Oura Cloud ground truth ("choosing an offset would
fabricate a calibration"). That corpus (9,076 records / 117,816 samples, 2026-07-30→08-02) was measured
before the #1070 fix landed — at the time, spo2Sample's primary key (deviceId, ts) collided on
12 of every 13 samples per record, and the survivor was always the record's first value, not a
random subsample. The stats in §6.5 are a real measurement, but of a non-randomly-selected 7.7% of the
true stream, not the stream itself.

What the correction adds

Two new subsections, §6.5.0.1 and §6.5.0.2, using a real capture from one wearer's own staging DB
(oura-2H3B2405003655) that happens to straddle the #1070 fix:

  • §6.5.0.1 — three nights (2026-08-04/05/06) post-fix, 95–97% of theoretical 1Hz coverage
    (n=93,700). Overshoot rate is 20.4%, not ~51%. Re-fitting the offset-to-Cloud-truth on this clean
    data narrows the mean/median disagreement from a ~2pt gap to 0.45pt, and offset −0.32 + clamp[85,100] reproduces the Cloud reference almost exactly (mean 97.64 vs 97.59 target, median exact
    match). Also notes an unrelated, not-yet-root-caused contamination: ~10% of this device's all-time
    spo2Sample rows carry values in the 0x77 DC-channel's documented magnitude range (up to
    +11.7M), which the unit=="raw" guard is supposed to exclude — none of it falls inside the three clean
    nights, but it's flagged for a follow-up check.
  • §6.5.0.2 — a first same-night paired comparison against the same wearer's WHOOP export
    (physiological_cycles.csv, cycle-start times within ~2 min of the three Oura sessions). The
    §6.5.0.1 offset (fit to the unrelated 922-night Cloud aggregate) scores MAE 0.49 against this
    real paired WHOOP truth — matching a same-night best-fit offset (MAE 0.50) fit directly to these 3
    WHOOP nights. Two corrections from non-overlapping references converge on the same accuracy.

What this does NOT change

The doc's conclusion is still do not ship a correction — n=3 nights, the fit is still to an
aggregate/short paired sample rather than a validated multi-night calibration, and the documented
7.6–52% night-to-night swing in overshoot rate means a flat offset has a real accuracy floor even in the
best case (±0.6–0.75pt per-night residuals on the same-night best fit). This PR only corrects the
evidence the "no correction reconciles it" claim rested on — it does not promote SpO2 to spo2Pct or
touch any code path.

Verification

Doc-only change. No swift test / Gradle impact. The underlying numbers are reproducible from
worklog/BOARD.md's 2026-08-19 evening entries (not part of this PR — private repo) against the same
device's spo2Sample/sleepSession tables and the wearer's own WHOOP CSV export.

…lossy data

The ~51%/no-reconciliation numbers were from the pre-ryanbr#1070 corpus, where 12 of
every 13 samples were dropped non-randomly (survivor always the record's first
value). Re-measured on three clean post-fix nights (95-97% of 1Hz, n=93,700):
20.4% over 100, and offset -0.32 + clamp[85,100] nearly reproduces Cloud truth
(median exact). Also adds a first same-night paired comparison against the same
wearer's WHOOP export, which lands on the same correction independently
(MAE 0.49 vs 0.50) - still not enough to ship (n=3 nights), but the doc's prior
"no correction reconciles it" framing no longer holds as stated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZe4bEwsx5FpRtKCpXD1F3
@ryanbr
ryanbr merged commit 7b70b9c into ryanbr:main Aug 20, 2026
2 checks passed
DX23876 added a commit to DX23876/noop that referenced this pull request Aug 20, 2026
An upstream sync adds every upstream commit to the job's base..head range, and
four of them carry AI co-author trailers (ryanbr#869, ryanbr#1465, ryanbr#1467, ryanbr#1390 — all by
third-party contributors). The job therefore failed on the v10.5.0 merge for
messages that are not this fork's to rewrite: clearing them would change their
shas, drop their signatures and destroy the ancestry the next sync merges
against.

Skip any commit whose author email is not the fork identity, which is the scope
the job's own comment already claimed ("inherited from upstream, where they are
ryanbr's to keep"). A commit authored as DX23876 is audited exactly as before —
verified on the v10.5.0 merge range: 129 upstream commits skipped, the merge
commit audited clean, and the same range still fails when the filter is pointed
at one of the flagged authors.
@pipiche38
pipiche38 deleted the doc/oura-spo2-overshoot-correction branch September 12, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants