feat(mood): seed a rated family factor in the mood catalog

The family factor existed only as a binary tag; add a rated factor_family
(scale 1..5, not inverse) under the factors category so it can be scored
per entry. Additive seed, read dynamically by the tag catalog.
This commit is contained in:
Marc-André Bombeck committed 2026-06-05 01:07:27 +02:00
1 parent 9b094fc4a2
commit ac4d84f386
7 files changed
+29 -6

No files matched your search

+2 -1
View File
@@ -573,7 +573,8 @@
"factorSocial": "Soziales",
"factorSleepQuality": "Schlafqualität",
"factorStress": "Stress",
"factorConflict": "Konflikt"
"factorConflict": "Konflikt",
"factorFamily": "Familie"
}
},
"medications": {
+2 -1
View File
@@ -573,7 +573,8 @@
"factorSocial": "social",
"factorSleepQuality": "sleep quality",
"factorStress": "stress",
"factorConflict": "conflict"
"factorConflict": "conflict",
"factorFamily": "family"
}
},
"medications": {
+2 -1
View File
@@ -573,7 +573,8 @@
"factorSocial": "vida social",
"factorSleepQuality": "calidad del sueño",
"factorStress": "estrés",
"factorConflict": "conflicto"
"factorConflict": "conflicto",
"factorFamily": "familia"
}
},
"medications": {
+2 -1
View File
@@ -573,7 +573,8 @@
"factorSocial": "vie sociale",
"factorSleepQuality": "qualité du sommeil",
"factorStress": "stress",
"factorConflict": "conflit"
"factorConflict": "conflit",
"factorFamily": "famille"
}
},
"medications": {
+2 -1
View File
@@ -573,7 +573,8 @@
"factorSocial": "vita sociale",
"factorSleepQuality": "qualità del sonno",
"factorStress": "stress",
"factorConflict": "conflitto"
"factorConflict": "conflitto",
"factorFamily": "famiglia"
}
},
"medications": {
+2 -1
View File
@@ -573,7 +573,8 @@
"factorSocial": "życie towarzyskie",
"factorSleepQuality": "jakość snu",
"factorStress": "stres",
"factorConflict": "konflikt"
"factorConflict": "konflikt",
"factorFamily": "rodzina"
}
},
"medications": {
@@ -0,0 +1,17 @@
-- v1.12.0 — add a rated `factor_family` to the mood factor catalog.
--
-- Follow-up to 0119: the operator asked for a "family" rating, and `family`
-- existed only as a BINARY tag. This seeds a sixth RATED factor under the
-- existing `factors` category (`mtc_factors`), scale 1..5, not inverse
-- (higher = a better family day). Strictly additive — no schema change, the
-- catalog is read dynamically by `GET /api/mood/tags`, so iOS and web pick
-- it up with no client change. Deterministic id + ON CONFLICT upsert keep
-- the seed idempotent, mirroring 0119.
INSERT INTO "mood_tags"
("id", "category_id", "key", "label_key", "icon", "sort_order", "is_active", "kind", "scale_min", "scale_max", "inverse")
VALUES ('mt_factor_family', 'mtc_factors', 'factor_family', 'mood.tag.factorFamily', 'Home', 5, true, 'RATED', 1, 5, false)
ON CONFLICT ("key") DO UPDATE SET
"category_id" = EXCLUDED."category_id", "label_key" = EXCLUDED."label_key", "icon" = EXCLUDED."icon",
"sort_order" = EXCLUDED."sort_order", "kind" = EXCLUDED."kind", "scale_min" = EXCLUDED."scale_min",
"scale_max" = EXCLUDED."scale_max", "inverse" = EXCLUDED."inverse";