mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
feat(measurements): add WHOOP source, native score types, and source-priority ladders
Add the WHOOP integration data layer (migration 0111): seven new MeasurementType values (HRV_RMSSD, DAY_STRAIN, WORKOUT_STRAIN, SLEEP_PERFORMANCE, SLEEP_EFFICIENCY, SLEEP_CONSISTENCY, SLEEP_NEED, ENERGY_EXPENDITURE_KJ), a WHOOP MeasurementSource, the WhoopConnection and WhoopOAuthState models, and the per-user encrypted BYO-key columns on User. Day-strain takes DAY_STRAIN (not the COMPUTED STRAIN_SCORE) and RMSSD takes HRV_RMSSD (not the SDNN HEART_RATE_VARIABILITY) so a native value never shares a bucket with a derived proxy. Carry the new types through the completeness walls (units, value ranges, chart tokens, PR direction, categories, list-meta colours/icons/labels, HealthKit-mapping exclusions) and feed the cross-source picker: recovery ladder (WHOOP native above the COMPUTED proxy), WHOOP inserted into the overlapping vital ladders and the workout ladder, plus skinTemperature and respiratoryRate metric keys.
This commit is contained in:
1 parent
747a62516a
commit
6db3bef413
21 files changed
+649
-31
No files matched your search
@@ -188,22 +188,41 @@ describe("DEFAULT_SOURCE_PRIORITY", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("places APPLE_HEALTH first for cumulative metrics + HRV/sleep/RHR", () => {
|
||||
it("places APPLE_HEALTH first for cumulative metrics", () => {
|
||||
// HealthKit aggregates ScanWatch + iPhone sensors into a single
|
||||
// canonical stream and has higher resolution than Withings' nightly
|
||||
// summary for sleep stages / HRV / RHR.
|
||||
// summary for the cumulative activity metrics.
|
||||
for (const key of [
|
||||
"steps",
|
||||
"activeEnergy",
|
||||
"walkingRunningDistance",
|
||||
"flightsClimbed",
|
||||
"sleep",
|
||||
"hrv",
|
||||
"restingHeartRate",
|
||||
] as const) {
|
||||
expect(DEFAULT_SOURCE_PRIORITY[key][0]).toBe("APPLE_HEALTH");
|
||||
}
|
||||
});
|
||||
|
||||
it("places WHOOP first for the recovery-input ladders (v1.11)", () => {
|
||||
// v1.11.0 — a worn-all-night WHOOP strap has higher-resolution
|
||||
// overnight sampling than the iPhone-relayed HealthKit summary or the
|
||||
// Withings nightly summary for sleep / HRV / RHR / respiratory rate;
|
||||
// it leads those ladders ahead of APPLE_HEALTH.
|
||||
for (const key of [
|
||||
"sleep",
|
||||
"hrv",
|
||||
"restingHeartRate",
|
||||
"respiratoryRate",
|
||||
] as const) {
|
||||
expect(DEFAULT_SOURCE_PRIORITY[key][0]).toBe("WHOOP");
|
||||
}
|
||||
});
|
||||
|
||||
it("ranks WHOOP native recovery above the COMPUTED proxy (v1.11)", () => {
|
||||
// v1.11.0 — native-vs-derived: the device-native Recovery outranks
|
||||
// HealthLog's COMPUTED proxy when both exist, with the proxy as the
|
||||
// fallback for users without a strap.
|
||||
expect(DEFAULT_SOURCE_PRIORITY.recovery).toEqual(["WHOOP", "COMPUTED"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DEFAULT_DEVICE_TYPE_PRIORITY", () => {
|
||||
|
||||
Reference in new issue
Block a user