feat(insights): correlate rated mood factors against vitals

Rated mood factors (work / sleep-quality / stress, scored per entry) now
participate in the cross-metric correlation surface. Until now their score
series was captured but read by zero analytics.

Two paths, both on the existing FDR-controlled engine:

- A factor x vital crosstab on the mood insights page and the mood
  snapshot: for each factor the user scores, split its days low vs high by
  the factor's own median, then run the same Welch test + day floors +
  Benjamini-Hochberg correction the tag crosstab uses. Surfaces lines like
  "sleep runs ~38 min below baseline on the days you rated work low"
  (n-gated, q <= 0.10, never fabricated on thin data).
- Factor channels (FACTOR:<key>) fold into the period-narrative discovery
  matrix as both lag source and lag target, so the drivers the coach and
  narrative reference can cite a factor relationship.

An inverse factor (higher rating = worse day) gets the documented sign-flip
once, at the series boundary, so "up" always reads as a better day and the
low/high split and phrasing stay honest. Strings land in all six locales;
the surface carries the standing "association, not cause" caption.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-05 23:58:40 +02:00
1 parent 30a7437f4d
commit dfda2a1c7e
15 files changed
+1133 -17

No files matched your search

+20
View File
@@ -2645,6 +2645,26 @@
"detailSameDay": "Durchschnittlich {withAvg} {unit} an den {withDays} Tagen mit diesem Tag gegenüber {withoutAvg} {unit} ohne.",
"detailNextDay": "Durchschnittlich {withAvg} {unit} am Tag nach den {withDays} Tagen mit diesem Tag gegenüber {withoutAvg} {unit} sonst."
},
"factorCrosstab": {
"title": "Deine bewerteten Faktoren und deine Vitalwerte",
"description": "Wie sich ein Vitalwert an den Tagen unterscheidet, an denen du einen Faktor niedrig bewertet hast, verglichen mit den Tagen mit hoher Bewertung.",
"pairLabel": "{factor} · {metric}",
"metricSleepDuration": "Schlaf",
"metricSteps": "Schritte",
"metricRestingHeartRate": "Ruhepuls",
"metricHrv": "Herzfrequenzvariabilität",
"metricWeight": "Gewicht",
"metricBloodPressureSys": "Systolisch",
"unitHours": "Std.",
"unitScore": "Pkt.",
"unitSteps": "Schritte",
"unitBpm": "bpm",
"unitMs": "ms",
"unitKg": "kg",
"unitMmHg": "mmHg",
"detail": "Durchschnittlich {lowAvg} {unit} an den {lowDays} Tagen mit niedriger {factor}-Bewertung gegenüber {highAvg} {unit} an den Tagen mit hoher Bewertung.",
"detailInverse": "Durchschnittlich {lowAvg} {unit} an deinen {lowDays} schlechteren {factor}-Tagen gegenüber {highAvg} {unit} an deinen besseren."
},
"discovery": {
"title": "Was auffällt",
"subheading": "Entdeckte Zusammenhänge",
+20
View File
@@ -2645,6 +2645,26 @@
"detailSameDay": "Averages {withAvg} {unit} on the {withDays} days you tagged this vs {withoutAvg} {unit} without it.",
"detailNextDay": "Averages {withAvg} {unit} the day after the {withDays} days you tagged this vs {withoutAvg} {unit} otherwise."
},
"factorCrosstab": {
"title": "Your rated factors and your vitals",
"description": "How a vital differs on the days you rated each factor low compared with the days you rated it high.",
"pairLabel": "{factor} · {metric}",
"metricSleepDuration": "Sleep",
"metricSteps": "Steps",
"metricRestingHeartRate": "Resting heart rate",
"metricHrv": "Heart-rate variability",
"metricWeight": "Weight",
"metricBloodPressureSys": "Systolic",
"unitHours": "h",
"unitScore": "pts",
"unitSteps": "steps",
"unitBpm": "bpm",
"unitMs": "ms",
"unitKg": "kg",
"unitMmHg": "mmHg",
"detail": "Averages {lowAvg} {unit} on the {lowDays} days you rated {factor} low vs {highAvg} {unit} on the days you rated it high.",
"detailInverse": "Averages {lowAvg} {unit} on your {lowDays} worse {factor} days vs {highAvg} {unit} on your better ones."
},
"discovery": {
"title": "What stands out",
"subheading": "Discovered relationships",
+20
View File
@@ -2645,6 +2645,26 @@
"detailSameDay": "Promedia {withAvg} {unit} en los {withDays} días que lo etiquetaste frente a {withoutAvg} {unit} sin él.",
"detailNextDay": "Promedia {withAvg} {unit} el día después de los {withDays} días que lo etiquetaste frente a {withoutAvg} {unit} el resto."
},
"factorCrosstab": {
"title": "Tus factores valorados y tus constantes",
"description": "Cómo difiere una constante en los días en que valoraste bajo cada factor frente a los días en que lo valoraste alto.",
"pairLabel": "{factor} · {metric}",
"metricSleepDuration": "Sueño",
"metricSteps": "Pasos",
"metricRestingHeartRate": "Frecuencia cardíaca en reposo",
"metricHrv": "Variabilidad de la frecuencia cardíaca",
"metricWeight": "Peso",
"metricBloodPressureSys": "Sistólica",
"unitHours": "h",
"unitScore": "pts",
"unitSteps": "pasos",
"unitBpm": "ppm",
"unitMs": "ms",
"unitKg": "kg",
"unitMmHg": "mmHg",
"detail": "Promedia {lowAvg} {unit} en los {lowDays} días que valoraste {factor} bajo frente a {highAvg} {unit} en los días que lo valoraste alto.",
"detailInverse": "Promedia {lowAvg} {unit} en tus {lowDays} peores días de {factor} frente a {highAvg} {unit} en los mejores."
},
"discovery": {
"title": "Lo que destaca",
"subheading": "Relaciones descubiertas",
+20
View File
@@ -2645,6 +2645,26 @@
"detailSameDay": "En moyenne {withAvg} {unit} les {withDays} jours avec ce tag contre {withoutAvg} {unit} sans.",
"detailNextDay": "En moyenne {withAvg} {unit} le lendemain des {withDays} jours avec ce tag contre {withoutAvg} {unit} sinon."
},
"factorCrosstab": {
"title": "Vos facteurs notés et vos constantes",
"description": "Comment une constante diffère les jours où vous avez noté un facteur bas par rapport aux jours où vous l'avez noté haut.",
"pairLabel": "{factor} · {metric}",
"metricSleepDuration": "Sommeil",
"metricSteps": "Pas",
"metricRestingHeartRate": "Fréquence cardiaque au repos",
"metricHrv": "Variabilité de la fréquence cardiaque",
"metricWeight": "Poids",
"metricBloodPressureSys": "Systolique",
"unitHours": "h",
"unitScore": "pts",
"unitSteps": "pas",
"unitBpm": "bpm",
"unitMs": "ms",
"unitKg": "kg",
"unitMmHg": "mmHg",
"detail": "En moyenne {lowAvg} {unit} les {lowDays} jours où vous avez noté {factor} bas contre {highAvg} {unit} les jours où vous l'avez noté haut.",
"detailInverse": "En moyenne {lowAvg} {unit} sur vos {lowDays} pires jours de {factor} contre {highAvg} {unit} sur les meilleurs."
},
"discovery": {
"title": "Ce qui ressort",
"subheading": "Relations découvertes",
+20
View File
@@ -2645,6 +2645,26 @@
"detailSameDay": "In media {withAvg} {unit} nei {withDays} giorni con questo tag contro {withoutAvg} {unit} senza.",
"detailNextDay": "In media {withAvg} {unit} il giorno dopo i {withDays} giorni con questo tag contro {withoutAvg} {unit} altrimenti."
},
"factorCrosstab": {
"title": "I tuoi fattori valutati e i tuoi parametri vitali",
"description": "Come cambia un parametro vitale nei giorni in cui hai valutato basso un fattore rispetto ai giorni in cui lo hai valutato alto.",
"pairLabel": "{factor} · {metric}",
"metricSleepDuration": "Sonno",
"metricSteps": "Passi",
"metricRestingHeartRate": "Frequenza cardiaca a riposo",
"metricHrv": "Variabilità della frequenza cardiaca",
"metricWeight": "Peso",
"metricBloodPressureSys": "Sistolica",
"unitHours": "h",
"unitScore": "pti",
"unitSteps": "passi",
"unitBpm": "bpm",
"unitMs": "ms",
"unitKg": "kg",
"unitMmHg": "mmHg",
"detail": "In media {lowAvg} {unit} nei {lowDays} giorni in cui hai valutato basso {factor} contro {highAvg} {unit} nei giorni in cui lo hai valutato alto.",
"detailInverse": "In media {lowAvg} {unit} nei tuoi {lowDays} giorni peggiori di {factor} contro {highAvg} {unit} in quelli migliori."
},
"discovery": {
"title": "Cosa risalta",
"subheading": "Relazioni scoperte",
+20
View File
@@ -2645,6 +2645,26 @@
"detailSameDay": "Średnio {withAvg} {unit} w {withDays} dniach z tym tagiem wobec {withoutAvg} {unit} bez niego.",
"detailNextDay": "Średnio {withAvg} {unit} dzień po {withDays} dniach z tym tagiem wobec {withoutAvg} {unit} w pozostałe dni."
},
"factorCrosstab": {
"title": "Twoje ocenione czynniki i parametry życiowe",
"description": "Jak parametr życiowy różni się w dniach, w których oceniłeś dany czynnik nisko, w porównaniu z dniami, w których oceniłeś go wysoko.",
"pairLabel": "{factor} · {metric}",
"metricSleepDuration": "Sen",
"metricSteps": "Kroki",
"metricRestingHeartRate": "Tętno spoczynkowe",
"metricHrv": "Zmienność rytmu serca",
"metricWeight": "Waga",
"metricBloodPressureSys": "Skurczowe",
"unitHours": "godz.",
"unitScore": "pkt",
"unitSteps": "kroki",
"unitBpm": "bpm",
"unitMs": "ms",
"unitKg": "kg",
"unitMmHg": "mmHg",
"detail": "Średnio {lowAvg} {unit} w {lowDays} dniach z niską oceną {factor} wobec {highAvg} {unit} w dniach z wysoką oceną.",
"detailInverse": "Średnio {lowAvg} {unit} w Twoich {lowDays} gorszych dniach {factor} wobec {highAvg} {unit} w lepszych."
},
"discovery": {
"title": "Co się wyróżnia",
"subheading": "Wykryte relacje",