mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
feat(cycle): choose cervix as the symptothermal secondary symptom
Let a user pick the Sensiplan double-check's second indicator — cervical mucus (default) or cervix observation — mirroring the published NFP standard where the temperature primary sign pairs with one chosen secondary sign. - `CycleProfile.secondarySymptom` (MUCUS default | CERVIX) drives which second sign the engine confirms against. Casual users keep temperature + mucus untouched; the choice lives behind the advanced cycle settings. - `CycleDayLog` gains the three standard cervix signs — position (LOW/HIGH), firmness (FIRM/SOFT), opening/os (CLOSED/OPEN) — as nullable columns (migration 0157), wired through Zod, the day-log upsert, the DTO, the sync feed, backup/restore and OpenAPI. Additive and back-compatible: existing profiles backfill MUCUS, existing day-logs keep NULL cervix signs, iOS inherits the fields. - The engine's `confirmSymptothermal` takes the secondary-symptom choice; on CERVIX it confirms against `detectCervixPeak` (last fertile-cervix day followed by three closed days — the cervix-closure rule) instead of the mucus peak. The double-check still requires BOTH the temperature shift AND the secondary peak: a single cervix sign never confirms, and the still-learning gate and conservative posture are unchanged. Engine derived clean-room from the Arbeitsgruppe-NFP / Raith-Paula & Frank-Herrmann standard.
This commit is contained in:
1 parent
2c225ce094
commit
609d248252
18 files changed
+561
-6
No files matched your search
@@ -144,6 +144,9 @@ const cycleDayLogSchema = z
|
||||
temperatureExcluded: z.boolean().optional(),
|
||||
ovulationTest: z.string().nullable().optional(),
|
||||
cervicalMucus: z.string().nullable().optional(),
|
||||
cervixPosition: z.string().nullable().optional(),
|
||||
cervixFirmness: z.string().nullable().optional(),
|
||||
cervixOpening: z.string().nullable().optional(),
|
||||
sexualActivity: z.boolean().optional(),
|
||||
protectedSex: z.boolean().nullable().optional(),
|
||||
pregnancyTest: z.string().nullable().optional(),
|
||||
@@ -166,6 +169,7 @@ const cycleProfileSchema = z
|
||||
typicalCycleLength: z.number().int().nullable().optional(),
|
||||
typicalPeriodLength: z.number().int().nullable().optional(),
|
||||
lutealPhaseLength: z.number().int().nullable().optional(),
|
||||
secondarySymptom: z.string().nullable().optional(),
|
||||
predictionEnabled: z.boolean().optional(),
|
||||
rawChartMode: z.boolean().optional(),
|
||||
discreetNotifications: z.boolean().optional(),
|
||||
|
||||
@@ -51,6 +51,14 @@ export const cervicalMucusEnum = z.enum([
|
||||
"EGG_WHITE",
|
||||
]);
|
||||
|
||||
/** Symptothermal secondary-symptom choice (mirrors the Prisma enum). */
|
||||
export const secondarySymptomEnum = z.enum(["MUCUS", "CERVIX"]);
|
||||
|
||||
/** The three Sensiplan cervix signs (mirror the Prisma enums). */
|
||||
export const cervixPositionEnum = z.enum(["LOW", "HIGH"]);
|
||||
export const cervixFirmnessEnum = z.enum(["FIRM", "SOFT"]);
|
||||
export const cervixOpeningEnum = z.enum(["CLOSED", "OPEN"]);
|
||||
|
||||
export const homeTestResultEnum = z.enum([
|
||||
"NEGATIVE",
|
||||
"POSITIVE",
|
||||
@@ -108,6 +116,11 @@ export const cycleDayLogInputSchema = z.object({
|
||||
temperatureExcluded: z.boolean().optional(),
|
||||
ovulationTest: ovulationTestEnum.optional(),
|
||||
cervicalMucus: cervicalMucusEnum.optional(),
|
||||
// Cervix observation — the symptothermal secondary indicator when the
|
||||
// profile's secondarySymptom is CERVIX.
|
||||
cervixPosition: cervixPositionEnum.optional(),
|
||||
cervixFirmness: cervixFirmnessEnum.optional(),
|
||||
cervixOpening: cervixOpeningEnum.optional(),
|
||||
sexualActivity: z.boolean().optional(),
|
||||
protectedSex: z.boolean().nullable().optional(),
|
||||
pregnancyTest: homeTestResultEnum.optional(),
|
||||
@@ -138,6 +151,9 @@ export const cycleDayLogPatchSchema = z.object({
|
||||
temperatureExcluded: z.boolean().optional(),
|
||||
ovulationTest: ovulationTestEnum.nullable().optional(),
|
||||
cervicalMucus: cervicalMucusEnum.nullable().optional(),
|
||||
cervixPosition: cervixPositionEnum.nullable().optional(),
|
||||
cervixFirmness: cervixFirmnessEnum.nullable().optional(),
|
||||
cervixOpening: cervixOpeningEnum.nullable().optional(),
|
||||
sexualActivity: z.boolean().optional(),
|
||||
protectedSex: z.boolean().nullable().optional(),
|
||||
pregnancyTest: homeTestResultEnum.nullable().optional(),
|
||||
@@ -192,6 +208,9 @@ export const cyclePrefsSchema = z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
goal: cycleTrackingGoalEnum.optional(),
|
||||
// Symptothermal secondary symptom — advanced cycle setting (MUCUS default
|
||||
// | CERVIX). Drives which second sign the double-check uses.
|
||||
secondarySymptom: secondarySymptomEnum.optional(),
|
||||
rawChartMode: z.boolean().optional(),
|
||||
predictionEnabled: z.boolean().optional(),
|
||||
discreetNotifications: z.boolean().optional(),
|
||||
|
||||
Reference in new issue
Block a user