test(kit): pin parity walks to today where a route reads the database clock

Some read routes cut their windows in SQL against the database's now(),
which a pinned Date cannot reach; a walk pinned to a fixed date then reads
less of its record every day the calendar moves on. relativeToAnchor writes
every instant and day key of a snapshot relative to the start of the
current UTC day, so a walk can lay its record out from today and still read
the same snapshot on any day.

The series walk uses it with the clock unpinned; the analytics walk pins
the clock to noon of today, keeps its account in UTC and is re-recorded in
that form (its earlier snapshots proved the builder move before this
change).
This commit is contained in:
Marc-André Bombeck committed 2026-10-23 14:09:41 +02:00
1 parent 8feeaed473
commit b2f6c37c37
11 files changed
+455 -419

No files matched your search

@@ -11,8 +11,8 @@
"max": 84.4,
"mean": 83.18,
"median": 83.2,
"avg7": null,
"avg30": 82.42,
"avg7": 82.11,
"avg30": 82.58,
"slope7": {
"slope": -0.042,
"direction": "down",
@@ -23,7 +23,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 83.46,
"avg30LastMonth": 83.78,
"avg30LastYear": null
},
"BLOOD_PRESSURE_SYS": {
@@ -33,8 +33,8 @@
"max": 137,
"mean": 129.92,
"median": 130,
"avg7": null,
"avg30": 130.36,
"avg7": 131.14,
"avg30": 130,
"slope7": {
"slope": -0.393,
"direction": "down",
@@ -55,8 +55,8 @@
"max": 86,
"mean": 81.96,
"median": 82,
"avg7": null,
"avg30": 81.82,
"avg7": 81.43,
"avg30": 81.8,
"slope7": {
"slope": -0.714,
"direction": "down",
@@ -67,7 +67,7 @@
"direction": "down",
"confidence": 0
},
"avg30LastMonth": 82,
"avg30LastMonth": 82.1,
"avg30LastYear": null
},
"PULSE": {
@@ -77,8 +77,8 @@
"max": 69,
"mean": 66.5,
"median": 66.5,
"avg7": null,
"avg30": 66.32,
"avg7": 66.14,
"avg30": 66.5,
"slope7": {
"slope": -0.143,
"direction": "down",
@@ -99,8 +99,8 @@
"max": 25.1,
"mean": 24.56,
"median": 24.6,
"avg7": null,
"avg30": 24.2,
"avg7": 24,
"avg30": 24.28,
"slope7": {
"slope": -0.014,
"direction": "down",
@@ -111,7 +111,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 24.78,
"avg30LastMonth": 24.9,
"avg30LastYear": null
},
"SLEEP_DURATION": {
@@ -143,8 +143,8 @@
"max": 9833,
"mean": 7808.5,
"median": 7781.5,
"avg7": null,
"avg30": 7916.5,
"avg7": 7119,
"avg30": 7808.5,
"slope7": {
"slope": -373,
"direction": "down",
@@ -155,7 +155,7 @@
"direction": "down",
"confidence": 0.06
},
"avg30LastMonth": 7511.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"BLOOD_GLUCOSE": {
@@ -165,7 +165,7 @@
"max": 147,
"mean": 112.95,
"median": 106.5,
"avg7": null,
"avg7": 112.76,
"avg30": 112.95,
"slope7": {
"slope": -0.424,
@@ -215,7 +215,7 @@
"max": 98,
"mean": 96.9,
"median": 97,
"avg7": null,
"avg7": 96.86,
"avg30": 96.9,
"slope7": {
"slope": -0.036,
@@ -237,8 +237,8 @@
"max": 52,
"mean": 48.3,
"median": 48,
"avg7": null,
"avg30": 48.23,
"avg7": 48,
"avg30": 48.3,
"slope7": {
"slope": -1,
"direction": "down",
@@ -249,7 +249,7 @@
"direction": "down",
"confidence": 0.02
},
"avg30LastMonth": 48.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"RESTING_HEART_RATE": {
@@ -259,8 +259,8 @@
"max": 61,
"mean": 59.5,
"median": 59.5,
"avg7": null,
"avg30": 59.41,
"avg7": 59.29,
"avg30": 59.43,
"slope7": {
"slope": -0.238,
"direction": "down",
@@ -271,7 +271,7 @@
"direction": "stable",
"confidence": 0
},
"avg30LastMonth": 59.61,
"avg30LastMonth": 59.7,
"avg30LastYear": null
},
"ACTIVE_ENERGY_BURNED": {
@@ -1300,49 +1300,49 @@
"bmi": null,
"lastSeenByType": {
"WEIGHT": {
"lastSeenAt": "2026-10-15T06:30:00.000Z",
"lastSeenAt": "anchor+0d+06:30:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_SYS": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_DIA": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"PULSE": {
"lastSeenAt": "2026-10-15T07:01:00.000Z",
"lastSeenAt": "anchor+0d+07:01:00",
"daysAgo": 0
},
"BODY_FAT": {
"lastSeenAt": "2026-10-15T06:31:00.000Z",
"lastSeenAt": "anchor+0d+06:31:00",
"daysAgo": 0
},
"SLEEP_DURATION": {
"lastSeenAt": "2026-10-15T04:15:00.000Z",
"lastSeenAt": "anchor+0d+04:15:00",
"daysAgo": 0
},
"ACTIVITY_STEPS": {
"lastSeenAt": "2026-10-15T09:00:00.000Z",
"lastSeenAt": "anchor+0d+09:00:00",
"daysAgo": 0
},
"BLOOD_GLUCOSE": {
"lastSeenAt": "2026-10-15T11:00:00.000Z",
"lastSeenAt": "anchor+0d+11:00:00",
"daysAgo": 0
},
"TOTAL_BODY_WATER": null,
"BONE_MASS": null,
"OXYGEN_SATURATION": {
"lastSeenAt": "2026-10-15T04:40:00.000Z",
"lastSeenAt": "anchor+0d+04:40:00",
"daysAgo": 0
},
"HEART_RATE_VARIABILITY": {
"lastSeenAt": "2026-10-15T04:30:00.000Z",
"lastSeenAt": "anchor+0d+04:30:00",
"daysAgo": 0
},
"RESTING_HEART_RATE": {
"lastSeenAt": "2026-10-15T05:00:00.000Z",
"lastSeenAt": "anchor+0d+05:00:00",
"daysAgo": 0
},
"ACTIVE_ENERGY_BURNED": null,
@@ -11,8 +11,8 @@
"max": 84.4,
"mean": 83.18,
"median": 83.2,
"avg7": null,
"avg30": 82.42,
"avg7": 82.11,
"avg30": 82.58,
"slope7": {
"slope": -0.042,
"direction": "down",
@@ -23,7 +23,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 83.46,
"avg30LastMonth": 83.78,
"avg30LastYear": null
},
"BLOOD_PRESSURE_SYS": {
@@ -33,8 +33,8 @@
"max": 137,
"mean": 129.92,
"median": 130,
"avg7": null,
"avg30": 130.36,
"avg7": 131.14,
"avg30": 130,
"slope7": {
"slope": -0.393,
"direction": "down",
@@ -55,8 +55,8 @@
"max": 86,
"mean": 81.96,
"median": 82,
"avg7": null,
"avg30": 81.82,
"avg7": 81.43,
"avg30": 81.8,
"slope7": {
"slope": -0.714,
"direction": "down",
@@ -67,7 +67,7 @@
"direction": "down",
"confidence": 0
},
"avg30LastMonth": 82,
"avg30LastMonth": 82.1,
"avg30LastYear": null
},
"PULSE": {
@@ -77,8 +77,8 @@
"max": 69,
"mean": 66.5,
"median": 66.5,
"avg7": null,
"avg30": 66.32,
"avg7": 66.14,
"avg30": 66.5,
"slope7": {
"slope": -0.143,
"direction": "down",
@@ -99,8 +99,8 @@
"max": 25.1,
"mean": 24.56,
"median": 24.6,
"avg7": null,
"avg30": 24.2,
"avg7": 24,
"avg30": 24.28,
"slope7": {
"slope": -0.014,
"direction": "down",
@@ -111,7 +111,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 24.78,
"avg30LastMonth": 24.9,
"avg30LastYear": null
},
"SLEEP_DURATION": {
@@ -143,8 +143,8 @@
"max": 9833,
"mean": 7808.5,
"median": 7781.5,
"avg7": null,
"avg30": 7916.5,
"avg7": 7119,
"avg30": 7808.5,
"slope7": {
"slope": -373,
"direction": "down",
@@ -155,7 +155,7 @@
"direction": "down",
"confidence": 0.06
},
"avg30LastMonth": 7511.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"BLOOD_GLUCOSE": {
@@ -165,7 +165,7 @@
"max": 147,
"mean": 112.95,
"median": 106.5,
"avg7": null,
"avg7": 112.76,
"avg30": 112.95,
"slope7": {
"slope": -0.424,
@@ -215,7 +215,7 @@
"max": 98,
"mean": 96.9,
"median": 97,
"avg7": null,
"avg7": 96.86,
"avg30": 96.9,
"slope7": {
"slope": -0.036,
@@ -237,8 +237,8 @@
"max": 52,
"mean": 48.3,
"median": 48,
"avg7": null,
"avg30": 48.23,
"avg7": 48,
"avg30": 48.3,
"slope7": {
"slope": -1,
"direction": "down",
@@ -249,7 +249,7 @@
"direction": "down",
"confidence": 0.02
},
"avg30LastMonth": 48.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"RESTING_HEART_RATE": {
@@ -259,8 +259,8 @@
"max": 61,
"mean": 59.5,
"median": 59.5,
"avg7": null,
"avg30": 59.41,
"avg7": 59.29,
"avg30": 59.43,
"slope7": {
"slope": -0.238,
"direction": "down",
@@ -271,7 +271,7 @@
"direction": "stable",
"confidence": 0
},
"avg30LastMonth": 59.61,
"avg30LastMonth": 59.7,
"avg30LastYear": null
},
"ACTIVE_ENERGY_BURNED": {
@@ -1300,49 +1300,49 @@
"bmi": null,
"lastSeenByType": {
"WEIGHT": {
"lastSeenAt": "2026-10-15T06:30:00.000Z",
"lastSeenAt": "anchor+0d+06:30:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_SYS": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_DIA": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"PULSE": {
"lastSeenAt": "2026-10-15T07:01:00.000Z",
"lastSeenAt": "anchor+0d+07:01:00",
"daysAgo": 0
},
"BODY_FAT": {
"lastSeenAt": "2026-10-15T06:31:00.000Z",
"lastSeenAt": "anchor+0d+06:31:00",
"daysAgo": 0
},
"SLEEP_DURATION": {
"lastSeenAt": "2026-10-15T04:15:00.000Z",
"lastSeenAt": "anchor+0d+04:15:00",
"daysAgo": 0
},
"ACTIVITY_STEPS": {
"lastSeenAt": "2026-10-15T09:00:00.000Z",
"lastSeenAt": "anchor+0d+09:00:00",
"daysAgo": 0
},
"BLOOD_GLUCOSE": {
"lastSeenAt": "2026-10-15T11:00:00.000Z",
"lastSeenAt": "anchor+0d+11:00:00",
"daysAgo": 0
},
"TOTAL_BODY_WATER": null,
"BONE_MASS": null,
"OXYGEN_SATURATION": {
"lastSeenAt": "2026-10-15T04:40:00.000Z",
"lastSeenAt": "anchor+0d+04:40:00",
"daysAgo": 0
},
"HEART_RATE_VARIABILITY": {
"lastSeenAt": "2026-10-15T04:30:00.000Z",
"lastSeenAt": "anchor+0d+04:30:00",
"daysAgo": 0
},
"RESTING_HEART_RATE": {
"lastSeenAt": "2026-10-15T05:00:00.000Z",
"lastSeenAt": "anchor+0d+05:00:00",
"daysAgo": 0
},
"ACTIVE_ENERGY_BURNED": null,
@@ -11,8 +11,8 @@
"max": 84.4,
"mean": 83.18,
"median": 83.2,
"avg7": null,
"avg30": 82.42,
"avg7": 82.11,
"avg30": 82.58,
"slope7": {
"slope": -0.042,
"direction": "down",
@@ -23,7 +23,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 83.46,
"avg30LastMonth": 83.78,
"avg30LastYear": null
},
"BLOOD_PRESSURE_SYS": {
@@ -33,8 +33,8 @@
"max": 137,
"mean": 129.92,
"median": 130,
"avg7": null,
"avg30": 130.36,
"avg7": 131.14,
"avg30": 130,
"slope7": {
"slope": -0.393,
"direction": "down",
@@ -55,8 +55,8 @@
"max": 86,
"mean": 81.96,
"median": 82,
"avg7": null,
"avg30": 81.82,
"avg7": 81.43,
"avg30": 81.8,
"slope7": {
"slope": -0.714,
"direction": "down",
@@ -67,7 +67,7 @@
"direction": "down",
"confidence": 0
},
"avg30LastMonth": 82,
"avg30LastMonth": 82.1,
"avg30LastYear": null
},
"PULSE": {
@@ -77,8 +77,8 @@
"max": 69,
"mean": 66.5,
"median": 66.5,
"avg7": null,
"avg30": 66.32,
"avg7": 66.14,
"avg30": 66.5,
"slope7": {
"slope": -0.143,
"direction": "down",
@@ -99,8 +99,8 @@
"max": 25.1,
"mean": 24.56,
"median": 24.6,
"avg7": null,
"avg30": 24.2,
"avg7": 24,
"avg30": 24.28,
"slope7": {
"slope": -0.014,
"direction": "down",
@@ -111,7 +111,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 24.78,
"avg30LastMonth": 24.9,
"avg30LastYear": null
},
"SLEEP_DURATION": {
@@ -143,8 +143,8 @@
"max": 9833,
"mean": 7808.5,
"median": 7781.5,
"avg7": null,
"avg30": 7916.5,
"avg7": 7119,
"avg30": 7808.5,
"slope7": {
"slope": -373,
"direction": "down",
@@ -155,7 +155,7 @@
"direction": "down",
"confidence": 0.06
},
"avg30LastMonth": 7511.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"BLOOD_GLUCOSE": {
@@ -165,7 +165,7 @@
"max": 147,
"mean": 112.95,
"median": 106.5,
"avg7": null,
"avg7": 112.76,
"avg30": 112.95,
"slope7": {
"slope": -0.424,
@@ -215,7 +215,7 @@
"max": 98,
"mean": 96.9,
"median": 97,
"avg7": null,
"avg7": 96.86,
"avg30": 96.9,
"slope7": {
"slope": -0.036,
@@ -237,8 +237,8 @@
"max": 52,
"mean": 48.3,
"median": 48,
"avg7": null,
"avg30": 48.23,
"avg7": 48,
"avg30": 48.3,
"slope7": {
"slope": -1,
"direction": "down",
@@ -249,7 +249,7 @@
"direction": "down",
"confidence": 0.02
},
"avg30LastMonth": 48.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"RESTING_HEART_RATE": {
@@ -259,8 +259,8 @@
"max": 61,
"mean": 59.5,
"median": 59.5,
"avg7": null,
"avg30": 59.41,
"avg7": 59.29,
"avg30": 59.43,
"slope7": {
"slope": -0.238,
"direction": "down",
@@ -271,7 +271,7 @@
"direction": "stable",
"confidence": 0
},
"avg30LastMonth": 59.61,
"avg30LastMonth": 59.7,
"avg30LastYear": null
},
"ACTIVE_ENERGY_BURNED": {
@@ -1641,13 +1641,9 @@
"reason": "not_significant",
"points": [
{
"x": 4,
"x": 5,
"y": 83.1
},
{
"x": 5,
"y": 83
},
{
"x": 6,
"y": 83
@@ -1658,7 +1654,7 @@
},
{
"x": 1,
"y": 82.9
"y": 83
},
{
"x": 2,
@@ -1666,7 +1662,7 @@
},
{
"x": 3,
"y": 82.8
"y": 82.9
},
{
"x": 4,
@@ -1678,7 +1674,7 @@
},
{
"x": 6,
"y": 82.7
"y": 82.8
},
{
"x": 0,
@@ -1686,7 +1682,7 @@
},
{
"x": 1,
"y": 82.6
"y": 82.7
},
{
"x": 2,
@@ -1698,7 +1694,7 @@
},
{
"x": 4,
"y": 82.5
"y": 82.6
},
{
"x": 5,
@@ -1706,7 +1702,7 @@
},
{
"x": 6,
"y": 82.4
"y": 82.5
},
{
"x": 0,
@@ -1718,7 +1714,7 @@
},
{
"x": 2,
"y": 82.3
"y": 82.4
},
{
"x": 3,
@@ -1726,7 +1722,7 @@
},
{
"x": 4,
"y": 82.2
"y": 82.3
},
{
"x": 5,
@@ -1738,7 +1734,7 @@
},
{
"x": 0,
"y": 82.1
"y": 82.2
},
{
"x": 1,
@@ -1746,10 +1742,14 @@
},
{
"x": 2,
"y": 82.1
},
{
"x": 3,
"y": 82
},
{
"x": 3,
"x": 4,
"y": 82
}
]
@@ -1803,7 +1803,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
},
"pillars": [
@@ -1824,7 +1824,7 @@
"value": 130,
"unit": "mmHg",
"label": "130/82 mmHg",
"asOf": "2026-10-15T00:00:00.000Z",
"asOf": "anchor+0d+00:00:00",
"sources": [
"MANUAL"
]
@@ -1856,7 +1856,7 @@
],
"source": "DAY",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1871,7 +1871,7 @@
"value": 95,
"unit": "mg/dL",
"label": "Fasting median 95 mg/dL",
"asOf": "2026-10-15T06:15:00.000Z",
"asOf": "anchor+0d+06:15:00",
"sources": [
"MANUAL"
]
@@ -1903,7 +1903,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1918,7 +1918,7 @@
"value": 7837,
"unit": "steps/day",
"label": "7,837 steps/day",
"asOf": "2026-10-14T00:00:00.000Z",
"asOf": "anchor-1d+00:00:00",
"sources": [
"APPLE_HEALTH"
]
@@ -1950,7 +1950,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1965,7 +1965,7 @@
"value": 388,
"unit": "minutes/night",
"label": "388 min/night + regularity",
"asOf": "2026-10-15T00:00:00.000Z",
"asOf": "anchor+0d+00:00:00",
"sources": [
"APPLE_HEALTH"
]
@@ -1997,7 +1997,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -2020,7 +2020,7 @@
],
"source": "live",
"windowDays": 180,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -2044,7 +2044,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -2068,7 +2068,7 @@
],
"source": "live",
"windowDays": 365,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -2094,7 +2094,7 @@
],
"source": "live",
"windowDays": 60,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "no_personal_goal"
},
@@ -2105,7 +2105,7 @@
"compositionNotice": null,
"restMode": {
"active": true,
"since": "2026-10-12T12:00:00.000Z",
"since": "anchor-3d+12:00:00",
"episodeCount": 1
}
},
@@ -2121,7 +2121,7 @@
},
"perNight": [
{
"dayKey": "2026-09-25",
"dayKey": "day-20",
"stages": {
"CORE": 200,
"DEEP": 80,
@@ -2130,7 +2130,7 @@
}
},
{
"dayKey": "2026-09-26",
"dayKey": "day-19",
"stages": {
"CORE": 240,
"DEEP": 75,
@@ -2139,7 +2139,7 @@
}
},
{
"dayKey": "2026-09-27",
"dayKey": "day-18",
"stages": {
"CORE": 230,
"DEEP": 70,
@@ -2148,7 +2148,7 @@
}
},
{
"dayKey": "2026-09-28",
"dayKey": "day-17",
"stages": {
"CORE": 220,
"DEEP": 80,
@@ -2157,7 +2157,7 @@
}
},
{
"dayKey": "2026-09-29",
"dayKey": "day-16",
"stages": {
"CORE": 210,
"DEEP": 75,
@@ -2166,7 +2166,7 @@
}
},
{
"dayKey": "2026-09-30",
"dayKey": "day-15",
"stages": {
"CORE": 200,
"DEEP": 70,
@@ -2175,7 +2175,7 @@
}
},
{
"dayKey": "2026-10-01",
"dayKey": "day-14",
"stages": {
"CORE": 240,
"DEEP": 80,
@@ -2184,7 +2184,7 @@
}
},
{
"dayKey": "2026-10-02",
"dayKey": "day-13",
"stages": {
"CORE": 230,
"DEEP": 75,
@@ -2193,7 +2193,7 @@
}
},
{
"dayKey": "2026-10-03",
"dayKey": "day-12",
"stages": {
"CORE": 220,
"DEEP": 70,
@@ -2202,7 +2202,7 @@
}
},
{
"dayKey": "2026-10-04",
"dayKey": "day-11",
"stages": {
"CORE": 210,
"DEEP": 80,
@@ -2211,7 +2211,7 @@
}
},
{
"dayKey": "2026-10-05",
"dayKey": "day-10",
"stages": {
"CORE": 200,
"DEEP": 75,
@@ -2220,7 +2220,7 @@
}
},
{
"dayKey": "2026-10-06",
"dayKey": "day-9",
"stages": {
"CORE": 240,
"DEEP": 70,
@@ -2229,7 +2229,7 @@
}
},
{
"dayKey": "2026-10-07",
"dayKey": "day-8",
"stages": {
"CORE": 230,
"DEEP": 80,
@@ -2238,7 +2238,7 @@
}
},
{
"dayKey": "2026-10-08",
"dayKey": "day-7",
"stages": {
"CORE": 220,
"DEEP": 75,
@@ -2247,7 +2247,7 @@
}
},
{
"dayKey": "2026-10-09",
"dayKey": "day-6",
"stages": {
"CORE": 210,
"DEEP": 70,
@@ -2256,7 +2256,7 @@
}
},
{
"dayKey": "2026-10-10",
"dayKey": "day-5",
"stages": {
"CORE": 200,
"DEEP": 80,
@@ -2265,7 +2265,7 @@
}
},
{
"dayKey": "2026-10-11",
"dayKey": "day-4",
"stages": {
"CORE": 240,
"DEEP": 75,
@@ -2274,7 +2274,7 @@
}
},
{
"dayKey": "2026-10-12",
"dayKey": "day-3",
"stages": {
"CORE": 230,
"DEEP": 70,
@@ -2283,7 +2283,7 @@
}
},
{
"dayKey": "2026-10-13",
"dayKey": "day-2",
"stages": {
"CORE": 220,
"DEEP": 80,
@@ -2294,7 +2294,7 @@
"napCount": 1
},
{
"dayKey": "2026-10-14",
"dayKey": "day-1",
"stages": {
"CORE": 210,
"DEEP": 75,
@@ -2303,7 +2303,7 @@
}
},
{
"dayKey": "2026-10-15",
"dayKey": "day+0",
"stages": {
"CORE": 200,
"DEEP": 70,
@@ -2316,49 +2316,49 @@
"sleepSourceDiscrepancy": null,
"lastSeenByType": {
"WEIGHT": {
"lastSeenAt": "2026-10-15T06:30:00.000Z",
"lastSeenAt": "anchor+0d+06:30:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_SYS": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_DIA": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"PULSE": {
"lastSeenAt": "2026-10-15T07:01:00.000Z",
"lastSeenAt": "anchor+0d+07:01:00",
"daysAgo": 0
},
"BODY_FAT": {
"lastSeenAt": "2026-10-15T06:31:00.000Z",
"lastSeenAt": "anchor+0d+06:31:00",
"daysAgo": 0
},
"SLEEP_DURATION": {
"lastSeenAt": "2026-10-15T04:15:00.000Z",
"lastSeenAt": "anchor+0d+04:15:00",
"daysAgo": 0
},
"ACTIVITY_STEPS": {
"lastSeenAt": "2026-10-15T09:00:00.000Z",
"lastSeenAt": "anchor+0d+09:00:00",
"daysAgo": 0
},
"BLOOD_GLUCOSE": {
"lastSeenAt": "2026-10-15T11:00:00.000Z",
"lastSeenAt": "anchor+0d+11:00:00",
"daysAgo": 0
},
"TOTAL_BODY_WATER": null,
"BONE_MASS": null,
"OXYGEN_SATURATION": {
"lastSeenAt": "2026-10-15T04:40:00.000Z",
"lastSeenAt": "anchor+0d+04:40:00",
"daysAgo": 0
},
"HEART_RATE_VARIABILITY": {
"lastSeenAt": "2026-10-15T04:30:00.000Z",
"lastSeenAt": "anchor+0d+04:30:00",
"daysAgo": 0
},
"RESTING_HEART_RATE": {
"lastSeenAt": "2026-10-15T05:00:00.000Z",
"lastSeenAt": "anchor+0d+05:00:00",
"daysAgo": 0
},
"ACTIVE_ENERGY_BURNED": null,
@@ -2461,7 +2461,7 @@
"degraded": false,
"tz_guard": "near-utc"
},
"dayKey": "2026-10-15",
"dayKey": "day+0",
"scoreVersion": 4,
"pillars": 4,
"cache.analytics.outcome": "miss",
@@ -2482,8 +2482,8 @@
"stored": {
"healthScores": [
{
"dayKey": "2026-10-15",
"timezone": "Europe/Berlin",
"dayKey": "day+0",
"timezone": "UTC",
"composite": 86,
"band": "green",
"scoreVersion": 4,
@@ -2500,7 +2500,7 @@
"BLOOD_PRESSURE": 73
},
"inputFingerprint": "5653cd8c051404182d6c6f813a48b1c2ebc3abe1116901466ab7cc1ab70cb276",
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
],
"patterns": []
@@ -11,8 +11,8 @@
"max": 84.4,
"mean": 83.18,
"median": 83.2,
"avg7": null,
"avg30": 82.42,
"avg7": 82.11,
"avg30": 82.58,
"slope7": {
"slope": -0.042,
"direction": "down",
@@ -23,7 +23,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 83.46,
"avg30LastMonth": 83.78,
"avg30LastYear": null
},
"BLOOD_PRESSURE_SYS": {
@@ -33,8 +33,8 @@
"max": 137,
"mean": 129.92,
"median": 130,
"avg7": null,
"avg30": 130.36,
"avg7": 131.14,
"avg30": 130,
"slope7": {
"slope": -0.393,
"direction": "down",
@@ -55,8 +55,8 @@
"max": 86,
"mean": 81.96,
"median": 82,
"avg7": null,
"avg30": 81.82,
"avg7": 81.43,
"avg30": 81.8,
"slope7": {
"slope": -0.714,
"direction": "down",
@@ -67,7 +67,7 @@
"direction": "down",
"confidence": 0
},
"avg30LastMonth": 82,
"avg30LastMonth": 82.1,
"avg30LastYear": null
},
"PULSE": {
@@ -77,8 +77,8 @@
"max": 69,
"mean": 66.5,
"median": 66.5,
"avg7": null,
"avg30": 66.32,
"avg7": 66.14,
"avg30": 66.5,
"slope7": {
"slope": -0.143,
"direction": "down",
@@ -99,8 +99,8 @@
"max": 25.1,
"mean": 24.56,
"median": 24.6,
"avg7": null,
"avg30": 24.2,
"avg7": 24,
"avg30": 24.28,
"slope7": {
"slope": -0.014,
"direction": "down",
@@ -111,7 +111,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 24.78,
"avg30LastMonth": 24.9,
"avg30LastYear": null
},
"SLEEP_DURATION": {
@@ -143,8 +143,8 @@
"max": 9833,
"mean": 7808.5,
"median": 7781.5,
"avg7": null,
"avg30": 7916.5,
"avg7": 7119,
"avg30": 7808.5,
"slope7": {
"slope": -373,
"direction": "down",
@@ -155,7 +155,7 @@
"direction": "down",
"confidence": 0.06
},
"avg30LastMonth": 7511.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"BLOOD_GLUCOSE": {
@@ -165,7 +165,7 @@
"max": 147,
"mean": 112.95,
"median": 106.5,
"avg7": null,
"avg7": 112.76,
"avg30": 112.95,
"slope7": {
"slope": -0.424,
@@ -215,7 +215,7 @@
"max": 98,
"mean": 96.9,
"median": 97,
"avg7": null,
"avg7": 96.86,
"avg30": 96.9,
"slope7": {
"slope": -0.036,
@@ -237,8 +237,8 @@
"max": 52,
"mean": 48.3,
"median": 48,
"avg7": null,
"avg30": 48.23,
"avg7": 48,
"avg30": 48.3,
"slope7": {
"slope": -1,
"direction": "down",
@@ -249,7 +249,7 @@
"direction": "down",
"confidence": 0.02
},
"avg30LastMonth": 48.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"RESTING_HEART_RATE": {
@@ -259,8 +259,8 @@
"max": 61,
"mean": 59.5,
"median": 59.5,
"avg7": null,
"avg30": 59.41,
"avg7": 59.29,
"avg30": 59.43,
"slope7": {
"slope": -0.238,
"direction": "down",
@@ -271,7 +271,7 @@
"direction": "stable",
"confidence": 0
},
"avg30LastMonth": 59.61,
"avg30LastMonth": 59.7,
"avg30LastYear": null
},
"ACTIVE_ENERGY_BURNED": {
@@ -1641,13 +1641,9 @@
"reason": "not_significant",
"points": [
{
"x": 4,
"x": 5,
"y": 83.1
},
{
"x": 5,
"y": 83
},
{
"x": 6,
"y": 83
@@ -1658,7 +1654,7 @@
},
{
"x": 1,
"y": 82.9
"y": 83
},
{
"x": 2,
@@ -1666,7 +1662,7 @@
},
{
"x": 3,
"y": 82.8
"y": 82.9
},
{
"x": 4,
@@ -1678,7 +1674,7 @@
},
{
"x": 6,
"y": 82.7
"y": 82.8
},
{
"x": 0,
@@ -1686,7 +1682,7 @@
},
{
"x": 1,
"y": 82.6
"y": 82.7
},
{
"x": 2,
@@ -1698,7 +1694,7 @@
},
{
"x": 4,
"y": 82.5
"y": 82.6
},
{
"x": 5,
@@ -1706,7 +1702,7 @@
},
{
"x": 6,
"y": 82.4
"y": 82.5
},
{
"x": 0,
@@ -1718,7 +1714,7 @@
},
{
"x": 2,
"y": 82.3
"y": 82.4
},
{
"x": 3,
@@ -1726,7 +1722,7 @@
},
{
"x": 4,
"y": 82.2
"y": 82.3
},
{
"x": 5,
@@ -1738,7 +1734,7 @@
},
{
"x": 0,
"y": 82.1
"y": 82.2
},
{
"x": 1,
@@ -1746,10 +1742,14 @@
},
{
"x": 2,
"y": 82.1
},
{
"x": 3,
"y": 82
},
{
"x": 3,
"x": 4,
"y": 82
}
]
@@ -1803,7 +1803,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
},
"pillars": [
@@ -1824,7 +1824,7 @@
"value": 130,
"unit": "mmHg",
"label": "130/82 mmHg",
"asOf": "2026-10-15T00:00:00.000Z",
"asOf": "anchor+0d+00:00:00",
"sources": [
"MANUAL"
]
@@ -1856,7 +1856,7 @@
],
"source": "DAY",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1871,7 +1871,7 @@
"value": 95,
"unit": "mg/dL",
"label": "Fasting median 95 mg/dL",
"asOf": "2026-10-15T06:15:00.000Z",
"asOf": "anchor+0d+06:15:00",
"sources": [
"MANUAL"
]
@@ -1903,7 +1903,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1918,7 +1918,7 @@
"value": 7837,
"unit": "steps/day",
"label": "7,837 steps/day",
"asOf": "2026-10-14T00:00:00.000Z",
"asOf": "anchor-1d+00:00:00",
"sources": [
"APPLE_HEALTH"
]
@@ -1950,7 +1950,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1965,7 +1965,7 @@
"value": 388,
"unit": "minutes/night",
"label": "388 min/night + regularity",
"asOf": "2026-10-15T00:00:00.000Z",
"asOf": "anchor+0d+00:00:00",
"sources": [
"APPLE_HEALTH"
]
@@ -1997,7 +1997,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -2020,7 +2020,7 @@
],
"source": "live",
"windowDays": 180,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -2044,7 +2044,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -2068,7 +2068,7 @@
],
"source": "live",
"windowDays": 365,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -2094,7 +2094,7 @@
],
"source": "live",
"windowDays": 60,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "no_personal_goal"
},
@@ -2105,7 +2105,7 @@
"compositionNotice": null,
"restMode": {
"active": true,
"since": "2026-10-12T12:00:00.000Z",
"since": "anchor-3d+12:00:00",
"episodeCount": 1
}
},
@@ -2121,7 +2121,7 @@
},
"perNight": [
{
"dayKey": "2026-09-25",
"dayKey": "day-20",
"stages": {
"CORE": 200,
"DEEP": 80,
@@ -2130,7 +2130,7 @@
}
},
{
"dayKey": "2026-09-26",
"dayKey": "day-19",
"stages": {
"CORE": 240,
"DEEP": 75,
@@ -2139,7 +2139,7 @@
}
},
{
"dayKey": "2026-09-27",
"dayKey": "day-18",
"stages": {
"CORE": 230,
"DEEP": 70,
@@ -2148,7 +2148,7 @@
}
},
{
"dayKey": "2026-09-28",
"dayKey": "day-17",
"stages": {
"CORE": 220,
"DEEP": 80,
@@ -2157,7 +2157,7 @@
}
},
{
"dayKey": "2026-09-29",
"dayKey": "day-16",
"stages": {
"CORE": 210,
"DEEP": 75,
@@ -2166,7 +2166,7 @@
}
},
{
"dayKey": "2026-09-30",
"dayKey": "day-15",
"stages": {
"CORE": 200,
"DEEP": 70,
@@ -2175,7 +2175,7 @@
}
},
{
"dayKey": "2026-10-01",
"dayKey": "day-14",
"stages": {
"CORE": 240,
"DEEP": 80,
@@ -2184,7 +2184,7 @@
}
},
{
"dayKey": "2026-10-02",
"dayKey": "day-13",
"stages": {
"CORE": 230,
"DEEP": 75,
@@ -2193,7 +2193,7 @@
}
},
{
"dayKey": "2026-10-03",
"dayKey": "day-12",
"stages": {
"CORE": 220,
"DEEP": 70,
@@ -2202,7 +2202,7 @@
}
},
{
"dayKey": "2026-10-04",
"dayKey": "day-11",
"stages": {
"CORE": 210,
"DEEP": 80,
@@ -2211,7 +2211,7 @@
}
},
{
"dayKey": "2026-10-05",
"dayKey": "day-10",
"stages": {
"CORE": 200,
"DEEP": 75,
@@ -2220,7 +2220,7 @@
}
},
{
"dayKey": "2026-10-06",
"dayKey": "day-9",
"stages": {
"CORE": 240,
"DEEP": 70,
@@ -2229,7 +2229,7 @@
}
},
{
"dayKey": "2026-10-07",
"dayKey": "day-8",
"stages": {
"CORE": 230,
"DEEP": 80,
@@ -2238,7 +2238,7 @@
}
},
{
"dayKey": "2026-10-08",
"dayKey": "day-7",
"stages": {
"CORE": 220,
"DEEP": 75,
@@ -2247,7 +2247,7 @@
}
},
{
"dayKey": "2026-10-09",
"dayKey": "day-6",
"stages": {
"CORE": 210,
"DEEP": 70,
@@ -2256,7 +2256,7 @@
}
},
{
"dayKey": "2026-10-10",
"dayKey": "day-5",
"stages": {
"CORE": 200,
"DEEP": 80,
@@ -2265,7 +2265,7 @@
}
},
{
"dayKey": "2026-10-11",
"dayKey": "day-4",
"stages": {
"CORE": 240,
"DEEP": 75,
@@ -2274,7 +2274,7 @@
}
},
{
"dayKey": "2026-10-12",
"dayKey": "day-3",
"stages": {
"CORE": 230,
"DEEP": 70,
@@ -2283,7 +2283,7 @@
}
},
{
"dayKey": "2026-10-13",
"dayKey": "day-2",
"stages": {
"CORE": 220,
"DEEP": 80,
@@ -2294,7 +2294,7 @@
"napCount": 1
},
{
"dayKey": "2026-10-14",
"dayKey": "day-1",
"stages": {
"CORE": 210,
"DEEP": 75,
@@ -2303,7 +2303,7 @@
}
},
{
"dayKey": "2026-10-15",
"dayKey": "day+0",
"stages": {
"CORE": 200,
"DEEP": 70,
@@ -2316,49 +2316,49 @@
"sleepSourceDiscrepancy": null,
"lastSeenByType": {
"WEIGHT": {
"lastSeenAt": "2026-10-15T06:30:00.000Z",
"lastSeenAt": "anchor+0d+06:30:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_SYS": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_DIA": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"PULSE": {
"lastSeenAt": "2026-10-15T07:01:00.000Z",
"lastSeenAt": "anchor+0d+07:01:00",
"daysAgo": 0
},
"BODY_FAT": {
"lastSeenAt": "2026-10-15T06:31:00.000Z",
"lastSeenAt": "anchor+0d+06:31:00",
"daysAgo": 0
},
"SLEEP_DURATION": {
"lastSeenAt": "2026-10-15T04:15:00.000Z",
"lastSeenAt": "anchor+0d+04:15:00",
"daysAgo": 0
},
"ACTIVITY_STEPS": {
"lastSeenAt": "2026-10-15T09:00:00.000Z",
"lastSeenAt": "anchor+0d+09:00:00",
"daysAgo": 0
},
"BLOOD_GLUCOSE": {
"lastSeenAt": "2026-10-15T11:00:00.000Z",
"lastSeenAt": "anchor+0d+11:00:00",
"daysAgo": 0
},
"TOTAL_BODY_WATER": null,
"BONE_MASS": null,
"OXYGEN_SATURATION": {
"lastSeenAt": "2026-10-15T04:40:00.000Z",
"lastSeenAt": "anchor+0d+04:40:00",
"daysAgo": 0
},
"HEART_RATE_VARIABILITY": {
"lastSeenAt": "2026-10-15T04:30:00.000Z",
"lastSeenAt": "anchor+0d+04:30:00",
"daysAgo": 0
},
"RESTING_HEART_RATE": {
"lastSeenAt": "2026-10-15T05:00:00.000Z",
"lastSeenAt": "anchor+0d+05:00:00",
"daysAgo": 0
},
"ACTIVE_ENERGY_BURNED": null,
@@ -2456,8 +2456,8 @@
"stored": {
"healthScores": [
{
"dayKey": "2026-10-15",
"timezone": "Europe/Berlin",
"dayKey": "day+0",
"timezone": "UTC",
"composite": 86,
"band": "green",
"scoreVersion": 4,
@@ -2474,7 +2474,7 @@
"BLOOD_PRESSURE": 73
},
"inputFingerprint": "5653cd8c051404182d6c6f813a48b1c2ebc3abe1116901466ab7cc1ab70cb276",
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
],
"patterns": []
@@ -11,8 +11,8 @@
"max": 84.4,
"mean": 83.18,
"median": 83.2,
"avg7": null,
"avg30": 82.42,
"avg7": 82.11,
"avg30": 82.58,
"slope7": {
"slope": -0.042,
"direction": "down",
@@ -23,7 +23,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 83.46,
"avg30LastMonth": 83.78,
"avg30LastYear": null
},
"BLOOD_PRESSURE_SYS": {
@@ -33,8 +33,8 @@
"max": 137,
"mean": 129.92,
"median": 130,
"avg7": null,
"avg30": 130.36,
"avg7": 131.14,
"avg30": 130,
"slope7": {
"slope": -0.393,
"direction": "down",
@@ -55,8 +55,8 @@
"max": 86,
"mean": 81.96,
"median": 82,
"avg7": null,
"avg30": 81.82,
"avg7": 81.43,
"avg30": 81.8,
"slope7": {
"slope": -0.714,
"direction": "down",
@@ -67,7 +67,7 @@
"direction": "down",
"confidence": 0
},
"avg30LastMonth": 82,
"avg30LastMonth": 82.1,
"avg30LastYear": null
},
"PULSE": {
@@ -77,8 +77,8 @@
"max": 69,
"mean": 66.5,
"median": 66.5,
"avg7": null,
"avg30": 66.32,
"avg7": 66.14,
"avg30": 66.5,
"slope7": {
"slope": -0.143,
"direction": "down",
@@ -99,8 +99,8 @@
"max": 25.1,
"mean": 24.56,
"median": 24.6,
"avg7": null,
"avg30": 24.2,
"avg7": 24,
"avg30": 24.28,
"slope7": {
"slope": -0.014,
"direction": "down",
@@ -111,7 +111,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 24.78,
"avg30LastMonth": 24.9,
"avg30LastYear": null
},
"ACTIVITY_STEPS": {
@@ -121,8 +121,8 @@
"max": 9833,
"mean": 7808.5,
"median": 7781.5,
"avg7": null,
"avg30": 7916.5,
"avg7": 7119,
"avg30": 7808.5,
"slope7": {
"slope": -373,
"direction": "down",
@@ -133,7 +133,7 @@
"direction": "down",
"confidence": 0.06
},
"avg30LastMonth": 7511.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"TOTAL_BODY_WATER": {
@@ -171,7 +171,7 @@
"max": 98,
"mean": 96.9,
"median": 97,
"avg7": null,
"avg7": 96.86,
"avg30": 96.9,
"slope7": {
"slope": -0.036,
@@ -193,8 +193,8 @@
"max": 52,
"mean": 48.3,
"median": 48,
"avg7": null,
"avg30": 48.23,
"avg7": 48,
"avg30": 48.3,
"slope7": {
"slope": -1,
"direction": "down",
@@ -205,7 +205,7 @@
"direction": "down",
"confidence": 0.02
},
"avg30LastMonth": 48.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"ACTIVE_ENERGY_BURNED": {
@@ -1150,37 +1150,37 @@
"bmi": null,
"lastSeenByType": {
"WEIGHT": {
"lastSeenAt": "2026-10-15T06:30:00.000Z",
"lastSeenAt": "anchor+0d+06:30:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_SYS": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_DIA": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"PULSE": {
"lastSeenAt": "2026-10-15T07:01:00.000Z",
"lastSeenAt": "anchor+0d+07:01:00",
"daysAgo": 0
},
"BODY_FAT": {
"lastSeenAt": "2026-10-15T06:31:00.000Z",
"lastSeenAt": "anchor+0d+06:31:00",
"daysAgo": 0
},
"ACTIVITY_STEPS": {
"lastSeenAt": "2026-10-15T09:00:00.000Z",
"lastSeenAt": "anchor+0d+09:00:00",
"daysAgo": 0
},
"TOTAL_BODY_WATER": null,
"BONE_MASS": null,
"OXYGEN_SATURATION": {
"lastSeenAt": "2026-10-15T04:40:00.000Z",
"lastSeenAt": "anchor+0d+04:40:00",
"daysAgo": 0
},
"HEART_RATE_VARIABILITY": {
"lastSeenAt": "2026-10-15T04:30:00.000Z",
"lastSeenAt": "anchor+0d+04:30:00",
"daysAgo": 0
},
"ACTIVE_ENERGY_BURNED": null,
@@ -1273,8 +1273,8 @@
"stored": {
"healthScores": [
{
"dayKey": "2026-10-15",
"timezone": "Europe/Berlin",
"dayKey": "day+0",
"timezone": "UTC",
"composite": 86,
"band": "green",
"scoreVersion": 4,
@@ -1291,7 +1291,7 @@
"BLOOD_PRESSURE": 73
},
"inputFingerprint": "5653cd8c051404182d6c6f813a48b1c2ebc3abe1116901466ab7cc1ab70cb276",
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
],
"patterns": []
@@ -11,8 +11,8 @@
"max": 84.4,
"mean": 83.18,
"median": 83.2,
"avg7": null,
"avg30": 82.42,
"avg7": 82.11,
"avg30": 82.58,
"slope7": {
"slope": -0.042,
"direction": "down",
@@ -23,7 +23,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 83.46,
"avg30LastMonth": 83.78,
"avg30LastYear": null
},
"BLOOD_PRESSURE_SYS": {
@@ -33,8 +33,8 @@
"max": 137,
"mean": 129.92,
"median": 130,
"avg7": null,
"avg30": 130.36,
"avg7": 131.14,
"avg30": 130,
"slope7": {
"slope": -0.393,
"direction": "down",
@@ -55,8 +55,8 @@
"max": 86,
"mean": 81.96,
"median": 82,
"avg7": null,
"avg30": 81.82,
"avg7": 81.43,
"avg30": 81.8,
"slope7": {
"slope": -0.714,
"direction": "down",
@@ -67,7 +67,7 @@
"direction": "down",
"confidence": 0
},
"avg30LastMonth": 82,
"avg30LastMonth": 82.1,
"avg30LastYear": null
},
"PULSE": {
@@ -77,8 +77,8 @@
"max": 69,
"mean": 66.5,
"median": 66.5,
"avg7": null,
"avg30": 66.32,
"avg7": 66.14,
"avg30": 66.5,
"slope7": {
"slope": -0.143,
"direction": "down",
@@ -99,8 +99,8 @@
"max": 25.1,
"mean": 24.56,
"median": 24.6,
"avg7": null,
"avg30": 24.2,
"avg7": 24,
"avg30": 24.28,
"slope7": {
"slope": -0.014,
"direction": "down",
@@ -111,7 +111,7 @@
"direction": "down",
"confidence": 0.99
},
"avg30LastMonth": 24.78,
"avg30LastMonth": 24.9,
"avg30LastYear": null
},
"ACTIVITY_STEPS": {
@@ -121,8 +121,8 @@
"max": 9833,
"mean": 7808.5,
"median": 7781.5,
"avg7": null,
"avg30": 7916.5,
"avg7": 7119,
"avg30": 7808.5,
"slope7": {
"slope": -373,
"direction": "down",
@@ -133,7 +133,7 @@
"direction": "down",
"confidence": 0.06
},
"avg30LastMonth": 7511.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"TOTAL_BODY_WATER": {
@@ -171,7 +171,7 @@
"max": 98,
"mean": 96.9,
"median": 97,
"avg7": null,
"avg7": 96.86,
"avg30": 96.9,
"slope7": {
"slope": -0.036,
@@ -193,8 +193,8 @@
"max": 52,
"mean": 48.3,
"median": 48,
"avg7": null,
"avg30": 48.23,
"avg7": 48,
"avg30": 48.3,
"slope7": {
"slope": -1,
"direction": "down",
@@ -205,7 +205,7 @@
"direction": "down",
"confidence": 0.02
},
"avg30LastMonth": 48.5,
"avg30LastMonth": null,
"avg30LastYear": null
},
"ACTIVE_ENERGY_BURNED": {
@@ -1390,13 +1390,9 @@
"reason": "not_significant",
"points": [
{
"x": 4,
"x": 5,
"y": 83.1
},
{
"x": 5,
"y": 83
},
{
"x": 6,
"y": 83
@@ -1407,7 +1403,7 @@
},
{
"x": 1,
"y": 82.9
"y": 83
},
{
"x": 2,
@@ -1415,7 +1411,7 @@
},
{
"x": 3,
"y": 82.8
"y": 82.9
},
{
"x": 4,
@@ -1427,7 +1423,7 @@
},
{
"x": 6,
"y": 82.7
"y": 82.8
},
{
"x": 0,
@@ -1435,7 +1431,7 @@
},
{
"x": 1,
"y": 82.6
"y": 82.7
},
{
"x": 2,
@@ -1447,7 +1443,7 @@
},
{
"x": 4,
"y": 82.5
"y": 82.6
},
{
"x": 5,
@@ -1455,7 +1451,7 @@
},
{
"x": 6,
"y": 82.4
"y": 82.5
},
{
"x": 0,
@@ -1467,7 +1463,7 @@
},
{
"x": 2,
"y": 82.3
"y": 82.4
},
{
"x": 3,
@@ -1475,7 +1471,7 @@
},
{
"x": 4,
"y": 82.2
"y": 82.3
},
{
"x": 5,
@@ -1487,7 +1483,7 @@
},
{
"x": 0,
"y": 82.1
"y": 82.2
},
{
"x": 1,
@@ -1495,10 +1491,14 @@
},
{
"x": 2,
"y": 82.1
},
{
"x": 3,
"y": 82
},
{
"x": 3,
"x": 4,
"y": 82
}
]
@@ -1548,7 +1548,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
},
"pillars": [
@@ -1569,7 +1569,7 @@
"value": 130,
"unit": "mmHg",
"label": "130/82 mmHg",
"asOf": "2026-10-15T00:00:00.000Z",
"asOf": "anchor+0d+00:00:00",
"sources": [
"MANUAL"
]
@@ -1608,7 +1608,7 @@
],
"source": "DAY",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1631,7 +1631,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1647,7 +1647,7 @@
"value": 7837,
"unit": "steps/day",
"label": "7,837 steps/day",
"asOf": "2026-10-14T00:00:00.000Z",
"asOf": "anchor-1d+00:00:00",
"sources": [
"APPLE_HEALTH"
]
@@ -1679,7 +1679,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
}
},
@@ -1702,7 +1702,7 @@
],
"source": "live",
"windowDays": 180,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1726,7 +1726,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1750,7 +1750,7 @@
],
"source": "live",
"windowDays": 365,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1776,7 +1776,7 @@
],
"source": "live",
"windowDays": 60,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "no_personal_goal"
},
@@ -1787,7 +1787,7 @@
"compositionNotice": null,
"restMode": {
"active": true,
"since": "2026-10-12T12:00:00.000Z",
"since": "anchor-3d+12:00:00",
"episodeCount": 1
}
},
@@ -1803,7 +1803,7 @@
},
"perNight": [
{
"dayKey": "2026-09-25",
"dayKey": "day-20",
"stages": {
"CORE": 200,
"DEEP": 80,
@@ -1812,7 +1812,7 @@
}
},
{
"dayKey": "2026-09-26",
"dayKey": "day-19",
"stages": {
"CORE": 240,
"DEEP": 75,
@@ -1821,7 +1821,7 @@
}
},
{
"dayKey": "2026-09-27",
"dayKey": "day-18",
"stages": {
"CORE": 230,
"DEEP": 70,
@@ -1830,7 +1830,7 @@
}
},
{
"dayKey": "2026-09-28",
"dayKey": "day-17",
"stages": {
"CORE": 220,
"DEEP": 80,
@@ -1839,7 +1839,7 @@
}
},
{
"dayKey": "2026-09-29",
"dayKey": "day-16",
"stages": {
"CORE": 210,
"DEEP": 75,
@@ -1848,7 +1848,7 @@
}
},
{
"dayKey": "2026-09-30",
"dayKey": "day-15",
"stages": {
"CORE": 200,
"DEEP": 70,
@@ -1857,7 +1857,7 @@
}
},
{
"dayKey": "2026-10-01",
"dayKey": "day-14",
"stages": {
"CORE": 240,
"DEEP": 80,
@@ -1866,7 +1866,7 @@
}
},
{
"dayKey": "2026-10-02",
"dayKey": "day-13",
"stages": {
"CORE": 230,
"DEEP": 75,
@@ -1875,7 +1875,7 @@
}
},
{
"dayKey": "2026-10-03",
"dayKey": "day-12",
"stages": {
"CORE": 220,
"DEEP": 70,
@@ -1884,7 +1884,7 @@
}
},
{
"dayKey": "2026-10-04",
"dayKey": "day-11",
"stages": {
"CORE": 210,
"DEEP": 80,
@@ -1893,7 +1893,7 @@
}
},
{
"dayKey": "2026-10-05",
"dayKey": "day-10",
"stages": {
"CORE": 200,
"DEEP": 75,
@@ -1902,7 +1902,7 @@
}
},
{
"dayKey": "2026-10-06",
"dayKey": "day-9",
"stages": {
"CORE": 240,
"DEEP": 70,
@@ -1911,7 +1911,7 @@
}
},
{
"dayKey": "2026-10-07",
"dayKey": "day-8",
"stages": {
"CORE": 230,
"DEEP": 80,
@@ -1920,7 +1920,7 @@
}
},
{
"dayKey": "2026-10-08",
"dayKey": "day-7",
"stages": {
"CORE": 220,
"DEEP": 75,
@@ -1929,7 +1929,7 @@
}
},
{
"dayKey": "2026-10-09",
"dayKey": "day-6",
"stages": {
"CORE": 210,
"DEEP": 70,
@@ -1938,7 +1938,7 @@
}
},
{
"dayKey": "2026-10-10",
"dayKey": "day-5",
"stages": {
"CORE": 200,
"DEEP": 80,
@@ -1947,7 +1947,7 @@
}
},
{
"dayKey": "2026-10-11",
"dayKey": "day-4",
"stages": {
"CORE": 240,
"DEEP": 75,
@@ -1956,7 +1956,7 @@
}
},
{
"dayKey": "2026-10-12",
"dayKey": "day-3",
"stages": {
"CORE": 230,
"DEEP": 70,
@@ -1965,7 +1965,7 @@
}
},
{
"dayKey": "2026-10-13",
"dayKey": "day-2",
"stages": {
"CORE": 220,
"DEEP": 80,
@@ -1976,7 +1976,7 @@
"napCount": 1
},
{
"dayKey": "2026-10-14",
"dayKey": "day-1",
"stages": {
"CORE": 210,
"DEEP": 75,
@@ -1985,7 +1985,7 @@
}
},
{
"dayKey": "2026-10-15",
"dayKey": "day+0",
"stages": {
"CORE": 200,
"DEEP": 70,
@@ -1998,37 +1998,37 @@
"sleepSourceDiscrepancy": null,
"lastSeenByType": {
"WEIGHT": {
"lastSeenAt": "2026-10-15T06:30:00.000Z",
"lastSeenAt": "anchor+0d+06:30:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_SYS": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"BLOOD_PRESSURE_DIA": {
"lastSeenAt": "2026-10-15T07:00:00.000Z",
"lastSeenAt": "anchor+0d+07:00:00",
"daysAgo": 0
},
"PULSE": {
"lastSeenAt": "2026-10-15T07:01:00.000Z",
"lastSeenAt": "anchor+0d+07:01:00",
"daysAgo": 0
},
"BODY_FAT": {
"lastSeenAt": "2026-10-15T06:31:00.000Z",
"lastSeenAt": "anchor+0d+06:31:00",
"daysAgo": 0
},
"ACTIVITY_STEPS": {
"lastSeenAt": "2026-10-15T09:00:00.000Z",
"lastSeenAt": "anchor+0d+09:00:00",
"daysAgo": 0
},
"TOTAL_BODY_WATER": null,
"BONE_MASS": null,
"OXYGEN_SATURATION": {
"lastSeenAt": "2026-10-15T04:40:00.000Z",
"lastSeenAt": "anchor+0d+04:40:00",
"daysAgo": 0
},
"HEART_RATE_VARIABILITY": {
"lastSeenAt": "2026-10-15T04:30:00.000Z",
"lastSeenAt": "anchor+0d+04:30:00",
"daysAgo": 0
},
"ACTIVE_ENERGY_BURNED": null,
@@ -2143,8 +2143,8 @@
"stored": {
"healthScores": [
{
"dayKey": "2026-10-15",
"timezone": "Europe/Berlin",
"dayKey": "day+0",
"timezone": "UTC",
"composite": 86,
"band": "green",
"scoreVersion": 4,
@@ -2161,7 +2161,7 @@
"BLOOD_PRESSURE": 73
},
"inputFingerprint": "5653cd8c051404182d6c6f813a48b1c2ebc3abe1116901466ab7cc1ab70cb276",
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
],
"patterns": []
@@ -1278,7 +1278,7 @@
"inputs": [],
"source": "none",
"windowDays": 0,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "no_usable_data"
},
@@ -1302,7 +1302,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "missing_reference_profile"
}
@@ -1326,7 +1326,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1350,7 +1350,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1374,7 +1374,7 @@
],
"source": "live",
"windowDays": 28,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1398,7 +1398,7 @@
],
"source": "live",
"windowDays": 180,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1422,7 +1422,7 @@
],
"source": "live",
"windowDays": 90,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1446,7 +1446,7 @@
],
"source": "live",
"windowDays": 365,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "not_tracked"
}
@@ -1473,7 +1473,7 @@
],
"source": "live",
"windowDays": 60,
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
},
"reason": "no_personal_goal"
},
@@ -25,8 +25,8 @@
"stored": {
"healthScores": [
{
"dayKey": "2026-10-15",
"timezone": "Europe/Berlin",
"dayKey": "day+0",
"timezone": "UTC",
"composite": 86,
"band": "green",
"scoreVersion": 4,
@@ -43,7 +43,7 @@
"BLOOD_PRESSURE": 73
},
"inputFingerprint": "5653cd8c051404182d6c6f813a48b1c2ebc3abe1116901466ab7cc1ab70cb276",
"computedAt": "<now>"
"computedAt": "anchor+0d+12:00:00"
}
],
"patterns": []
@@ -15,7 +15,8 @@
* event, the rollup refreshes the request handed off, and the stored health
* scores and correlation patterns.
*
* The clock is pinned (`Date` only). The record's rollups are built once
* The clock is pinned (`Date` only) to noon of the day the test runs; see
* `NOW`. The record's rollups are built once
* before the walk; the fire-and-forget refresh the route starts on every
* request is recorded instead of run, so the wide event never depends on
* whether it finished first.
@@ -31,7 +32,9 @@ import {
effectRecorder,
eventFacts,
expectParity,
relativeToAnchor,
stable,
startOfUtcToday,
wideEventRecorder,
} from "../../../kit/parity";
import { getPrismaClient, truncateAllTables } from "../../setup";
@@ -62,8 +65,16 @@ vi.mock("@/lib/rollups/measurement-rollups", async (importOriginal) => {
});
const prisma = getPrismaClient();
const NOW = new Date("2026-10-15T12:00:00.000Z");
const TZ = "Europe/Berlin";
/**
* Noon of the current UTC day. The summaries read their 90-day windows in SQL
* against the database clock, which a pinned `Date` cannot move, so the clock
* is pinned to today and the snapshot records positions relative to today's
* start (`relativeToAnchor`). The record is under sixty days old, so no
* reading sits on a SQL window's edge whatever the time of day.
*/
const ANCHOR = startOfUtcToday();
const NOW = new Date(ANCHOR.getTime() + 12 * 60 * 60 * 1000);
const TZ = "UTC";
const OWNER_ID = parityId("analytics", 1);
const EMPTY_ID = parityId("analytics", 2);
@@ -133,14 +144,17 @@ async function step(
await expectParity(
`analytics.${name}`,
stable(
{
status: res.status,
cacheControl: res.headers.get("cache-control"),
body: res.body,
events: events.map(eventFacts).map(withoutRollupCoverage),
effects: effectRecorder.take(),
stored: await stored(options.userId ?? OWNER_ID),
},
relativeToAnchor(
{
status: res.status,
cacheControl: res.headers.get("cache-control"),
body: res.body,
events: events.map(eventFacts).map(withoutRollupCoverage),
effects: effectRecorder.take(),
stored: await stored(options.userId ?? OWNER_ID),
},
ANCHOR,
),
{ since: NOW },
),
);
@@ -27,7 +27,9 @@ import { makeGrant, makeSession, makeUser } from "../../../kit/factories";
import {
eventFacts,
expectParity,
relativeToAnchor,
stable,
startOfUtcToday,
wideEventRecorder,
} from "../../../kit/parity";
import {
@@ -51,7 +53,7 @@ vi.mock("@/lib/logging/transports", async (importOriginal) => {
const prisma = getPrismaClient();
const DAY = 86_400_000;
/** The start of the current UTC day: the anchor the record is laid out from. */
const ANCHOR = new Date(Math.floor(Date.now() / DAY) * DAY);
const ANCHOR = startOfUtcToday();
/**
* Days back the daily readings sit. The windows asked for are 7, 14, 30 and
* 365 days; a reading on exactly that many days back would fall in or out of
@@ -71,40 +73,6 @@ function at(daysAgo: number, hour: number, minute = 0): Date {
);
}
const ISO_INSTANT = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z/g;
const DAY_KEY = /\b\d{4}-\d{2}-\d{2}\b/g;
/** An instant as days and time from the anchor: `anchor-13d+06:30`. */
function relativeInstant(iso: string): string {
const ms = Date.parse(iso) - ANCHOR.getTime();
const days = Math.floor(ms / DAY);
const rest = new Date(ms - days * DAY).toISOString().slice(11, 19);
return `anchor${days >= 0 ? "+" : ""}${days}d+${rest}`;
}
/** A day key as days from the anchor's day: `day-13`. */
function relativeDay(key: string): string {
const days = Math.round(
(Date.parse(`${key}T00:00:00Z`) - ANCHOR.getTime()) / DAY,
);
return `day${days >= 0 ? "+" : ""}${days}`;
}
function relativeDates(value: unknown): unknown {
if (typeof value === "string") {
return value
.replace(ISO_INSTANT, relativeInstant)
.replace(DAY_KEY, relativeDay);
}
if (Array.isArray(value)) return value.map(relativeDates);
if (value && typeof value === "object") {
return Object.fromEntries(
Object.entries(value).map(([k, v]) => [k, relativeDates(v)]),
);
}
return value;
}
function seedRows(): Prisma.MeasurementCreateManyInput[] {
const rows: Prisma.MeasurementCreateManyInput[] = [];
const add = (row: Omit<Prisma.MeasurementCreateManyInput, "userId">) =>
@@ -238,11 +206,14 @@ async function step(
await expectParity(
`measurement-series.${name}`,
stable(
relativeDates({
status: res.status,
body: res.body,
events: events.map(eventFacts),
}),
relativeToAnchor(
{
status: res.status,
body: res.body,
events: events.map(eventFacts),
},
ANCHOR,
),
{ since: new Date() },
),
);
+51
View File
@@ -101,6 +101,57 @@ export function stable(value: unknown, options: StableOptions): unknown {
return walk(value, null);
}
const DAY_MS = 86_400_000;
const ANCHORED_INSTANT = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z/g;
const ANCHORED_DAY_KEY = /\b\d{4}-\d{2}-\d{2}\b/g;
/** The start of the current UTC day, the anchor `relativeToAnchor` uses. */
export function startOfUtcToday(): Date {
return new Date(Math.floor(Date.now() / DAY_MS) * DAY_MS);
}
/**
* A copy of `value` with every ISO instant written as days and time from
* `anchor` (`anchor-13d+06:30:00`) and every `YYYY-MM-DD` day key as days from
* the anchor's day (`day-13`), inside any string.
*
* For a walk whose route reads windows against the database clock, which a
* pinned `Date` cannot reach: the record is laid out from the start of the
* current UTC day, the clock is pinned to that day, and the snapshot holds
* only positions relative to it, so it reads the same on every day it runs.
* Keep the account in UTC, so a daylight-saving change between two runs
* cannot move a local day boundary against the anchor.
*/
export function relativeToAnchor(value: unknown, anchor: Date): unknown {
const base = anchor.getTime();
const instant = (iso: string) => {
const ms = Date.parse(iso) - base;
const days = Math.floor(ms / DAY_MS);
const time = new Date(ms - days * DAY_MS).toISOString().slice(11, 19);
return `anchor${days >= 0 ? "+" : ""}${days}d+${time}`;
};
const dayKey = (key: string) => {
const days = Math.round((Date.parse(`${key}T00:00:00Z`) - base) / DAY_MS);
return `day${days >= 0 ? "+" : ""}${days}`;
};
const walk = (node: unknown): unknown => {
if (node instanceof Date) node = node.toISOString();
if (typeof node === "string") {
return node
.replace(ANCHORED_INSTANT, instant)
.replace(ANCHORED_DAY_KEY, dayKey);
}
if (Array.isArray(node)) return node.map(walk);
if (node && typeof node === "object" && !(node instanceof Uint8Array)) {
return Object.fromEntries(
Object.entries(node).map(([k, v]) => [k, walk(v)]),
);
}
return node;
};
return walk(value);
}
/**
* The wide events requests emitted, collected in order. Install with
* `vi.mock("@/lib/logging/transports", wideEventRecorder.mockFactory)` in