mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
feat(insights): make sleep debt a configurable source ladder with a computed explainer
Generalise sleep debt onto the existing per-metric source-priority picker (a new sleepDebt ladder, native-above-computed, default WHOOP > Oura > Polar > computed) instead of assuming one provider. The rhythm read resolves the active source off the ladder and carries it on the DTO; when the active source is our own COMPUTED engine — every user today, since no provider ships a native sleep-debt balance — the Sleep page explains what the figure means and that it differs from a wearable's native number. The computed model itself is unchanged and correct (a short rolling balance of need minus sleep, surplus-credited); only stale comments that still referenced the old 14-night window are corrected.
This commit is contained in:
1 parent
c862b4880f
commit
d570d558fa
15 files changed
+245
-23
No files matched your search
@@ -4084,6 +4084,24 @@ paths:
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
sleepDebt:
|
||||
maxItems: 8
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
metricPriority:
|
||||
type: object
|
||||
properties:
|
||||
@@ -4411,6 +4429,24 @@ paths:
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
sleepDebt:
|
||||
maxItems: 8
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
deviceTypePriority:
|
||||
type: object
|
||||
properties:
|
||||
@@ -9305,6 +9341,8 @@ components:
|
||||
enum:
|
||||
- weekly
|
||||
- biweekly
|
||||
ambientSuggestions:
|
||||
type: boolean
|
||||
measurementReminder:
|
||||
type: object
|
||||
properties:
|
||||
@@ -13636,6 +13674,24 @@ components:
|
||||
minimum: 0
|
||||
maximum: 9007199254740991
|
||||
description: Nights still needed before the debt is asserted (0 when ready).
|
||||
source:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
description: v1.25.0 — the active source the debt is resolved FROM, picked off the user's `sleepDebt` source ladder.
|
||||
`COMPUTED` is HealthLog's own rolling-balance estimate (the only producer today); a provider value would
|
||||
be a device-native debt. Clients explain the figure when it is `COMPUTED`.
|
||||
required:
|
||||
- state
|
||||
- debtMinutes
|
||||
@@ -13643,6 +13699,7 @@ components:
|
||||
- nightsCounted
|
||||
- windowNights
|
||||
- nightsUntilReady
|
||||
- source
|
||||
additionalProperties: false
|
||||
chronotype:
|
||||
type: object
|
||||
@@ -16518,6 +16575,24 @@ components:
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
sleepDebt:
|
||||
maxItems: 8
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
metricPriority:
|
||||
type: object
|
||||
properties:
|
||||
@@ -16845,6 +16920,24 @@ components:
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
sleepDebt:
|
||||
maxItems: 8
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
additionalProperties: false
|
||||
deviceTypePriority:
|
||||
type: object
|
||||
@@ -17218,6 +17311,24 @@ components:
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
sleepDebt:
|
||||
maxItems: 8
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
metricPriority:
|
||||
type: object
|
||||
properties:
|
||||
@@ -17545,6 +17656,24 @@ components:
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
sleepDebt:
|
||||
maxItems: 8
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- MANUAL
|
||||
- WITHINGS
|
||||
- IMPORT
|
||||
- APPLE_HEALTH
|
||||
- COMPUTED
|
||||
- WHOOP
|
||||
- FITBIT
|
||||
- NIGHTSCOUT
|
||||
- POLAR
|
||||
- OURA
|
||||
- TELEGRAM
|
||||
- MCP
|
||||
additionalProperties: false
|
||||
deviceTypePriority:
|
||||
type: object
|
||||
|
||||
Reference in new issue
Block a user