diff --git a/CLAUDE.md b/CLAUDE.md index 886f3a4..561efc7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -76,9 +76,40 @@ frontend/src/ └── technical/ # MEMBERSHIP_SYSTEM.md ``` -## Aktuelle Version: v9e+ (Phase 1 Goal System Fixes) 🎯 Ready for Phase 0b - 27.03.2026 +## Aktuelle Version: v0.9g+ → v0.9h (Goals Complete + Dynamic Focus Areas) 🎯 27.03.2026 -### Letzte Updates (27.03.2026 - Phase 1 Complete) 🆕 +**Status:** BEREIT FÜR RELEASE v0.9h +**Branch:** develop +**Nächster Schritt:** Testing → Prod Deploy → Code Splitting → Phase 0b (120+ Platzhalter) + +### Letzte Updates (27.03.2026 - Dynamic Focus Areas v2.0 Complete) 🆕 + +#### Dynamic Focus Areas v2.0 System ✅ +- ✅ **Migration 031-032:** Vollständiges dynamisches System + - `focus_area_definitions` - 26 Basis-Bereiche in 7 Kategorien (admin-erweiterbar) + - `goal_focus_contributions` - Many-to-Many (Goals ↔ Focus Areas) mit Gewichtung + - `user_focus_area_weights` - User-spezifische Präferenzen (dynamisch) +- ✅ **Backend:** `routers/focus_areas.py` (~350 Zeilen) + - CRUD für Focus Area Definitions (Admin only) + - User preferences mit Auto-Normalisierung zu Prozenten + - Stats endpoint (Progress per Focus Area) +- ✅ **Frontend:** Komplett überarbeitet + - GoalsPage: Dynamische Kacheln (nur Bereiche mit Gewicht > 0) + - Edit-Modus: Alle 26 Bereiche mit Schiebereglern (gruppiert nach Kategorie) + - Ziel-Formular: Nur gewichtete Focus Areas zur Auswahl (cleaner UX) + - AdminFocusAreasPage: Volle CRUD-UI für Admin +- ✅ **Architektur-Verbesserungen:** + - Kein Goal Mode mehr (ersetzt durch dynamische Focus Areas) + - M:N Relationship: Ein Ziel zahlt auf 1-n Focus Areas ein + - Contribution Weights: Prozentuale Gewichtung pro Zuordnung + - User-extensible: Admin kann beliebige neue Bereiche hinzufügen + +#### Bug Fixes (alle deployed) ✅ +- ✅ **Focus Contributions speichern:** `focus_contributions` fehlte in API-Payload (GoalsPage:232) +- ✅ **Focus Area Filtering:** Nur gewichtete Areas im Ziel-Formular (bessere UX) +- ✅ **Vitals Baseline Fix:** Parameter mismatch in dynamischer Query-Generierung behoben + +#### Custom Goals Page (Capture/Eigene Ziele) ✅ - ✅ **Custom Goals Page (Capture/Eigene Ziele):** - Neue Seite für tägliche Werterfassung individueller Ziele - Dedizierte UI für custom goals (ohne automatische Datenquelle) diff --git a/docs/STATUS_2026-03-27.md b/docs/STATUS_2026-03-27.md new file mode 100644 index 0000000..29660e7 --- /dev/null +++ b/docs/STATUS_2026-03-27.md @@ -0,0 +1,272 @@ +# Projekt-Status: 27. März 2026 + +**Branch:** `develop` +**Letzte Version:** v0.9g+ (vor Release v0.9h) +**Deployment:** dev.mitai.jinkendo.de +**Nächster Meilenstein:** Release v0.9h → Code Splitting → Phase 0b + +--- + +## 🎯 Aktueller Zustand: BEREIT FÜR RELEASE v0.9h + +### Was ist fertig? ✅ + +#### Goals System (Phase 0a + Dynamic Focus Areas v2.0) +- ✅ **Migration 022:** goals, training_phases, fitness_tests tables +- ✅ **Migration 027-032:** Dynamic Focus Areas + - 26 Basis-Bereiche in 7 Kategorien (user-extensible) + - Many-to-Many: Goals ↔ Focus Areas mit contribution weights + - User preferences mit dynamischen Gewichtungen +- ✅ **Backend:** + - `routers/goals.py` - CRUD für Goals (~1200 Zeilen, **needs splitting**) + - `routers/focus_areas.py` - Dynamic system CRUD (~350 Zeilen) +- ✅ **Frontend:** + - `GoalsPage.jsx` - Strategic layer (~1180 Zeilen, **needs component extraction**) + - `CustomGoalsPage.jsx` - Tactical daily entry + - `AdminFocusAreasPage.jsx` - Admin UI für Focus Areas +- ✅ **Navigation:** Dashboard + Analysis integriert + +#### Bug Fixes (alle committed, deployed pending) +- ✅ Focus area contributions speichern (fehlte in API payload) +- ✅ Filtering: Nur gewichtete Focus Areas im Ziel-Formular +- ✅ Vitals baseline endpoint (parameter mismatch behoben) + +--- + +## 📋 Gitea Issues - Status + +### Geschlossen ✅ +- ✅ **#50:** Goals System v1 (Phase 0a) +- ✅ **#51:** Dynamic Focus Areas v2.0 +- ✅ **#48:** Flexibles KI Prompt System +- ✅ **#44:** BUG - Analysen löschen +- ✅ **#28:** AI-Prompts Flexibilisierung +- ⏳ **#25:** Goals System (sollte geschlossen werden - ist fertig!) + +### Offen - Priorisiert 🔲 +- 🔲 **#52:** NEW - Blutdruck-Ziele mit dual targets (systolic/diastolic) - 2-3h +- 🔲 **#49:** Prompt-Zuordnung zu Verlaufsseiten (6-8h, Quick Win) +- 🔲 **#47:** Wertetabelle Optimierung (4-6h, nach Phase 0b) +- 🔲 **#30:** Responsive UI - Desktop Sidebar (8-10h) +- 🔲 **#29:** Abilities-Matrix UI (6-8h) + +### Offen - Backlog 📦 +- 📦 #46, #45: KI Prompt-Ersteller/-Optimierer (später) +- 📦 #43, #42: Enhanced Debug UI (später) +- 📦 #40: Logout-Button (kosmetisch) +- 📦 #39: Usage-Badges Dashboard (kosmetisch) +- 📦 #27: Korrelationen erweitern (Phase 2) +- 📦 #26: Charts erweitern (Phase 1) + +--- + +## 🚀 Nächste Schritte (User-Plan APPROVED) + +### Phase 1: Testing + Release (2-3 Tage) +``` +Tag 1-2: Umfassende Tests des Goals-Moduls + [ ] Goal Mode wechseln + [ ] Focus Areas gewichten (alle 26 testen) + [ ] Ziele erstellen mit focus_contributions + [ ] Ziele bearbeiten (contributions ändern) + [ ] Ist-Werte eintragen (CustomGoalsPage) + [ ] Progress Modal testen + [ ] Admin Focus Areas CRUD + [ ] Edge Cases (leere Daten, Extremwerte) + [ ] Vitals baseline entry (Ruhepuls) - nach neuem Deployment + +Tag 3: Deploy + Release v0.9h + [ ] Final commit & push + [ ] Merge develop → main (PR in Gitea) + [ ] Tag v0.9h in Git + [ ] Deploy to Production + [ ] Smoke Tests + [ ] Release Notes schreiben +``` + +### Phase 2: Code Splitting (1-2 Tage) +``` +Tag 3-4: Backend Router Split + [ ] goals.py → 5 separate Router + - goals.py (core CRUD ~300 Zeilen) + - goal_types.py (~200 Zeilen) + - goal_progress.py (~150 Zeilen) + - training_phases.py (~150 Zeilen) + - fitness_tests.py (~150 Zeilen) + [ ] Imports anpassen + [ ] main.py: 5 neue Router registrieren + [ ] Optional: insights.py prüfen (wenn >800 Zeilen) + +Tag 5: Testing nach Split + [ ] API-Endpoints vollständig testen + [ ] Frontend funktioniert + [ ] Deployment auf dev +``` + +### Phase 3: Phase 0b - Goal-Aware Placeholders (4 Tage) +``` +Aufwand: 16-20h +Neue Platzhalter: 120+ Funktionen + +Tag 6: KÖRPER + ERNÄHRUNG (40 Funktionen) + - weight_7d_rolling_median, weight_28d_trend_slope + - fm_28d_delta, lbm_28d_delta, recomposition_score + - protein_g_per_kg, protein_g_per_kg_lbm + - nutrition_adherence_score, energy_availability + +Tag 7: AKTIVITÄT + RECOVERY (37 Funktionen) + - activity_quality_avg_28d, activity_strain_28d + - activity_monotony_28d, ability_balance_score + - recovery_score, sleep_regularity_index, sleep_debt_hours + +Tag 8: KORRELATIONEN + META + Scoring (20 Funktionen + System) + - corr_energy_weight_lag, plateau_detected + - goal_mode, data_quality_score, profile_age_years + - Score-Gewichtung pro goal_mode implementieren + +Tag 9: Integration + Testing + - Prompts aktualisieren mit neuen Platzhaltern + - Testing mit verschiedenen goal_modes + - Dokumentation + +Tag 10: Deploy v0.10a +``` + +--- + +## 📊 Code-Metriken (Stand 27.03.2026) + +### Große Dateien (Splitting-Kandidaten) +``` +Backend: +- routers/goals.py ~1200 Zeilen ⚠️ SPLIT NEEDED +- routers/insights.py ~800 Zeilen (prüfen) +- routers/focus_areas.py ~350 Zeilen ✓ OK + +Frontend: +- pages/GoalsPage.jsx ~1180 Zeilen ⚠️ Component extraction möglich +- pages/AdminPanel.jsx ~700 Zeilen ✓ OK +- pages/CustomGoalsPage.jsx ~350 Zeilen ✓ OK +``` + +### Migrations Status +``` +Letzte Migration: 032_user_focus_area_weights.sql +Nächste: 033_dual_target_fields.sql (BP goals, Issue #52) + +Alle Migrationen 001-032 erfolgreich angewandt auf dev ✅ +``` + +--- + +## 🔧 Technische Schulden + +### Hoch-Priorität +1. **Code Splitting:** goals.py zu groß für Context Window +2. **Component Extraction:** GoalsPage.jsx komponenten-basiert +3. **Testing Suite:** Automatisierte Tests fehlen komplett + +### Mittel-Priorität +4. **Responsive UI:** Desktop-Sidebar fehlt (Issue #30) +5. **Error Handling:** Mehr defensive Programmierung nötig +6. **API Documentation:** Swagger/OpenAPI fehlt + +### Niedrig-Priorität +7. **Type Hints:** Mehr Python Type Annotations +8. **Performance:** Einige N+1 Queries optimieren +9. **Caching:** Redis für häufige Abfragen + +--- + +## 📚 Dokumentation - Status + +### Aktuell ✅ +- ✅ `CLAUDE.md` - Hauptdokumentation +- ✅ `docs/STATUS_2026-03-27.md` - Dieser Status (NEU) +- ✅ `docs/NEXT_STEPS_2026-03-26.md` - Roadmap Phase 0b +- ✅ `docs/issues/issue-50-phase-0a-goal-system.md` - Phase 0a abgeschlossen +- ✅ `docs/issues/issue-52-blood-pressure-dual-targets.md` - Neue Issue (NEU) +- ✅ `.claude/docs/functional/AI_PROMPTS.md` - Prompt-System komplett +- ✅ `.claude/docs/technical/MEMBERSHIP_SYSTEM.md` - Feature-Enforcement + +### Zu aktualisieren 📝 +- 📝 `CLAUDE.md` - v0.9g/h Updates eintragen +- 📝 `.claude/docs/ROADMAP.md` - Phase 0a als ✅ markieren +- 📝 `.claude/library/` - Nach v0.9h Release aktualisieren + +--- + +## 🎯 Decision Points + +### Entschieden ✅ +1. **User-Plan APPROVED:** Testing → Release → Split → Phase 0b +2. **Code Splitting:** Backend Router zuerst, Frontend optional +3. **Phase 0b:** Szenario 2 (Strategic Depth first) - 120+ Platzhalter +4. **Release Strategy:** v0.9h als stabiler Rollback-Punkt + +### Offen 🤔 +1. **Issue #52 (BP dual targets):** Vor oder nach Phase 0b? → **Empfehlung: Nach Phase 0b** +2. **Frontend Components:** Extract während oder nach Split? → **Empfehlung: Nach, wenn Zeit** +3. **Issue #49 (Prompt pages):** Vor oder nach Phase 0b? → **Empfehlung: Nach Phase 0b** + +--- + +## 🚨 Aktuelle Blocker / Risiken + +### Keine kritischen Blocker ✅ + +**Kleine Risiken:** +1. ⚠️ **Vitals baseline fix:** Gerade deployed, needs testing +2. ⚠️ **Migration 032:** Muss auf Prod laufen (dev läuft bereits) +3. ⚠️ **Code Splitting:** Könnte Regressionen einführen → gründliches Testing + +--- + +## 📞 Ansprechpunkte für Wiederaufnahme + +**Wenn du zu diesem Stand zurückkehrst:** + +1. **Lies zuerst:** + - Dieses Dokument (STATUS_2026-03-27.md) + - CLAUDE.md (aktuelle Version) + - docs/NEXT_STEPS_2026-03-26.md (Roadmap) + +2. **Prüfe:** + - Ist v0.9h deployed? `git describe --tags` + - Läuft dev/prod? `curl https://dev.mitai.jinkendo.de/api/version` + - Gitea Issues-Status aktuell? + +3. **Nächster Schritt:** + - Falls v0.9h deployed: Start Code Splitting + - Falls nicht: Führe Testing-Checklist aus (siehe Phase 1 oben) + +4. **Claude Code Context:** + ``` + "Wir sind bei v0.9h Release. Goals-System ist komplett (Phase 0a + Dynamic Focus Areas v2.0). + Nächster Schritt: [Testing/Code Splitting/Phase 0b] - siehe STATUS_2026-03-27.md" + ``` + +--- + +## 📈 Metriken seit letztem Stand + +**Commits seit v0.9g:** +- 6 Commits (Goals fixes, Focus Areas v2.0, Vitals baseline fix) +- +1200 Zeilen (neue Features) +- -400 Zeilen (Refactoring) + +**Issues:** +- 3 geschlossen (#50, #51, #48) +- 1 neu (#52) +- 1 sollte geschlossen werden (#25) + +**Deployment:** +- Letzte 3 Deployments erfolgreich +- Dev-Environment stabil +- Prod auf v0.9g (stabil) + +--- + +**Erstellt:** 27. März 2026, 22:30 Uhr +**Von:** Claude Code (Sonnet 4.5) +**Nächstes Update:** Nach v0.9h Release diff --git a/docs/issues/issue-52-blood-pressure-dual-targets.md b/docs/issues/issue-52-blood-pressure-dual-targets.md new file mode 100644 index 0000000..461416d --- /dev/null +++ b/docs/issues/issue-52-blood-pressure-dual-targets.md @@ -0,0 +1,157 @@ +# Issue #52: Blutdruck-Ziele benötigen zwei Zielfelder + +**Status:** 🔲 OFFEN +**Erstellt:** 27.03.2026 +**Priorität:** Medium +**Typ:** Enhancement +**Labels:** goals, blood-pressure, enhancement +**Aufwand:** 2-3h + +--- + +## Problem + +**Aktuell:** +- Blutdruck-Ziele (goal_type = 'bp') haben nur EIN Zielfeld (`target_value`) +- Blutdruck besteht aber aus ZWEI Werten: Systolisch + Diastolisch +- Beispiel-Ziel: "Blutdruck senken auf 120/80 mmHg" + - Systolisch (oberer Wert): 120 + - Diastolisch (unterer Wert): 80 + +**Konsequenz:** +- User kann nur einen Wert als Ziel eingeben +- Unvollständige Zieldefinition +- Progress-Tracking ungenau + +--- + +## Lösung + +### Option A: Dual Target Fields (empfohlen) + +**Schema-Änderung:** +```sql +-- Migration 033 +ALTER TABLE goals ADD COLUMN target_value_secondary DECIMAL(10,2); +ALTER TABLE goals ADD COLUMN current_value_secondary DECIMAL(10,2); +ALTER TABLE goals ADD COLUMN start_value_secondary DECIMAL(10,2); + +COMMENT ON COLUMN goals.target_value_secondary IS 'Secondary target (e.g., diastolic BP for bp goal type)'; +``` + +**Anwendung:** +- `bp` goal type: + - `target_value` = Systolisch (120) + - `target_value_secondary` = Diastolisch (80) +- Andere goal types: `target_value_secondary` = NULL + +**UI-Anpassung:** +```jsx +// GoalForm - conditional rendering +{formData.goal_type === 'bp' && ( +