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:
Marc-André Bombeck committed 2026-06-14 15:23:26 +02:00
1 parent 2c225ce094
commit 609d248252
18 files changed
+561 -6

No files matched your search

+3
View File
@@ -92,6 +92,9 @@ export const PATCH = apiHandler(async (req: Request) => {
data: {
...(p.enabled !== undefined && { cycleTrackingEnabled: p.enabled }),
...(p.goal !== undefined && { goal: p.goal }),
...(p.secondarySymptom !== undefined && {
secondarySymptom: p.secondarySymptom,
}),
...(p.rawChartMode !== undefined && { rawChartMode: p.rawChartMode }),
...(p.predictionEnabled !== undefined && {
predictionEnabled: p.predictionEnabled,
+6
View File
@@ -102,6 +102,9 @@ export const GET = apiHandler(async (request: NextRequest) => {
temperatureExcluded: true,
ovulationTest: true,
cervicalMucus: true,
cervixPosition: true,
cervixFirmness: true,
cervixOpening: true,
_count: { select: { symptomLinks: true } },
},
}),
@@ -129,6 +132,9 @@ export const GET = apiHandler(async (request: NextRequest) => {
temperatureExcluded: l.temperatureExcluded,
ovulationTest: l.ovulationTest,
cervicalMucus: l.cervicalMucus,
cervixPosition: l.cervixPosition,
cervixFirmness: l.cervixFirmness,
cervixOpening: l.cervixOpening,
hasSymptoms: l._count.symptomLinks > 0,
}));
+3
View File
@@ -93,6 +93,9 @@ export const GET = apiHandler(async () => {
temperatureExcluded: true,
ovulationTest: true,
cervicalMucus: true,
cervixPosition: true,
cervixFirmness: true,
cervixOpening: true,
symptomLinks: { select: { symptom: { select: { key: true } } } },
},
}),