diff --git a/src/lib/oura/__tests__/client.test.ts b/src/lib/oura/__tests__/client.test.ts index 13535d03c..7636ffd05 100644 --- a/src/lib/oura/__tests__/client.test.ts +++ b/src/lib/oura/__tests__/client.test.ts @@ -471,7 +471,7 @@ describe("mapSleep", () => { }); describe("mapDailyActivity", () => { - it("maps steps, active energy, and equivalent walking distance (m)", () => { + it("maps steps and active energy, and never the equivalent walking distance", () => { const a: OuraDailyActivity = { id: "1", day: "2026-06-10", @@ -484,12 +484,12 @@ describe("mapDailyActivity", () => { expect(mapped.find((m) => m.type === "ACTIVE_ENERGY_BURNED")?.value).toBe( 412, ); - const dist = mapped.find((m) => m.type === "WALKING_RUNNING_DISTANCE"); - expect(dist).toMatchObject({ - value: 6543, - unit: "m", - fieldTag: "distance", - }); + // An activity equivalent, not distance travelled: no distance row at all. + expect(mapped.map((m) => m.type).sort()).toEqual([ + "ACTIVE_ENERGY_BURNED", + "ACTIVITY_STEPS", + ]); + expect(mapped.some((m) => m.fieldTag === "distance")).toBe(false); }); }); diff --git a/src/lib/oura/client.ts b/src/lib/oura/client.ts index ed99a0505..c7a40fb83 100644 --- a/src/lib/oura/client.ts +++ b/src/lib/oura/client.ts @@ -449,7 +449,11 @@ export interface OuraDailyActivity { steps?: number | null; active_calories?: number | null; total_calories?: number | null; - /** Equivalent walking distance for the day, metres. */ + /** + * Oura's activity-equivalent distance, metres: what a walk of the day's + * effort would have covered. Not distance travelled; never imported (see + * `mapDailyActivity`). + */ equivalent_walking_distance?: number | null; } @@ -972,8 +976,17 @@ export function mapDailySpo2( ]; } -/** Map one Oura daily-activity record: steps, active energy, and the - * equivalent walking distance (B5 — the OURA distance ladder slot was dead). */ +/** + * Map one Oura daily-activity record: steps and active energy. + * + * `equivalent_walking_distance` is deliberately not mapped. Oura derives it + * from the day's whole activity (the distance a walk of the same effort would + * have covered), so an hour of cycling or yoga adds kilometres nobody walked. + * Stored as `WALKING_RUNNING_DISTANCE` it read as real distance, and on a day + * no other source covered it became the day's distance. The rows earlier + * syncs wrote under `activity::distance` are retired on their own + * (`./retire-distance`). + */ export function mapDailyActivity( a: OuraDailyActivity, tz?: string, @@ -999,20 +1012,6 @@ export function mapDailyActivity( fieldTag: "active_energy", }); } - if ( - typeof a.equivalent_walking_distance === "number" && - a.equivalent_walking_distance >= 0 - ) { - out.push({ - type: "WALKING_RUNNING_DISTANCE", - // Oura reports the equivalent walking distance in metres — the canonical - // WALKING_RUNNING_DISTANCE unit (no conversion). - value: importValue(a.equivalent_walking_distance), - unit: "m", - measuredAt, - fieldTag: "distance", - }); - } return out; } diff --git a/src/lib/oura/sync.ts b/src/lib/oura/sync.ts index 39aee9733..a22b87561 100644 --- a/src/lib/oura/sync.ts +++ b/src/lib/oura/sync.ts @@ -4,7 +4,7 @@ * Pulls daily readiness (→ RECOVERY_SCORE + BODY_TEMPERATURE_DEVIATION), sleep * (real per-segment hypnogram timeline when present, else per-stage totals; * efficiency, HRV, RHR, respiratory rate), daily activity (steps, active - * energy, equivalent walking distance), the daily Sleep Score (→ SLEEP_SCORE), + * energy), the daily Sleep Score (→ SLEEP_SCORE), * daily SpO2 (→ OXYGEN_SATURATION), the dedicated vO2_max collection (→ * VO2_MAX), and the daily cardiovascular-age estimate (→ VASCULAR_AGE) for one * connected user, mapping each into `Measurement` rows tagged `source = OURA`.