docs: Struktur .claude/docs versionieren, working/, Gitea-Index, Regeln
- .gitignore: .claude/docs, rules, commands tracken; settings.local weiter ignorieren - DOCUMENTATION.md: verbindliche Ablage functional/technical/working/issues - .claude/README.md: Agent-Einstieg; GITEA_ISSUES_INDEX aus MCP (Stand 2026-04-08) - Arbeitspapiere von docs/ nach .claude/docs/working/ verschoben - docs/MEMBERSHIP_SYSTEM.md als Stub; kanonisch technical/MEMBERSHIP_SYSTEM.md - CLAUDE.md Pflichtlektüre und Links angepasst; docs/README.md vereinfacht Made-with: Cursor
This commit is contained in:
1 parent
24daeeb83c
commit
7940dc7560
115 files changed
+45622
-1063
No files matched your search
@@ -1,196 +0,0 @@
|
||||
# Dokumentation Abgeschlossen - 27. März 2026
|
||||
|
||||
## ✅ Was wurde dokumentiert?
|
||||
|
||||
### 1. Hauptstatus-Dokument
|
||||
📄 **`docs/STATUS_2026-03-27.md`** (NEU)
|
||||
- Vollständiger aktueller Zustand
|
||||
- Gitea Issues Status (offen/geschlossen)
|
||||
- Nächste Schritte (Testing → Release → Code Splitting → Phase 0b)
|
||||
- Code-Metriken und technische Schulden
|
||||
- Entscheidungspunkte und Risiken
|
||||
- **Wiederanstiegspunkt für zukünftige Sessions**
|
||||
|
||||
### 2. Neue Issue dokumentiert
|
||||
📄 **`docs/issues/issue-52-blood-pressure-dual-targets.md`** (NEU)
|
||||
- Blutdruck-Ziele benötigen zwei Zielfelder (systolisch/diastolisch)
|
||||
- Migration 033 geplant
|
||||
- UI-Anpassungen beschrieben
|
||||
- 2-3h Aufwand geschätzt
|
||||
|
||||
### 3. CLAUDE.md aktualisiert
|
||||
📄 **`CLAUDE.md`**
|
||||
- Version: v0.9g+ → v0.9h
|
||||
- Dynamic Focus Areas v2.0 Sektion hinzugefügt
|
||||
- Bug Fixes dokumentiert
|
||||
- Status: BEREIT FÜR RELEASE v0.9h
|
||||
|
||||
### 4. Roadmap aktualisiert
|
||||
📄 **`.claude/docs/ROADMAP.md`**
|
||||
- Phase 0a: ✅ COMPLETE
|
||||
- Phase 0b: 🎯 NEXT (detaillierter Plan)
|
||||
- Timeline aktualisiert
|
||||
- Phasen-Übersicht neu strukturiert
|
||||
|
||||
---
|
||||
|
||||
## 📋 Gitea Issues - Aktueller Stand
|
||||
|
||||
### Geprüft ✅
|
||||
- Alle offenen Issues durchgesehen (49, 47, 46, 45, 43, 42, 40, 39, 38, 37, 36, 35, 34, 33, 32, 30, 29, 27, 26, 25)
|
||||
- Geschlossene Issues verifiziert (#50, #51, #48, #44, #28)
|
||||
|
||||
### Manuelle Aktionen erforderlich ⚠️
|
||||
|
||||
Du musst noch in Gitea (http://192.168.2.144:3000/Lars/mitai-jinkendo/issues):
|
||||
|
||||
1. **Issue #25 schließen:**
|
||||
- Titel: "[FEAT] Ziele-System (Goals) - v9e Kernfeature"
|
||||
- Status: ✅ KOMPLETT (Phase 0a + Dynamic Focus Areas v2.0)
|
||||
- Aktion: Manuell auf "Closed" setzen
|
||||
- Kommentar: "Completed in v0.9g-h: Phase 0a + Dynamic Focus Areas v2.0. See issue #50 and #51 for details."
|
||||
|
||||
2. **Issue #52 erstellen:**
|
||||
- Titel: "Enhancement: Blutdruck-Ziele benötigen zwei Zielfelder (systolisch/diastolisch)"
|
||||
- Labels: enhancement, goals, blood-pressure
|
||||
- Priorität: Medium
|
||||
- Beschreibung: Kopiere aus `docs/issues/issue-52-blood-pressure-dual-targets.md`
|
||||
- Aufwand: 2-3h
|
||||
- Milestone: v0.10a (nach Phase 0b)
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Nächste Schritte (wenn du weitermachst)
|
||||
|
||||
### Sofort (nach Deployment-Test):
|
||||
1. **Teste Vitals Baseline Fix**
|
||||
- Ruhepuls eintragen (sollte jetzt funktionieren)
|
||||
- Andere Baseline-Werte testen
|
||||
|
||||
2. **Beginne Goals Testing**
|
||||
- Siehe Checklist in `STATUS_2026-03-27.md`
|
||||
- 2-3 Tage gründliches Testing
|
||||
|
||||
### Dann:
|
||||
3. **Release v0.9h vorbereiten**
|
||||
- Release Notes schreiben
|
||||
- Merge develop → main
|
||||
- Tag v0.9h
|
||||
- Deploy to Production
|
||||
|
||||
4. **Code Splitting durchführen**
|
||||
- goals.py → 5 separate Router
|
||||
- Optional: insights.py prüfen
|
||||
|
||||
5. **Phase 0b starten**
|
||||
- 120+ goal-aware Platzhalter
|
||||
- Score-System
|
||||
- 16-20h Aufwand
|
||||
|
||||
---
|
||||
|
||||
## 📚 Wichtige Dokumente - Lesereihenfolge
|
||||
|
||||
Wenn du zu diesem Punkt zurückkehrst:
|
||||
|
||||
### 1. Zuerst lesen:
|
||||
- **`docs/STATUS_2026-03-27.md`** ← START HIER
|
||||
- **`CLAUDE.md`** (aktuelle Version)
|
||||
- **`docs/NEXT_STEPS_2026-03-26.md`** (Phase 0b Details)
|
||||
|
||||
### 2. Bei Bedarf:
|
||||
- **`.claude/docs/ROADMAP.md`** (Gesamtübersicht)
|
||||
- **`docs/issues/issue-50-phase-0a-goal-system.md`** (Was wurde gebaut)
|
||||
- **`docs/issues/issue-52-blood-pressure-dual-targets.md`** (Nächstes Enhancement)
|
||||
|
||||
### 3. Funktionale Specs:
|
||||
- **`.claude/docs/functional/AI_PROMPTS.md`** (Prompt-System)
|
||||
- **`.claude/docs/functional/TRAINING_TYPES.md`** (Trainingstypen + Abilities)
|
||||
|
||||
### 4. Technische Specs:
|
||||
- **`.claude/docs/technical/MEMBERSHIP_SYSTEM.md`** (Feature-Enforcement)
|
||||
- **`.claude/docs/architecture/`** (Wenn vorhanden)
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Wiederanstiegspunkt für Claude Code
|
||||
|
||||
### Context Prompt (copy-paste für neue Session):
|
||||
```
|
||||
Wir sind bei v0.9g/h Release-Vorbereitung.
|
||||
|
||||
AKTUELLER STAND:
|
||||
- Phase 0a (Goals System) + Dynamic Focus Areas v2.0: ✅ KOMPLETT
|
||||
- Vitals baseline fix: deployed (needs testing)
|
||||
- Branch: develop (6 commits ahead of main)
|
||||
- Status: BEREIT FÜR RELEASE v0.9h
|
||||
|
||||
NÄCHSTER SCHRITT:
|
||||
- Testing (Goals + Vitals)
|
||||
- Dann: Release v0.9h → Code Splitting → Phase 0b
|
||||
|
||||
LIES ZUERST:
|
||||
- docs/STATUS_2026-03-27.md (vollständiger Zustand)
|
||||
- CLAUDE.md (aktuelle Version)
|
||||
|
||||
FRAGE MICH:
|
||||
"Was ist der aktuelle Schritt?" → Dann sage ich dir Testing/Release/Splitting/Phase 0b
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Zusammenfassung - Was ist fertig?
|
||||
|
||||
### ✅ Komplett implementiert
|
||||
- Goals System (Phase 0a)
|
||||
- Strategic Layer (goal_mode, goals CRUD)
|
||||
- Tactical Layer (CustomGoalsPage)
|
||||
- Training Phases Framework (tables, backend)
|
||||
- Fitness Tests Framework (tables, backend)
|
||||
- Dynamic Focus Areas v2.0
|
||||
- 26 Basis-Bereiche in 7 Kategorien
|
||||
- User-extensible (Admin CRUD UI)
|
||||
- Many-to-Many Goals ↔ Focus Areas
|
||||
- User preferences mit Gewichtungen
|
||||
- Bug Fixes
|
||||
- Focus contributions speichern
|
||||
- Filtering (nur gewichtete Areas)
|
||||
- Vitals baseline endpoint
|
||||
|
||||
### 🔲 Noch zu tun (dokumentiert)
|
||||
- Code Splitting (goals.py → 5 Router)
|
||||
- Phase 0b (120+ Platzhalter, Score-System)
|
||||
- Issue #52 (BP dual targets)
|
||||
- Responsive UI (Issue #30)
|
||||
- Weitere Features (siehe Roadmap)
|
||||
|
||||
---
|
||||
|
||||
## 🎉 Dokumentations-Qualität
|
||||
|
||||
**Vollständigkeit:** ⭐⭐⭐⭐⭐
|
||||
- Alle wichtigen Dokumente aktualisiert
|
||||
- Neue Dokumente erstellt
|
||||
- Gitea Issues geprüft
|
||||
- Wiederanstiegspunkt klar definiert
|
||||
|
||||
**Nachvollziehbarkeit:** ⭐⭐⭐⭐⭐
|
||||
- Status-Dokument mit allen Details
|
||||
- Entscheidungen dokumentiert
|
||||
- Nächste Schritte klar beschrieben
|
||||
|
||||
**Wartbarkeit:** ⭐⭐⭐⭐⭐
|
||||
- Strukturierte Dokumentation
|
||||
- Klare Verweise zwischen Dokumenten
|
||||
- Lesereihenfolge definiert
|
||||
|
||||
---
|
||||
|
||||
**Erstellt:** 27. März 2026, 23:00 Uhr
|
||||
**Von:** Claude Code (Sonnet 4.5)
|
||||
**Commit:** eb5c099 (docs: comprehensive status update v0.9h pre-release)
|
||||
|
||||
**Du kannst jetzt:**
|
||||
✅ Sicher pausieren
|
||||
✅ Deployment testen
|
||||
✅ Jederzeit exakt an diesem Punkt weitermachen
|
||||
@@ -1,595 +0,0 @@
|
||||
# Zielesystem: Vereinheitlichte Analyse beider Fachkonzepte
|
||||
|
||||
**Datum:** 26. März 2026
|
||||
**Basis:**
|
||||
- `.claude/docs/functional/GOALS_VITALS.md` (v9e Spec)
|
||||
- `.claude/docs/functional/mitai_jinkendo_konzept_diagramme_auswertungen_v2.md`
|
||||
|
||||
---
|
||||
|
||||
## 1. Wichtige Erkenntnis: BEIDE Konzepte sind komplementär!
|
||||
|
||||
### GOALS_VITALS.md definiert:
|
||||
- **Konkrete Zielwerte** (z.B. "82kg bis 30.06.2026")
|
||||
- 8 Zieltypen (Gewicht, KF%, VO2Max, etc.)
|
||||
- Primär-/Nebenziel-Konzept
|
||||
- Trainingsphasen (automatische Erkennung)
|
||||
- Aktive Tests (Cooper, Liegestütze, etc.)
|
||||
- 13 neue KI-Platzhalter
|
||||
|
||||
### Konzept v2 definiert:
|
||||
- **Goal Modes** (strategische Ausrichtung: weight_loss, strength, etc.)
|
||||
- Score-Gewichtung je Goal Mode
|
||||
- Chart-Priorisierung je Goal Mode
|
||||
- Regelbasierte Interpretationen
|
||||
|
||||
### Zusammenspiel:
|
||||
```
|
||||
Goal MODE (v2) → "weight_loss" (strategische Ausrichtung)
|
||||
↓
|
||||
Primary GOAL (v9e) → "82kg bis 30.06.2026" (konkretes Ziel)
|
||||
Secondary GOAL → "16% Körperfett"
|
||||
↓
|
||||
Training PHASE (v9e) → "Kaloriendefizit" (automatisch erkannt)
|
||||
↓
|
||||
Score Weights (v2) → body_progress: 0.30, nutrition: 0.25, ...
|
||||
↓
|
||||
Charts (v2) → Zeigen gewichtete Scores + Fortschritt zu Zielen
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Zwei-Ebenen-Architektur
|
||||
|
||||
### Ebene 1: STRATEGIC (Goal Modes aus v2)
|
||||
**Was:** Grundsätzliche Trainingsausrichtung
|
||||
**Werte:** weight_loss, strength, endurance, recomposition, health
|
||||
**Zweck:** Bestimmt Score-Gewichtung und Interpretations-Kontext
|
||||
**Beispiel:** "Ich will Kraft aufbauen" → mode: strength
|
||||
|
||||
### Ebene 2: TACTICAL (Goal Targets aus v9e)
|
||||
**Was:** Konkrete messbare Ziele
|
||||
**Werte:** "82kg bis 30.06.2026", "VO2Max 55 ml/kg/min", "50 Liegestütze"
|
||||
**Zweck:** Fortschritts-Tracking, Prognosen, Motivation
|
||||
**Beispiel:** "Ich will 82kg wiegen" → target: Gewichtsziel
|
||||
|
||||
### Beide zusammen = Vollständiges Zielesystem
|
||||
|
||||
---
|
||||
|
||||
## 3. Überarbeitetes Datenmodell
|
||||
|
||||
### Tabelle: `profiles` (erweitern)
|
||||
```sql
|
||||
-- Strategic Goal Mode (aus v2)
|
||||
ALTER TABLE profiles ADD COLUMN goal_mode VARCHAR(50) DEFAULT 'health';
|
||||
|
||||
COMMENT ON COLUMN profiles.goal_mode IS
|
||||
'Strategic goal mode: weight_loss, strength, endurance, recomposition, health.
|
||||
Determines score weights and interpretation context.';
|
||||
```
|
||||
|
||||
### Tabelle: `goals` (NEU, aus v9e)
|
||||
```sql
|
||||
CREATE TABLE goals (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
profile_id UUID NOT NULL REFERENCES profiles(id) ON DELETE CASCADE,
|
||||
|
||||
-- Goal Classification
|
||||
goal_type VARCHAR(50) NOT NULL, -- weight, body_fat, lean_mass, vo2max, strength, flexibility, bp, rhr
|
||||
is_primary BOOLEAN DEFAULT false,
|
||||
status VARCHAR(20) DEFAULT 'active', -- draft, active, reached, abandoned, expired
|
||||
|
||||
-- Target Values
|
||||
target_value DECIMAL(10,2),
|
||||
current_value DECIMAL(10,2),
|
||||
start_value DECIMAL(10,2),
|
||||
unit VARCHAR(20), -- kg, %, ml/kg/min, bpm, mmHg, cm, reps
|
||||
|
||||
-- Timeline
|
||||
start_date DATE DEFAULT CURRENT_DATE,
|
||||
target_date DATE,
|
||||
reached_date DATE,
|
||||
|
||||
-- Metadata
|
||||
name VARCHAR(100), -- z.B. "Sommerfigur 2026"
|
||||
description TEXT,
|
||||
|
||||
-- Progress Tracking
|
||||
progress_pct DECIMAL(5,2), -- Auto-calculated: (current - start) / (target - start) * 100
|
||||
|
||||
-- Timestamps
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
|
||||
-- Constraints
|
||||
CHECK (progress_pct >= 0 AND progress_pct <= 100),
|
||||
CHECK (status IN ('draft', 'active', 'reached', 'abandoned', 'expired'))
|
||||
);
|
||||
|
||||
-- Only one primary goal per profile
|
||||
CREATE UNIQUE INDEX idx_goals_primary ON goals(profile_id, is_primary) WHERE is_primary = true;
|
||||
|
||||
-- Index for active goals lookup
|
||||
CREATE INDEX idx_goals_active ON goals(profile_id, status) WHERE status = 'active';
|
||||
```
|
||||
|
||||
### Tabelle: `training_phases` (NEU, aus v9e)
|
||||
```sql
|
||||
CREATE TABLE training_phases (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
profile_id UUID NOT NULL REFERENCES profiles(id) ON DELETE CASCADE,
|
||||
|
||||
-- Phase Type
|
||||
phase_type VARCHAR(50) NOT NULL,
|
||||
-- Werte: calorie_deficit, calorie_maintenance, calorie_surplus,
|
||||
-- conditioning, hiit, max_strength, regeneration, competition_prep
|
||||
|
||||
-- Detection
|
||||
detected_automatically BOOLEAN DEFAULT false,
|
||||
confidence_score DECIMAL(3,2), -- 0.00-1.00
|
||||
|
||||
-- Status
|
||||
status VARCHAR(20) DEFAULT 'suggested', -- suggested, confirmed, active, ended
|
||||
|
||||
-- Timeline
|
||||
start_date DATE,
|
||||
end_date DATE,
|
||||
|
||||
-- Metadata
|
||||
detection_reason TEXT, -- Why was this phase detected?
|
||||
user_notes TEXT,
|
||||
|
||||
-- Timestamps
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Only one active phase per profile
|
||||
CREATE UNIQUE INDEX idx_phases_active ON training_phases(profile_id, status) WHERE status = 'active';
|
||||
```
|
||||
|
||||
### Tabelle: `fitness_tests` (NEU, aus v9e)
|
||||
```sql
|
||||
CREATE TABLE fitness_tests (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
profile_id UUID NOT NULL REFERENCES profiles(id) ON DELETE CASCADE,
|
||||
|
||||
-- Test Type
|
||||
test_type VARCHAR(50) NOT NULL,
|
||||
-- Standard: cooper, step_test, pushups, squats, sit_reach, balance, grip_strength
|
||||
-- Custom: user_defined
|
||||
|
||||
-- Result
|
||||
result_value DECIMAL(10,2) NOT NULL,
|
||||
result_unit VARCHAR(20) NOT NULL, -- meters, bpm, reps, cm, seconds, kg
|
||||
|
||||
-- Test Date
|
||||
test_date DATE NOT NULL,
|
||||
|
||||
-- Evaluation
|
||||
norm_category VARCHAR(30), -- very_good, good, average, needs_improvement
|
||||
percentile DECIMAL(5,2), -- Where user ranks vs. norm (0-100)
|
||||
|
||||
-- Trend
|
||||
improvement_vs_last DECIMAL(10,2), -- % change from previous test
|
||||
|
||||
-- Metadata
|
||||
notes TEXT,
|
||||
conditions TEXT, -- e.g., "Nach 3h Schlaf, erkältet"
|
||||
|
||||
-- Next Test Recommendation
|
||||
recommended_retest_date DATE,
|
||||
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_fitness_tests_profile_type ON fitness_tests(profile_id, test_type, test_date DESC);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Vereinheitlichte API-Struktur
|
||||
|
||||
### Goal Modes (Strategic)
|
||||
```python
|
||||
# routers/goals.py
|
||||
|
||||
@router.get("/modes")
|
||||
def get_goal_modes():
|
||||
"""Get all strategic goal modes with score weights."""
|
||||
return GOAL_MODES # From v2 concept
|
||||
|
||||
@router.post("/set-mode")
|
||||
def set_goal_mode(goal_mode: str, session=Depends(require_auth)):
|
||||
"""Set user's strategic goal mode."""
|
||||
# Updates profiles.goal_mode
|
||||
```
|
||||
|
||||
### Goal Targets (Tactical)
|
||||
```python
|
||||
@router.get("/targets")
|
||||
def get_goal_targets(session=Depends(require_auth)):
|
||||
"""Get all active goal targets."""
|
||||
profile_id = session['profile_id']
|
||||
# Returns list from goals table
|
||||
# Includes: primary + all secondary goals
|
||||
|
||||
@router.post("/targets")
|
||||
def create_goal_target(goal: GoalCreate, session=Depends(require_auth)):
|
||||
"""Create a new goal target."""
|
||||
# Inserts into goals table
|
||||
# Auto-calculates progress_pct
|
||||
|
||||
@router.get("/targets/{goal_id}")
|
||||
def get_goal_detail(goal_id: str, session=Depends(require_auth)):
|
||||
"""Get detailed goal info with history."""
|
||||
# Returns goal + progress history + prognosis
|
||||
|
||||
@router.put("/targets/{goal_id}/progress")
|
||||
def update_goal_progress(goal_id: str, session=Depends(require_auth)):
|
||||
"""Recalculate goal progress."""
|
||||
# Auto-called after new measurements
|
||||
# Updates current_value, progress_pct
|
||||
|
||||
@router.post("/targets/{goal_id}/reach")
|
||||
def mark_goal_reached(goal_id: str, session=Depends(require_auth)):
|
||||
"""Mark goal as reached."""
|
||||
# Sets status='reached', reached_date=today
|
||||
```
|
||||
|
||||
### Training Phases
|
||||
```python
|
||||
@router.get("/phases/current")
|
||||
def get_current_phase(session=Depends(require_auth)):
|
||||
"""Get active training phase."""
|
||||
|
||||
@router.get("/phases/detect")
|
||||
def detect_phase(session=Depends(require_auth)):
|
||||
"""Run phase detection algorithm."""
|
||||
# Analyzes last 14 days
|
||||
# Returns suggested phase + confidence + reasoning
|
||||
|
||||
@router.post("/phases/confirm")
|
||||
def confirm_phase(phase_id: str, session=Depends(require_auth)):
|
||||
"""Confirm detected phase."""
|
||||
# Sets status='active'
|
||||
```
|
||||
|
||||
### Fitness Tests
|
||||
```python
|
||||
@router.get("/tests/types")
|
||||
def get_test_types():
|
||||
"""Get all available fitness tests."""
|
||||
|
||||
@router.post("/tests/{test_type}/execute")
|
||||
def record_test_result(
|
||||
test_type: str,
|
||||
result_value: float,
|
||||
result_unit: str,
|
||||
session=Depends(require_auth)
|
||||
):
|
||||
"""Record a fitness test result."""
|
||||
# Inserts into fitness_tests
|
||||
# Auto-calculates norm_category, percentile, improvement
|
||||
|
||||
@router.get("/tests/due")
|
||||
def get_due_tests(session=Depends(require_auth)):
|
||||
"""Get tests that are due for retesting."""
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Neue KI-Platzhalter (kombiniert aus beiden Konzepten)
|
||||
|
||||
### Strategic (aus v2)
|
||||
```python
|
||||
{{goal_mode}} # "weight_loss"
|
||||
{{goal_mode_label}} # "Gewichtsreduktion"
|
||||
{{goal_mode_description}} # "Fettabbau bei Erhalt der Magermasse"
|
||||
```
|
||||
|
||||
### Tactical - Primary Goal (aus v9e)
|
||||
```python
|
||||
{{primary_goal_type}} # "weight"
|
||||
{{primary_goal_name}} # "Sommerfigur 2026"
|
||||
{{primary_goal_target}} # "82 kg bis 30.06.2026"
|
||||
{{primary_goal_current}} # "85.2 kg"
|
||||
{{primary_goal_start}} # "86.1 kg"
|
||||
{{primary_goal_progress_pct}} # "72%"
|
||||
{{primary_goal_progress_text}} # "72% erreicht (4 kg von 5,5 kg)"
|
||||
{{primary_goal_days_remaining}} # "45 Tage"
|
||||
{{primary_goal_prognosis}} # "Ziel voraussichtlich in 6 Wochen erreicht (3 Wochen früher!)"
|
||||
{{primary_goal_on_track}} # "true"
|
||||
```
|
||||
|
||||
### Tactical - Secondary Goals (aus v9e)
|
||||
```python
|
||||
{{secondary_goals_count}} # "2"
|
||||
{{secondary_goals_list}} # "16% Körperfett, VO2Max 55 ml/kg/min"
|
||||
{{secondary_goal_1_type}} # "body_fat"
|
||||
{{secondary_goal_1_progress}} # "45%"
|
||||
```
|
||||
|
||||
### Training Phase (aus v9e)
|
||||
```python
|
||||
{{current_phase}} # "calorie_deficit"
|
||||
{{current_phase_label}} # "Kaloriendefizit"
|
||||
{{phase_since}} # "seit 14 Tagen"
|
||||
{{phase_confidence}} # "0.92"
|
||||
{{phase_recommendation}} # "Krafttraining erhalten, Cardio moderat, Proteinzufuhr 2g/kg"
|
||||
{{phase_detected_automatically}} # "true"
|
||||
```
|
||||
|
||||
### Fitness Tests (aus v9e)
|
||||
```python
|
||||
{{test_last_cooper}} # "2.800m (VO2Max ~52) vor 3 Wochen"
|
||||
{{test_last_cooper_date}} # "2026-03-05"
|
||||
{{test_last_cooper_result}} # "2800"
|
||||
{{test_last_cooper_vo2max}} # "52.3"
|
||||
{{test_last_cooper_category}} # "good"
|
||||
{{test_due_list}} # "Sit & Reach (seit 5 Wochen), Liegestütze (seit 4 Wochen)"
|
||||
{{test_next_recommended}} # "Cooper-Test (in 2 Wochen fällig)"
|
||||
{{fitness_score_overall}} # "72/100"
|
||||
{{fitness_score_endurance}} # "good"
|
||||
{{fitness_score_strength}} # "average"
|
||||
{{fitness_score_flexibility}} # "needs_improvement"
|
||||
```
|
||||
|
||||
### GESAMT: 35+ neue Platzhalter aus v9e
|
||||
Plus die 84 aus v2 = **120+ neue Platzhalter total**
|
||||
|
||||
---
|
||||
|
||||
## 6. Überarbeitete Implementierungs-Roadmap
|
||||
|
||||
### Phase 0a: Minimal Goal System (3-4h) ⭐ **JETZT**
|
||||
|
||||
**Strategic Layer:**
|
||||
- DB: `goal_mode` in profiles
|
||||
- Backend: GOAL_MODES aus v2
|
||||
- API: GET/SET goal mode
|
||||
- UI: Goal Mode Selector (5 Modi)
|
||||
|
||||
**Tactical Layer:**
|
||||
- DB: `goals` table
|
||||
- API: CRUD für goal targets
|
||||
- UI: Goal Management Page (minimal)
|
||||
- Liste aktiver Ziele
|
||||
- Fortschrittsbalken
|
||||
- "+ Neues Ziel" Button
|
||||
|
||||
**Aufwand:** 3-4h (erweitert wegen Tactical Layer)
|
||||
|
||||
---
|
||||
|
||||
### Phase 0b: Goal-Aware Placeholders (16-20h)
|
||||
|
||||
**Strategic Placeholders:**
|
||||
```python
|
||||
{{goal_mode}} # Aus profiles.goal_mode
|
||||
{{goal_mode_label}} # Aus GOAL_MODES mapping
|
||||
```
|
||||
|
||||
**Tactical Placeholders:**
|
||||
```python
|
||||
{{primary_goal_type}} # Aus goals WHERE is_primary=true
|
||||
{{primary_goal_target}}
|
||||
{{primary_goal_progress_pct}}
|
||||
{{primary_goal_prognosis}} # Berechnet aus Trend
|
||||
```
|
||||
|
||||
**Score Calculations (goal-aware):**
|
||||
```python
|
||||
def get_body_progress_score(profile_id: str) -> str:
|
||||
profile = get_profile_data(profile_id)
|
||||
goal_mode = profile.get('goal_mode', 'health')
|
||||
|
||||
# Get weights from v2 concept
|
||||
weights = GOAL_MODES[goal_mode]['score_weights']
|
||||
|
||||
# Calculate sub-scores
|
||||
fm_score = calculate_fm_progress(profile_id)
|
||||
lbm_score = calculate_lbm_progress(profile_id)
|
||||
|
||||
# Weight according to goal mode
|
||||
if goal_mode == 'weight_loss':
|
||||
total = 0.50 * fm_score + 0.30 * weight_score + 0.20 * lbm_score
|
||||
elif goal_mode == 'strength':
|
||||
total = 0.60 * lbm_score + 0.30 * fm_score + 0.10 * weight_score
|
||||
# ...
|
||||
|
||||
return f"{int(total)}/100"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 0c: Training Phases (4-6h) **PARALLEL**
|
||||
|
||||
**DB:**
|
||||
- `training_phases` table
|
||||
|
||||
**Detection Algorithm:**
|
||||
```python
|
||||
def detect_current_phase(profile_id: str) -> dict:
|
||||
"""Detects training phase from last 14 days of data."""
|
||||
|
||||
# Analyze data
|
||||
kcal_balance = get_kcal_balance_14d(profile_id)
|
||||
training_dist = get_training_distribution_14d(profile_id)
|
||||
weight_trend = get_weight_trend_14d(profile_id)
|
||||
hrv_avg = get_hrv_avg_14d(profile_id)
|
||||
volume_change = get_volume_change_14d(profile_id)
|
||||
|
||||
# Phase Detection Rules
|
||||
if kcal_balance < -300 and weight_trend < 0:
|
||||
return {
|
||||
'phase': 'calorie_deficit',
|
||||
'confidence': 0.85,
|
||||
'reason': f'Avg kcal balance {kcal_balance}/day, weight -0.5kg/week'
|
||||
}
|
||||
|
||||
if training_dist['endurance'] > 60 and vo2max_trend > 0:
|
||||
return {
|
||||
'phase': 'conditioning',
|
||||
'confidence': 0.78,
|
||||
'reason': f'{training_dist["endurance"]}% cardio, VO2max improving'
|
||||
}
|
||||
|
||||
if volume_change < -40 and hrv_avg < hrv_baseline * 0.85:
|
||||
return {
|
||||
'phase': 'regeneration',
|
||||
'confidence': 0.92,
|
||||
'reason': f'Volume -40%, HRV below baseline, recovery needed'
|
||||
}
|
||||
|
||||
# Default
|
||||
return {
|
||||
'phase': 'maintenance',
|
||||
'confidence': 0.50,
|
||||
'reason': 'No clear pattern detected'
|
||||
}
|
||||
```
|
||||
|
||||
**API:**
|
||||
- GET /phases/current
|
||||
- GET /phases/detect
|
||||
- POST /phases/confirm
|
||||
|
||||
**UI:**
|
||||
- Dashboard Badge: "📊 Phase: Kaloriendefizit"
|
||||
- Phase Detection Banner: "Wir haben erkannt: Kaloriendefizit-Phase. Stimmt das?"
|
||||
|
||||
---
|
||||
|
||||
### Phase 0d: Fitness Tests (4-6h) **SPÄTER**
|
||||
|
||||
**DB:**
|
||||
- `fitness_tests` table
|
||||
|
||||
**Test Definitions:**
|
||||
```python
|
||||
FITNESS_TESTS = {
|
||||
'cooper': {
|
||||
'name': 'Cooper-Test',
|
||||
'description': '12 Minuten laufen, maximale Distanz',
|
||||
'unit': 'meters',
|
||||
'interval_weeks': 6,
|
||||
'norm_tables': { # Simplified
|
||||
'male_30-39': {'very_good': 2800, 'good': 2500, 'average': 2200},
|
||||
'female_30-39': {'very_good': 2500, 'good': 2200, 'average': 1900}
|
||||
},
|
||||
'calculate_vo2max': lambda distance: (distance - 504.9) / 44.73
|
||||
},
|
||||
'pushups': {
|
||||
'name': 'Liegestütze-Test',
|
||||
'description': 'Maximale Anzahl ohne Pause',
|
||||
'unit': 'reps',
|
||||
'interval_weeks': 4,
|
||||
'norm_tables': { ... }
|
||||
},
|
||||
# ... weitere Tests
|
||||
}
|
||||
```
|
||||
|
||||
**UI:**
|
||||
- Tests Page mit Testliste
|
||||
- Test Execution Flow (Anleitung → Eingabe → Auswertung)
|
||||
- Test History mit Trend-Chart
|
||||
|
||||
---
|
||||
|
||||
## 7. Priorisierte Reihenfolge
|
||||
|
||||
### SOFORT (3-4h)
|
||||
**Phase 0a:** Minimal Goal System (Strategic + Tactical)
|
||||
- Basis für alles andere
|
||||
- User kann Ziele setzen
|
||||
- Score-Berechnungen können goal_mode nutzen
|
||||
|
||||
### DIESE WOCHE (16-20h)
|
||||
**Phase 0b:** Goal-Aware Placeholders
|
||||
- 84 Platzhalter aus v2
|
||||
- 35+ Platzhalter aus v9e
|
||||
- **TOTAL: 120+ Platzhalter**
|
||||
|
||||
### PARALLEL (4-6h)
|
||||
**Phase 0c:** Training Phases
|
||||
- Automatische Erkennung
|
||||
- Phase-aware Recommendations
|
||||
|
||||
### SPÄTER (4-6h)
|
||||
**Phase 0d:** Fitness Tests
|
||||
- Enhancement, nicht kritisch für Charts
|
||||
|
||||
---
|
||||
|
||||
## 8. Kritische Erkenntnisse
|
||||
|
||||
### 1. GOALS_VITALS.md ist detaillierter
|
||||
- Konkrete Implementierungs-Specs
|
||||
- DB-Schema-Vorschläge
|
||||
- 13 definierte KI-Platzhalter
|
||||
- **ABER:** Fehlt Score-Gewichtung (das hat v2)
|
||||
|
||||
### 2. Konzept v2 ist strategischer
|
||||
- Goal Modes mit Score-Gewichtung
|
||||
- Chart-Interpretationen
|
||||
- Regelbasierte Logik
|
||||
- **ABER:** Fehlt konkrete Ziel-Tracking (das hat v9e)
|
||||
|
||||
### 3. Beide zusammen = Vollständig
|
||||
- v2 (Goal Modes) + v9e (Goal Targets) = Komplettes Zielesystem
|
||||
- v2 (Scores) + v9e (Tests) = Vollständiges Assessment
|
||||
- v2 (Charts) + v9e (Phases) = Kontext-aware Visualisierung
|
||||
|
||||
### 4. Meine ursprüngliche Analyse war incomplete
|
||||
- Ich hatte nur v2 betrachtet
|
||||
- v9e fügt kritische Details hinzu
|
||||
- **Neue Gesamt-Schätzung:** 120+ Platzhalter (statt 84)
|
||||
|
||||
---
|
||||
|
||||
## 9. Aktualisierte Empfehlung
|
||||
|
||||
**JA zu Phase 0a (Minimal Goal System), ABER erweitert:**
|
||||
|
||||
### Was Phase 0a umfassen muss (3-4h):
|
||||
|
||||
1. **Strategic Layer (aus v2):**
|
||||
- goal_mode in profiles
|
||||
- GOAL_MODES Definition
|
||||
- GET/SET endpoints
|
||||
|
||||
2. **Tactical Layer (aus v9e):**
|
||||
- goals Tabelle
|
||||
- CRUD für Ziele
|
||||
- Fortschritts-Berechnung
|
||||
|
||||
3. **UI:**
|
||||
- Goal Mode Selector (Settings)
|
||||
- Goal Management Page (Basic)
|
||||
- Dashboard Goal Widget
|
||||
|
||||
### Was kann warten:
|
||||
- Training Phases → Phase 0c (parallel)
|
||||
- Fitness Tests → Phase 0d (später)
|
||||
- Vollständige Test-Integration → v9f
|
||||
|
||||
---
|
||||
|
||||
## 10. Nächste Schritte
|
||||
|
||||
**JETZT:**
|
||||
1. Phase 0a implementieren (3-4h)
|
||||
- Strategic + Tactical Goal System
|
||||
2. Dann Phase 0b (Goal-Aware Placeholders, 16-20h)
|
||||
3. Parallel Phase 0c (Training Phases, 4-6h)
|
||||
|
||||
**Soll ich mit Phase 0a (erweitert) starten?**
|
||||
- Beide Goal-Konzepte integriert
|
||||
- Ready für 120+ Platzhalter
|
||||
- Basis für intelligentes Coach-System
|
||||
|
||||
**Commit:** ae93b9d (muss aktualisiert werden)
|
||||
**Neue Analyse:** GOALS_SYSTEM_UNIFIED_ANALYSIS.md
|
||||
@@ -1,538 +0,0 @@
|
||||
# Zielesystem: Prioritäts-Analyse
|
||||
|
||||
**Datum:** 26. März 2026
|
||||
**Frage:** Zielesystem vor oder nach Platzhaltern/Charts?
|
||||
**Antwort:** **Minimales Zielesystem VOR Platzhaltern, volles System parallel**
|
||||
|
||||
---
|
||||
|
||||
## 1. Kritische Erkenntnis aus Fachkonzept
|
||||
|
||||
### Zitat Fachkonzept (Zeile 20-28):
|
||||
> **Wichtig ist, dass das System zielabhängig interpretiert:**
|
||||
> - Gewichtsreduktion
|
||||
> - Muskel-/Kraftaufbau
|
||||
> - Konditions-/Ausdaueraufbau
|
||||
> - Körperrekomposition
|
||||
> - allgemeine Gesundheit
|
||||
>
|
||||
> **Dasselbe Rohsignal kann je nach Ziel anders bewertet werden.**
|
||||
> Ein Kaloriendefizit ist z. B. bei Gewichtsreduktion oft positiv,
|
||||
> bei Kraftaufbau aber potenziell hinderlich.
|
||||
|
||||
### Konsequenz
|
||||
❌ **Charts OHNE Zielesystem = falsche Interpretationen**
|
||||
✅ **Charts MIT Zielesystem = korrekte, zielspezifische Aussagen**
|
||||
|
||||
---
|
||||
|
||||
## 2. Abhängigkeits-Matrix
|
||||
|
||||
### Was hängt vom Zielesystem ab?
|
||||
|
||||
| Komponente | Zielabhängig? | Beispiel |
|
||||
|------------|---------------|----------|
|
||||
| **Rohdaten-Charts** | ❌ Nein | Gewichtsverlauf, Umfänge-Trend |
|
||||
| **Score-Gewichtung** | ✅ JA | Body Progress Score: 30% bei weight_loss, 20% bei strength |
|
||||
| **Interpretationen** | ✅ JA | Kaloriendefizit: "gut" bei weight_loss, "kritisch" bei strength |
|
||||
| **Hinweise** | ✅ JA | "Gewicht stagniert" → bei weight_loss: Warnung, bei strength: egal |
|
||||
| **Platzhalter (Berechnungen)** | ⚠️ TEILWEISE | Trends: Nein, Scores: JA |
|
||||
| **KI-Prompts** | ✅ JA | Analyse-Kontext ändert sich komplett |
|
||||
|
||||
### Fachkonzept: Score-Gewichtung (Zeile 185-216)
|
||||
|
||||
```yaml
|
||||
score_weights:
|
||||
weight_loss:
|
||||
body_progress: 0.30 # Körper wichtig
|
||||
nutrition: 0.25
|
||||
activity: 0.20
|
||||
recovery: 0.15
|
||||
health_risk: 0.10
|
||||
|
||||
strength:
|
||||
body_progress: 0.20
|
||||
nutrition: 0.25
|
||||
activity: 0.30 # Training wichtiger
|
||||
recovery: 0.20
|
||||
health_risk: 0.05 # Weniger kritisch
|
||||
|
||||
endurance:
|
||||
body_progress: 0.10 # Körper unwichtiger
|
||||
activity: 0.35 # Training am wichtigsten
|
||||
recovery: 0.25 # Recovery sehr wichtig
|
||||
```
|
||||
|
||||
### Beispiel: Body Progress Score
|
||||
|
||||
**OHNE Zielesystem:**
|
||||
```python
|
||||
def calculate_body_progress_score():
|
||||
# Generisch, für niemanden wirklich passend
|
||||
fm_delta_score = calculate_fm_change() # -5kg
|
||||
lbm_delta_score = calculate_lbm_change() # -2kg
|
||||
return (fm_delta_score + lbm_delta_score) / 2
|
||||
# Score: 50/100 (FM gut runter, aber LBM auch runter)
|
||||
```
|
||||
|
||||
**MIT Zielesystem:**
|
||||
```python
|
||||
def calculate_body_progress_score(goal_mode):
|
||||
fm_delta_score = calculate_fm_change() # -5kg
|
||||
lbm_delta_score = calculate_lbm_change() # -2kg
|
||||
|
||||
if goal_mode == "weight_loss":
|
||||
# FM runter: sehr gut, LBM runter: tolerierbar wenn nicht zu viel
|
||||
return 0.70 * fm_delta_score + 0.30 * lbm_delta_score
|
||||
# Score: 78/100 (FM wichtiger, LBM-Verlust weniger kritisch)
|
||||
|
||||
elif goal_mode == "strength":
|
||||
# FM runter: ok, LBM runter: SEHR SCHLECHT
|
||||
return 0.30 * fm_delta_score + 0.70 * lbm_delta_score
|
||||
# Score: 32/100 (LBM-Verlust ist Hauptproblem!)
|
||||
|
||||
elif goal_mode == "recomposition":
|
||||
# FM runter: gut, LBM runter: schlecht
|
||||
return 0.50 * fm_delta_score + 0.50 * lbm_delta_score
|
||||
# Score: 50/100 (ausgewogen bewertet)
|
||||
```
|
||||
|
||||
**Ergebnis:**
|
||||
- Gleiche Daten (-5kg FM, -2kg LBM)
|
||||
- ABER: 78/100 bei weight_loss, 32/100 bei strength
|
||||
- **Ohne Ziel: völlig falsche Bewertung!**
|
||||
|
||||
---
|
||||
|
||||
## 3. Ziel-Erkennung aus Daten
|
||||
|
||||
### Fachkonzept erwähnt dies NICHT explizit, aber logisch ableitbar:
|
||||
|
||||
**Pattern-Erkennung:**
|
||||
```python
|
||||
def suggest_goal_from_data(profile_id):
|
||||
"""Schlägt Ziel basierend auf Daten-Mustern vor."""
|
||||
|
||||
# Analyse der letzten 28 Tage
|
||||
training_types = get_training_distribution_28d(profile_id)
|
||||
nutrition = get_nutrition_pattern_28d(profile_id)
|
||||
body_changes = get_body_changes_28d(profile_id)
|
||||
|
||||
# Pattern 1: Viel Kraft + viel Protein + LBM steigt
|
||||
if (training_types['strength'] > 60% and
|
||||
nutrition['protein_g_per_kg'] > 1.8 and
|
||||
body_changes['lbm_trend'] > 0):
|
||||
return {
|
||||
'suggested_goal': 'strength',
|
||||
'confidence': 'high',
|
||||
'reasoning': 'Krafttraining dominant + hohe Proteinzufuhr + Muskelaufbau erkennbar'
|
||||
}
|
||||
|
||||
# Pattern 2: Viel Cardio + Kaloriendefizit + Gewicht sinkt
|
||||
if (training_types['endurance'] > 50% and
|
||||
nutrition['kcal_balance_avg'] < -300 and
|
||||
body_changes['weight_trend'] < 0):
|
||||
return {
|
||||
'suggested_goal': 'weight_loss',
|
||||
'confidence': 'high',
|
||||
'reasoning': 'Ausdauertraining + Kaloriendefizit + Gewichtsverlust'
|
||||
}
|
||||
|
||||
# Pattern 3: Mixed Training + Protein hoch + Gewicht stabil + Rekomposition
|
||||
if (training_types['mixed'] == True and
|
||||
nutrition['protein_g_per_kg'] > 1.6 and
|
||||
abs(body_changes['weight_trend']) < 0.05 and
|
||||
body_changes['fm_trend'] < 0 and
|
||||
body_changes['lbm_trend'] > 0):
|
||||
return {
|
||||
'suggested_goal': 'recomposition',
|
||||
'confidence': 'medium',
|
||||
'reasoning': 'Gemischtes Training + Rekomposition sichtbar (FM↓, LBM↑)'
|
||||
}
|
||||
|
||||
# Default: Nicht genug Muster erkennbar
|
||||
return {
|
||||
'suggested_goal': 'health',
|
||||
'confidence': 'low',
|
||||
'reasoning': 'Keine klaren Muster erkennbar, gesundheitsorientiertes Training angenommen'
|
||||
}
|
||||
```
|
||||
|
||||
### Voraussetzungen für Ziel-Erkennung:
|
||||
1. ✅ Mindestens 21-28 Tage Daten
|
||||
2. ✅ Training-Type Distribution
|
||||
3. ✅ Ernährungs-Pattern
|
||||
4. ✅ Körper-Trends (FM, LBM, Gewicht)
|
||||
5. ✅ Berechnet → **braucht Platzhalter!**
|
||||
|
||||
**ABER:** Ziel-Erkennung ist **nachgelagert**, nicht Voraussetzung.
|
||||
|
||||
---
|
||||
|
||||
## 4. Empfohlene Implementierungs-Strategie
|
||||
|
||||
### Hybrid-Ansatz: Minimal-Ziele SOFORT, Voll-System parallel
|
||||
|
||||
## Phase 0a: Minimal-Zielesystem (2-3h) ⭐ **START HIER**
|
||||
|
||||
### Ziel
|
||||
User kann manuell Ziel setzen, System nutzt es für Berechnungen.
|
||||
|
||||
### Implementierung
|
||||
|
||||
**1. DB-Schema erweitern:**
|
||||
```sql
|
||||
-- Migration 023
|
||||
ALTER TABLE profiles ADD COLUMN goal_mode VARCHAR(50) DEFAULT 'health';
|
||||
ALTER TABLE profiles ADD COLUMN goal_weight DECIMAL(5,2);
|
||||
ALTER TABLE profiles ADD COLUMN goal_bf_pct DECIMAL(4,1);
|
||||
ALTER TABLE profiles ADD COLUMN goal_set_date DATE;
|
||||
ALTER TABLE profiles ADD COLUMN goal_target_date DATE;
|
||||
|
||||
COMMENT ON COLUMN profiles.goal_mode IS
|
||||
'Primary goal: weight_loss, strength, endurance, recomposition, health';
|
||||
```
|
||||
|
||||
**2. Goal-Mode Konstanten:**
|
||||
```python
|
||||
# backend/goals.py (NEU)
|
||||
GOAL_MODES = {
|
||||
'weight_loss': {
|
||||
'label': 'Gewichtsreduktion',
|
||||
'description': 'Fettabbau bei Erhalt der Magermasse',
|
||||
'score_weights': {
|
||||
'body_progress': 0.30,
|
||||
'nutrition': 0.25,
|
||||
'activity': 0.20,
|
||||
'recovery': 0.15,
|
||||
'health_risk': 0.10
|
||||
},
|
||||
'focus_areas': ['fettmasse', 'gewichtstrend', 'kalorienbilanz', 'protein_sicherung']
|
||||
},
|
||||
'strength': {
|
||||
'label': 'Kraftaufbau',
|
||||
'description': 'Muskelaufbau und Kraftsteigerung',
|
||||
'score_weights': {
|
||||
'body_progress': 0.20,
|
||||
'nutrition': 0.25,
|
||||
'activity': 0.30,
|
||||
'recovery': 0.20,
|
||||
'health_risk': 0.05
|
||||
},
|
||||
'focus_areas': ['trainingsqualitaet', 'protein', 'lbm', 'recovery']
|
||||
},
|
||||
'endurance': {
|
||||
'label': 'Ausdaueraufbau',
|
||||
'description': 'Kondition und VO2max verbessern',
|
||||
'score_weights': {
|
||||
'body_progress': 0.10,
|
||||
'nutrition': 0.20,
|
||||
'activity': 0.35,
|
||||
'recovery': 0.25,
|
||||
'health_risk': 0.10
|
||||
},
|
||||
'focus_areas': ['trainingsvolumen', 'intensitaetsverteilung', 'vo2max', 'recovery']
|
||||
},
|
||||
'recomposition': {
|
||||
'label': 'Körperrekomposition',
|
||||
'description': 'Fettabbau bei gleichzeitigem Muskelaufbau',
|
||||
'score_weights': {
|
||||
'body_progress': 0.30,
|
||||
'nutrition': 0.25,
|
||||
'activity': 0.25,
|
||||
'recovery': 0.15,
|
||||
'health_risk': 0.05
|
||||
},
|
||||
'focus_areas': ['lbm', 'fettmasse', 'protein', 'trainingsqualitaet']
|
||||
},
|
||||
'health': {
|
||||
'label': 'Allgemeine Gesundheit',
|
||||
'description': 'Ausgeglichenes Gesundheits- und Fitnesstraining',
|
||||
'score_weights': {
|
||||
'body_progress': 0.20,
|
||||
'nutrition': 0.20,
|
||||
'activity': 0.20,
|
||||
'recovery': 0.20,
|
||||
'health_risk': 0.20
|
||||
},
|
||||
'focus_areas': ['bewegung', 'blutdruck', 'schlaf', 'gewicht', 'regelmaessigkeit']
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**3. API-Endpoint:**
|
||||
```python
|
||||
# routers/goals.py (NEU)
|
||||
from fastapi import APIRouter, Depends
|
||||
from auth import require_auth
|
||||
from goals import GOAL_MODES
|
||||
|
||||
router = APIRouter(prefix="/api/goals", tags=["goals"])
|
||||
|
||||
@router.get("/modes")
|
||||
def get_goal_modes():
|
||||
"""Return all available goal modes with descriptions."""
|
||||
return GOAL_MODES
|
||||
|
||||
@router.get("/current")
|
||||
def get_current_goal(session: dict = Depends(require_auth)):
|
||||
"""Get user's current goal settings."""
|
||||
profile_id = session['profile_id']
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute(
|
||||
"""SELECT goal_mode, goal_weight, goal_bf_pct,
|
||||
goal_set_date, goal_target_date
|
||||
FROM profiles WHERE id=%s""",
|
||||
(profile_id,)
|
||||
)
|
||||
row = r2d(cur.fetchone())
|
||||
return {
|
||||
**row,
|
||||
'mode_config': GOAL_MODES.get(row['goal_mode'], GOAL_MODES['health'])
|
||||
}
|
||||
|
||||
@router.post("/set")
|
||||
def set_goal(
|
||||
goal_mode: str,
|
||||
goal_weight: Optional[float] = None,
|
||||
goal_bf_pct: Optional[float] = None,
|
||||
target_date: Optional[str] = None,
|
||||
session: dict = Depends(require_auth)
|
||||
):
|
||||
"""Set user's goal."""
|
||||
if goal_mode not in GOAL_MODES:
|
||||
raise HTTPException(400, f"Invalid goal_mode. Must be one of: {list(GOAL_MODES.keys())}")
|
||||
|
||||
profile_id = session['profile_id']
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute(
|
||||
"""UPDATE profiles
|
||||
SET goal_mode=%s, goal_weight=%s, goal_bf_pct=%s,
|
||||
goal_set_date=CURRENT_DATE, goal_target_date=%s
|
||||
WHERE id=%s""",
|
||||
(goal_mode, goal_weight, goal_bf_pct, target_date, profile_id)
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
return {"success": True, "goal_mode": goal_mode}
|
||||
```
|
||||
|
||||
**4. Frontend UI (Settings.jsx):**
|
||||
```jsx
|
||||
// Minimal Goal Selector
|
||||
function GoalSettings() {
|
||||
const [goalModes, setGoalModes] = useState({})
|
||||
const [currentGoal, setCurrentGoal] = useState(null)
|
||||
const [selectedMode, setSelectedMode] = useState('health')
|
||||
|
||||
useEffect(() => {
|
||||
loadGoalModes()
|
||||
loadCurrentGoal()
|
||||
}, [])
|
||||
|
||||
const loadGoalModes = async () => {
|
||||
const modes = await api.getGoalModes()
|
||||
setGoalModes(modes)
|
||||
}
|
||||
|
||||
const loadCurrentGoal = async () => {
|
||||
const goal = await api.getCurrentGoal()
|
||||
setCurrentGoal(goal)
|
||||
setSelectedMode(goal.goal_mode || 'health')
|
||||
}
|
||||
|
||||
const saveGoal = async () => {
|
||||
await api.setGoal({
|
||||
goal_mode: selectedMode,
|
||||
goal_weight: goalWeight,
|
||||
goal_bf_pct: goalBfPct,
|
||||
target_date: targetDate
|
||||
})
|
||||
loadCurrentGoal()
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card">
|
||||
<h2>🎯 Trainingsziel</h2>
|
||||
|
||||
<div className="form-row">
|
||||
<label>Hauptziel</label>
|
||||
<select value={selectedMode} onChange={e => setSelectedMode(e.target.value)}>
|
||||
{Object.entries(goalModes).map(([key, config]) => (
|
||||
<option key={key} value={key}>
|
||||
{config.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<p style={{fontSize: 12, color: 'var(--text3)'}}>
|
||||
{goalModes[selectedMode]?.description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{(selectedMode === 'weight_loss' || selectedMode === 'recomposition') && (
|
||||
<div className="form-row">
|
||||
<label>Zielgewicht (optional)</label>
|
||||
<input type="number" step="0.1" value={goalWeight} onChange={...} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button onClick={saveGoal}>Ziel speichern</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### Aufwand: 2-3h
|
||||
- 1h: DB + Backend
|
||||
- 1h: Frontend UI
|
||||
- 0.5h: Testing
|
||||
|
||||
---
|
||||
|
||||
## Phase 0b: Goal-Aware Platzhalter (16-20h)
|
||||
|
||||
**Alle 84 Platzhalter implementieren, ABER:**
|
||||
- Score-Berechnungen nutzen `goal_mode` von Anfang an
|
||||
- Beispiel:
|
||||
|
||||
```python
|
||||
def get_body_progress_score(profile_id: str) -> str:
|
||||
"""Body Progress Score (0-100, goal-dependent)."""
|
||||
profile = get_profile_data(profile_id)
|
||||
goal_mode = profile.get('goal_mode', 'health')
|
||||
|
||||
# Hole Gewichte aus goals.GOAL_MODES
|
||||
weights = GOAL_MODES[goal_mode]['score_weights']
|
||||
|
||||
# Berechne Sub-Scores
|
||||
fm_score = calculate_fm_progress(profile_id)
|
||||
lbm_score = calculate_lbm_progress(profile_id)
|
||||
weight_score = calculate_weight_progress(profile_id, goal_mode)
|
||||
|
||||
# Gewichte nach Ziel
|
||||
if goal_mode == 'weight_loss':
|
||||
total = (0.50 * fm_score + 0.30 * weight_score + 0.20 * lbm_score)
|
||||
elif goal_mode == 'strength':
|
||||
total = (0.60 * lbm_score + 0.30 * fm_score + 0.10 * weight_score)
|
||||
elif goal_mode == 'recomposition':
|
||||
total = (0.45 * fm_score + 0.45 * lbm_score + 0.10 * weight_score)
|
||||
else: # health, endurance
|
||||
total = (0.40 * weight_score + 0.30 * fm_score + 0.30 * lbm_score)
|
||||
|
||||
return f"{int(total)}/100"
|
||||
```
|
||||
|
||||
**Resultat:**
|
||||
- Charts bekommen von Anfang an **korrekte** Scores
|
||||
- Keine Umarbeitung nötig später
|
||||
- System ist "smart" ab Tag 1
|
||||
|
||||
---
|
||||
|
||||
## Phase 2+: Vollständiges Zielesystem (6-8h)
|
||||
|
||||
**Features:**
|
||||
1. **Ziel-Erkennung aus Daten**
|
||||
- Pattern-Analyse (wie oben)
|
||||
- Vorschlag mit Confidence
|
||||
- "Passt dein Ziel noch?" Check
|
||||
|
||||
2. **Sekundäre Ziele**
|
||||
- `goal_mode` = primary
|
||||
- `secondary_goals[]` = weitere Schwerpunkte
|
||||
- Gewichtung: 70% primary, 30% secondary
|
||||
|
||||
3. **Ziel-Progression Tracking**
|
||||
- Fortschritt zum Ziel (%)
|
||||
- Geschätzte Erreichung (Datum)
|
||||
- Anpassungs-Vorschläge
|
||||
|
||||
4. **Goal-Aware Charts**
|
||||
- Priorisierung nach goal_relevance
|
||||
- Dashboard zeigt ziel-spezifische Charts zuerst
|
||||
|
||||
5. **Goal-Aware KI**
|
||||
- Prompt-Kontext enthält goal_mode
|
||||
- KI interpretiert zielspezifisch
|
||||
|
||||
---
|
||||
|
||||
## 5. Entscheidungs-Matrix
|
||||
|
||||
### Option A: Zielesystem komplett ZUERST
|
||||
**Aufwand:** 10-12h
|
||||
**Pro:**
|
||||
- Alles konsistent von Anfang an
|
||||
- Keine Umarbeitung
|
||||
**Contra:**
|
||||
- Verzögert Platzhalter-Start
|
||||
- Ziel-Erkennung braucht Platzhalter (Henne-Ei)
|
||||
|
||||
### Option B: Platzhalter ZUERST, dann Ziele
|
||||
**Aufwand:** 16-20h + später Rework
|
||||
**Pro:**
|
||||
- Schneller Start
|
||||
**Contra:**
|
||||
- ALLE Scores falsch gewichtet
|
||||
- Komplette Umarbeitung nötig
|
||||
- User sehen falsche Werte
|
||||
|
||||
### Option C: HYBRID ⭐ **EMPFOHLEN**
|
||||
**Aufwand:** 2-3h (Minimal-Ziele) + 16-20h (Goal-Aware Platzhalter) + später 6-8h (Voll-System)
|
||||
**Pro:**
|
||||
- ✅ Beste aus beiden Welten
|
||||
- ✅ Korrekte Scores von Anfang an
|
||||
- ✅ Keine Umarbeitung
|
||||
- ✅ Ziel-Erkennung später als Enhancement
|
||||
**Contra:**
|
||||
- Keinen signifikanten Nachteil
|
||||
|
||||
---
|
||||
|
||||
## 6. Empfehlung
|
||||
|
||||
### JA, Zielesystem VOR Platzhaltern – aber minimal!
|
||||
|
||||
**Reihenfolge:**
|
||||
|
||||
1. **Phase 0a (2-3h):** Minimal-Zielesystem
|
||||
- DB: goal_mode field
|
||||
- API: Get/Set Goal
|
||||
- UI: Goal Selector (Settings)
|
||||
- Default: "health"
|
||||
|
||||
2. **Phase 0b (16-20h):** Goal-Aware Platzhalter
|
||||
- 84 Platzhalter implementieren
|
||||
- Scores nutzen goal_mode
|
||||
- Berechnungen goal-abhängig
|
||||
|
||||
3. **Phase 1 (12-16h):** Charts
|
||||
- Nutzen goal-aware Platzhalter
|
||||
- Zeigen korrekte Interpretationen
|
||||
|
||||
4. **Phase 2+ (6-8h):** Vollständiges Zielesystem
|
||||
- Ziel-Erkennung
|
||||
- Sekundäre Ziele
|
||||
- Goal Progression Tracking
|
||||
|
||||
---
|
||||
|
||||
## 7. Fazit
|
||||
|
||||
**Deine Intuition war 100% richtig!**
|
||||
|
||||
✅ **Ohne Zielesystem:**
|
||||
- Charts zeigen falsche Interpretationen
|
||||
- Scores sind generisch und für niemanden passend
|
||||
- System bleibt "dummer Datensammler"
|
||||
|
||||
✅ **Mit Zielesystem:**
|
||||
- Charts interpretieren zielspezifisch
|
||||
- Scores sind individuell gewichtet
|
||||
- System wird "intelligenter Coach"
|
||||
|
||||
**Nächster Schritt:** Phase 0a implementieren (2-3h), dann Phase 0b mit goal-aware Platzhaltern.
|
||||
|
||||
**Soll ich mit Phase 0a (Minimal-Zielesystem) starten?**
|
||||
@@ -1,729 +0,0 @@
|
||||
# Goal System Redesign v2.0
|
||||
|
||||
**Datum:** 26. März 2026
|
||||
**Status:** 📋 KONZEPTION
|
||||
**Anlass:** Fundamentale Design-Probleme in Phase 0a identifiziert
|
||||
|
||||
---
|
||||
|
||||
## 1. Probleme der aktuellen Implementierung (Phase 0a)
|
||||
|
||||
### 1.1 Primärziel zu simplistisch
|
||||
**Problem:**
|
||||
- Nur EIN Primärziel erlaubt
|
||||
- Binäres System (primär/nicht-primär)
|
||||
- Toggle funktioniert nicht richtig beim Update
|
||||
|
||||
**Realität:**
|
||||
- User hat MEHRERE Ziele gleichzeitig mit unterschiedlichen Prioritäten
|
||||
- Beispiel: 30% Abnehmen, 25% Kraft, 25% Ausdauer, 20% Beweglichkeit
|
||||
|
||||
**Lösung:**
|
||||
→ **Gewichtungssystem** (0-100%, Summe = 100%)
|
||||
|
||||
---
|
||||
|
||||
### 1.2 Ein Goal Mode zu simpel
|
||||
**Problem:**
|
||||
- User muss sich für EINEN Modus entscheiden (weight_loss ODER strength)
|
||||
- In Realität: Kombinierte Ziele (Abnehmen + Kraft + Ausdauer gleichzeitig)
|
||||
|
||||
**Realität (User-Zitat):**
|
||||
> "Ich versuche nach einer Operation Kraft und Ausdauer aufzubauen, gleichzeitig Abzunehmen und meine Beweglichkeit und Koordination wieder zu steigern."
|
||||
|
||||
**Lösung:**
|
||||
→ **Multi-Mode mit Gewichtung** statt Single-Mode
|
||||
|
||||
---
|
||||
|
||||
### 1.3 Fehlende Current Values
|
||||
**Problem:**
|
||||
- `lean_mass` current value = "-" (nicht implementiert)
|
||||
- `strength`, `flexibility` haben keine Datenquellen
|
||||
- VO2Max wirft Internal Server Error
|
||||
|
||||
**Lösung:**
|
||||
→ Alle Goal-Typen mit korrekten Datenquellen verbinden
|
||||
|
||||
---
|
||||
|
||||
### 1.4 Abstrakte Zieltypen
|
||||
**Problem:**
|
||||
- "Kraft" - was bedeutet das? Bankdrücken? Kniebeuge? Gesamt?
|
||||
- "Beweglichkeit" - welcher Test? Sit-and-Reach? Hüftbeugung?
|
||||
- Zu unspezifisch für konkrete Messung
|
||||
|
||||
**Lösung:**
|
||||
→ **Konkrete, messbare Zieltypen** mit standardisierten Tests
|
||||
|
||||
---
|
||||
|
||||
### 1.5 Blutdruck als einzelner Wert
|
||||
**Problem:**
|
||||
- BP braucht ZWEI Werte (systolisch/diastolisch)
|
||||
- Aktuelles Schema: nur ein `target_value`
|
||||
|
||||
**Lösung:**
|
||||
→ **Compound Goals** (Ziele mit mehreren Werten)
|
||||
|
||||
---
|
||||
|
||||
### 1.6 Keine Guidance für User
|
||||
**Problem:**
|
||||
- User muss konkrete Zahlen eingeben ohne Kontext
|
||||
- Was ist ein guter VO2Max Wert? Was ist realistisch?
|
||||
|
||||
**Lösung:**
|
||||
→ **Richtwerte, Normen, Beispiele** in UI
|
||||
|
||||
---
|
||||
|
||||
## 2. Redesign-Konzept v2.0
|
||||
|
||||
### 2.1 Kern-Prinzipien
|
||||
|
||||
**Prinzip 1: Gewichtung statt Priorisierung**
|
||||
- Alle Ziele haben eine Gewichtung (0-100%)
|
||||
- Summe aller Gewichtungen = 100%
|
||||
- KI berücksichtigt Gewichtung in Analysen
|
||||
|
||||
**Prinzip 2: Multi-dimensional statt Singular**
|
||||
- Kein einzelner "Goal Mode"
|
||||
- Stattdessen: Gewichtete Kombination von Fokus-Bereichen
|
||||
- Realitätsnah: User hat mehrere Ziele gleichzeitig
|
||||
|
||||
**Prinzip 3: Konkret statt Abstrakt**
|
||||
- Jedes Ziel hat klare Messbarkeit
|
||||
- Standardisierte Tests wo möglich
|
||||
- Datenquellen eindeutig definiert
|
||||
|
||||
**Prinzip 4: Guidance statt Ratlosigkeit**
|
||||
- Richtwerte für jedes Ziel
|
||||
- Alters-/Geschlechts-spezifische Normen
|
||||
- Beispiele und Erklärungen
|
||||
|
||||
---
|
||||
|
||||
## 3. Neues Datenmodell
|
||||
|
||||
### 3.1 Fokus-Bereiche (statt Goal Modes)
|
||||
|
||||
**Tabelle: `focus_areas` (NEU)**
|
||||
```sql
|
||||
CREATE TABLE focus_areas (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
profile_id UUID NOT NULL REFERENCES profiles(id) ON DELETE CASCADE,
|
||||
|
||||
-- Gewichtete Fokus-Bereiche
|
||||
weight_loss_pct INT DEFAULT 0, -- 0-100%
|
||||
muscle_gain_pct INT DEFAULT 0, -- 0-100%
|
||||
endurance_pct INT DEFAULT 0, -- 0-100%
|
||||
strength_pct INT DEFAULT 0, -- 0-100%
|
||||
flexibility_pct INT DEFAULT 0, -- 0-100%
|
||||
health_pct INT DEFAULT 0, -- 0-100% (Erhaltung, kein spezifisches Ziel)
|
||||
|
||||
-- Constraint: Summe muss 100 sein
|
||||
CONSTRAINT sum_equals_100 CHECK (
|
||||
weight_loss_pct + muscle_gain_pct + endurance_pct +
|
||||
strength_pct + flexibility_pct + health_pct = 100
|
||||
),
|
||||
|
||||
active BOOLEAN DEFAULT true,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
|
||||
-- Nur ein aktiver Fokus-Mix pro User
|
||||
UNIQUE(profile_id, active) WHERE active = true
|
||||
);
|
||||
|
||||
COMMENT ON TABLE focus_areas IS
|
||||
'Weighted focus distribution - replaces single goal_mode.
|
||||
Example: 30% weight loss + 25% strength + 25% endurance + 20% flexibility = 100%';
|
||||
```
|
||||
|
||||
**Beispiel-Daten:**
|
||||
```json
|
||||
// User nach Operation (wie im Feedback beschrieben):
|
||||
{
|
||||
"weight_loss_pct": 30,
|
||||
"muscle_gain_pct": 20,
|
||||
"endurance_pct": 25,
|
||||
"strength_pct": 15,
|
||||
"flexibility_pct": 10,
|
||||
"health_pct": 0
|
||||
}
|
||||
|
||||
// User reiner Kraftfokus:
|
||||
{
|
||||
"weight_loss_pct": 0,
|
||||
"muscle_gain_pct": 50,
|
||||
"strength_pct": 40,
|
||||
"endurance_pct": 10,
|
||||
"flexibility_pct": 0,
|
||||
"health_pct": 0
|
||||
}
|
||||
|
||||
// User Gewichtsverlust primär:
|
||||
{
|
||||
"weight_loss_pct": 60,
|
||||
"muscle_gain_pct": 0,
|
||||
"endurance_pct": 20,
|
||||
"strength_pct": 10,
|
||||
"flexibility_pct": 5,
|
||||
"health_pct": 5
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3.2 Überarbeitete Goal-Typen
|
||||
|
||||
**Tabelle: `goals` (ÜBERARBEITET)**
|
||||
|
||||
**A) Simple Goals (ein Wert):**
|
||||
```sql
|
||||
goal_type:
|
||||
- 'weight' → kg (aus weight_log)
|
||||
- 'body_fat_pct' → % (aus caliper_log)
|
||||
- 'lean_mass' → kg (berechnet: weight - (weight * bf_pct))
|
||||
- 'vo2max' → ml/kg/min (aus vitals_baseline)
|
||||
- 'rhr' → bpm (aus vitals_baseline)
|
||||
- 'hrv' → ms (aus vitals_baseline)
|
||||
```
|
||||
|
||||
**B) Test-based Goals (standardisierte Tests):**
|
||||
```sql
|
||||
goal_type:
|
||||
- 'cooper_test' → Meter (12min Lauf)
|
||||
- 'pushups_max' → Anzahl
|
||||
- 'plank_max' → Sekunden
|
||||
- 'sit_reach' → cm (Beweglichkeit)
|
||||
- 'squat_1rm' → kg (Kraft Unterkörper)
|
||||
- 'bench_1rm' → kg (Kraft Oberkörper)
|
||||
- 'deadlift_1rm' → kg (Kraft Rücken)
|
||||
```
|
||||
|
||||
**C) Compound Goals (mehrere Werte):**
|
||||
```sql
|
||||
goal_type:
|
||||
- 'blood_pressure' → systolic/diastolic (mmHg)
|
||||
→ Braucht: target_value_secondary
|
||||
```
|
||||
|
||||
**Schema-Erweiterung:**
|
||||
```sql
|
||||
ALTER TABLE goals ADD COLUMN goal_weight INT DEFAULT 100;
|
||||
-- Gewichtung dieses Ziels (0-100%)
|
||||
-- Summe aller goal_weight für einen User sollte ~100% sein
|
||||
|
||||
ALTER TABLE goals ADD COLUMN target_value_secondary DECIMAL(10,2);
|
||||
-- Für Compound Goals (z.B. BP diastolisch)
|
||||
|
||||
ALTER TABLE goals ADD COLUMN current_value_secondary DECIMAL(10,2);
|
||||
-- Aktueller Wert für sekundären Target
|
||||
|
||||
ALTER TABLE goals DROP COLUMN is_primary;
|
||||
-- Nicht mehr nötig (wird durch goal_weight ersetzt)
|
||||
|
||||
COMMENT ON COLUMN goals.goal_weight IS
|
||||
'Weight/priority of this goal (0-100%).
|
||||
Higher weight = more important in AI scoring.
|
||||
Sum of all goal_weight should be ~100% per user.';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3.3 Datenquellen-Mapping
|
||||
|
||||
**Korrekte Current-Value Extraktion:**
|
||||
|
||||
```python
|
||||
# backend/routers/goals.py - _get_current_value_for_goal_type()
|
||||
|
||||
GOAL_TYPE_SOURCES = {
|
||||
# Simple values from existing tables
|
||||
'weight': {
|
||||
'table': 'weight_log',
|
||||
'column': 'weight',
|
||||
'order': 'date DESC'
|
||||
},
|
||||
'body_fat_pct': {
|
||||
'table': 'caliper_log',
|
||||
'column': 'body_fat_pct',
|
||||
'order': 'date DESC'
|
||||
},
|
||||
'lean_mass': {
|
||||
'calculation': 'weight - (weight * body_fat_pct / 100)',
|
||||
'requires': ['weight_log', 'caliper_log']
|
||||
},
|
||||
'vo2max': {
|
||||
'table': 'vitals_baseline',
|
||||
'column': 'vo2_max',
|
||||
'order': 'date DESC'
|
||||
},
|
||||
'rhr': {
|
||||
'table': 'vitals_baseline',
|
||||
'column': 'resting_hr',
|
||||
'order': 'date DESC'
|
||||
},
|
||||
'hrv': {
|
||||
'table': 'vitals_baseline',
|
||||
'column': 'hrv',
|
||||
'order': 'date DESC'
|
||||
},
|
||||
|
||||
# Test-based values from fitness_tests
|
||||
'cooper_test': {
|
||||
'table': 'fitness_tests',
|
||||
'filter': "test_type = 'cooper_12min'",
|
||||
'column': 'result_value',
|
||||
'order': 'test_date DESC'
|
||||
},
|
||||
'pushups_max': {
|
||||
'table': 'fitness_tests',
|
||||
'filter': "test_type = 'pushups_max'",
|
||||
'column': 'result_value',
|
||||
'order': 'test_date DESC'
|
||||
},
|
||||
# ... weitere Tests
|
||||
|
||||
# Compound goals
|
||||
'blood_pressure': {
|
||||
'table': 'blood_pressure_log',
|
||||
'columns': ['systolic', 'diastolic'], # Beide Werte
|
||||
'order': 'measured_at DESC'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. UI/UX Redesign
|
||||
|
||||
### 4.1 Fokus-Bereiche Konfigurator
|
||||
|
||||
**Statt 5 einzelne Cards → Slider-Interface:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ 🎯 Mein Trainings-Fokus │
|
||||
├─────────────────────────────────────────────────────┤
|
||||
│ Verschiebe die Regler um deine Prioritäten zu │
|
||||
│ setzen. Die Summe muss 100% ergeben. │
|
||||
│ │
|
||||
│ 📉 Gewichtsverlust [====] 30% │
|
||||
│ Schwerpunkt auf Kaloriendefizit & Fettabbau │
|
||||
│ │
|
||||
│ 💪 Muskelaufbau [===] 20% │
|
||||
│ Magermasse steigern, Körperkomposition │
|
||||
│ │
|
||||
│ 🏃 Ausdauer [====] 25% │
|
||||
│ VO2Max, aerobe Kapazität, Pace │
|
||||
│ │
|
||||
│ 🏋️ Maximalkraft [==] 15% │
|
||||
│ 1RM Steigerung, progressive Belastung │
|
||||
│ │
|
||||
│ 🤸 Beweglichkeit [=] 10% │
|
||||
│ Mobilität, Flexibilität, Koordination │
|
||||
│ │
|
||||
│ ❤️ Allgemeine Gesundheit [ ] 0% │
|
||||
│ Erhaltung, präventiv │
|
||||
│ │
|
||||
│ ────────────────────────────────────────────────── │
|
||||
│ Gesamt: 100% ✓ │
|
||||
│ │
|
||||
│ [Speichern] [Zurücksetzen] │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Technisch:**
|
||||
- HTML Range Slider (0-100)
|
||||
- Live-Update der Summe
|
||||
- Validierung: Summe muss 100% sein
|
||||
- Auto-Adjust: Wenn User einen Slider erhöht, andere proportional reduzieren
|
||||
|
||||
---
|
||||
|
||||
### 4.2 Ziele mit Gewichtung
|
||||
|
||||
**Goal-List mit Gewichtungs-Indikator:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ 🎯 Konkrete Ziele │
|
||||
├─────────────────────────────────────────────────────┤
|
||||
│ ┌───────────────────────────────────────────────┐ │
|
||||
│ │ ⚖️ Zielgewicht: 82 kg [30%]│ │
|
||||
│ │ Start: 95 kg → Aktuell: 89 kg → Ziel: 82 kg │ │
|
||||
│ │ ████████████░░░░░░░░░░ 65% │ │
|
||||
│ │ ✓ Voraussichtlich: 15.05.2026 (on track) │ │
|
||||
│ │ [✏️] [🗑️] │ │
|
||||
│ └───────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ┌───────────────────────────────────────────────┐ │
|
||||
│ │ 💪 Magermasse: 72 kg [20%]│ │
|
||||
│ │ Start: 68 kg → Aktuell: 70.5 kg → Ziel: 72 kg│ │
|
||||
│ │ ██████████░░░░░░░░░░░░ 63% │ │
|
||||
│ │ ⚠ Prognose: 20.06.2026 (5 Tage später) │ │
|
||||
│ │ [✏️] [🗑️] │ │
|
||||
│ └───────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ [+ Neues Ziel] │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
|
||||
Summe Gewichtungen: 50% (noch 50% verfügbar)
|
||||
```
|
||||
|
||||
**Änderungen:**
|
||||
- Gewichtung in `[30%]` Badge angezeigt
|
||||
- Summe unten angezeigt
|
||||
- Warnung wenn Summe > 100%
|
||||
|
||||
---
|
||||
|
||||
### 4.3 Ziel-Editor mit Guidance
|
||||
|
||||
**Beispiel: VO2Max Ziel erstellen:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ Neues Ziel erstellen │
|
||||
├─────────────────────────────────────────────────────┤
|
||||
│ Zieltyp │
|
||||
│ [VO2 Max ▼] │
|
||||
│ │
|
||||
│ ℹ️ VO2 Max (ml/kg/min) - Maximale Sauerstoffauf- │
|
||||
│ nahme. Misst die aerobe Leistungsfähigkeit. │
|
||||
│ │
|
||||
│ 📊 Richtwerte (Männer, 35 Jahre): │
|
||||
│ Sehr gut: > 48 ml/kg/min │
|
||||
│ Gut: 44-48 ml/kg/min │
|
||||
│ Durchschn.: 40-44 ml/kg/min │
|
||||
│ Unterdurch.: 35-40 ml/kg/min │
|
||||
│ │
|
||||
│ 🎯 Zielwert │
|
||||
│ ┌──────────┬──────────┐ │
|
||||
│ │ [ 46 ] │ ml/kg/min│ │
|
||||
│ └──────────┴──────────┘ │
|
||||
│ Dein aktueller Wert: 42 ml/kg/min (Durchschnitt) │
|
||||
│ → Ziel liegt in "Gut"-Bereich ✓ │
|
||||
│ │
|
||||
│ 📅 Zieldatum (optional) │
|
||||
│ [2026-06-30] │
|
||||
│ │
|
||||
│ ⚖️ Gewichtung │
|
||||
│ [==== ] 25% │
|
||||
│ Wie wichtig ist dir dieses Ziel? │
|
||||
│ │
|
||||
│ 💡 Name (optional) │
|
||||
│ [Ausdauer für Bergwandern ] │
|
||||
│ │
|
||||
│ [Ziel erstellen] [Abbrechen] │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- Info-Box mit Erklärung
|
||||
- Alters-/geschlechtsspezifische Richtwerte
|
||||
- Live-Feedback zum eingegebenen Wert
|
||||
- Aktueller Wert automatisch geladen
|
||||
- Gewichtungs-Slider mit Live-Preview
|
||||
|
||||
---
|
||||
|
||||
### 4.4 Compound Goals (Blutdruck)
|
||||
|
||||
**Spezial-UI für Blutdruck:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ Zieltyp: Blutdruck │
|
||||
├─────────────────────────────────────────────────────┤
|
||||
│ 🎯 Zielwerte │
|
||||
│ │
|
||||
│ Systolisch (oberer Wert) │
|
||||
│ [ 120 ] mmHg │
|
||||
│ │
|
||||
│ Diastolisch (unterer Wert) │
|
||||
│ [ 80 ] mmHg │
|
||||
│ │
|
||||
│ ℹ️ WHO/ISH Klassifikation: │
|
||||
│ Optimal: < 120/80 mmHg │
|
||||
│ Normal: 120-129 / 80-84 mmHg │
|
||||
│ Hoch-norm.: 130-139 / 85-89 mmHg │
|
||||
│ Hypertonie: ≥ 140/90 mmHg │
|
||||
│ │
|
||||
│ Dein aktueller Wert: 135/88 mmHg (Hoch-normal) │
|
||||
│ Dein Ziel: 120/80 mmHg (Optimal) ✓ │
|
||||
│ │
|
||||
│ [Ziel erstellen] [Abbrechen] │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Scoring-System mit Gewichtung
|
||||
|
||||
### 5.1 Score-Berechnung v2.0
|
||||
|
||||
**Aktuell (Phase 0a):**
|
||||
```python
|
||||
# Feste Gewichtung per goal_mode
|
||||
SCORE_WEIGHTS = {
|
||||
"strength": {
|
||||
"body_progress": 0.35,
|
||||
"nutrition": 0.30,
|
||||
# ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Neu (v2.0):**
|
||||
```python
|
||||
def calculate_weighted_score(profile_id):
|
||||
"""
|
||||
Berechnet Score basierend auf:
|
||||
1. Focus Areas (Multi-dimensional statt single mode)
|
||||
2. Goal Weights (individuelle Ziel-Gewichtungen)
|
||||
"""
|
||||
|
||||
# 1. Hole Focus Areas
|
||||
focus = get_focus_areas(profile_id)
|
||||
# → {weight_loss: 30%, muscle_gain: 20%, endurance: 25%, ...}
|
||||
|
||||
# 2. Hole alle Ziele mit Gewichtung
|
||||
goals = get_goals_with_weights(profile_id)
|
||||
# → [{type: 'weight', weight: 30%}, {type: 'lean_mass', weight: 20%}, ...]
|
||||
|
||||
# 3. Berechne Basis-Scores
|
||||
base_scores = {
|
||||
'body_composition': calculate_body_score(profile_id),
|
||||
'nutrition': calculate_nutrition_score(profile_id),
|
||||
'training': calculate_training_score(profile_id),
|
||||
'recovery': calculate_recovery_score(profile_id)
|
||||
}
|
||||
|
||||
# 4. Gewichte Scores nach Focus Areas
|
||||
weighted_score = 0
|
||||
|
||||
# Weight Loss Focus → Body Composition + Nutrition wichtiger
|
||||
if focus['weight_loss_pct'] > 0:
|
||||
weighted_score += (
|
||||
base_scores['body_composition'] * 0.4 +
|
||||
base_scores['nutrition'] * 0.4 +
|
||||
base_scores['training'] * 0.1 +
|
||||
base_scores['recovery'] * 0.1
|
||||
) * (focus['weight_loss_pct'] / 100)
|
||||
|
||||
# Muscle Gain Focus → Body + Nutrition + Training
|
||||
if focus['muscle_gain_pct'] > 0:
|
||||
weighted_score += (
|
||||
base_scores['body_composition'] * 0.35 +
|
||||
base_scores['nutrition'] * 0.35 +
|
||||
base_scores['training'] * 0.25 +
|
||||
base_scores['recovery'] * 0.05
|
||||
) * (focus['muscle_gain_pct'] / 100)
|
||||
|
||||
# Endurance Focus → Training + Recovery
|
||||
if focus['endurance_pct'] > 0:
|
||||
weighted_score += (
|
||||
base_scores['training'] * 0.50 +
|
||||
base_scores['recovery'] * 0.30 +
|
||||
base_scores['body_composition'] * 0.10 +
|
||||
base_scores['nutrition'] * 0.10
|
||||
) * (focus['endurance_pct'] / 100)
|
||||
|
||||
# ... weitere Focus Areas
|
||||
|
||||
return {
|
||||
'overall_score': round(weighted_score, 1),
|
||||
'base_scores': base_scores,
|
||||
'focus_weights': focus,
|
||||
'goal_weights': [g['weight'] for g in goals]
|
||||
}
|
||||
```
|
||||
|
||||
**Beispiel:**
|
||||
```python
|
||||
User: 30% Weight Loss + 25% Endurance + 20% Muscle Gain + 25% Strength
|
||||
|
||||
Base Scores:
|
||||
- Body Composition: 75/100
|
||||
- Nutrition: 80/100
|
||||
- Training: 70/100
|
||||
- Recovery: 65/100
|
||||
|
||||
Calculation:
|
||||
Weight Loss (30%):
|
||||
= (75*0.4 + 80*0.4 + 70*0.1 + 65*0.1) * 0.30
|
||||
= 69.5 * 0.30 = 20.85
|
||||
|
||||
Endurance (25%):
|
||||
= (70*0.50 + 65*0.30 + 75*0.10 + 80*0.10) * 0.25
|
||||
= 69.0 * 0.25 = 17.25
|
||||
|
||||
Muscle Gain (20%):
|
||||
= (75*0.35 + 80*0.35 + 70*0.25 + 65*0.05) * 0.20
|
||||
= 74.0 * 0.20 = 14.80
|
||||
|
||||
Strength (25%):
|
||||
= (70*0.40 + 80*0.30 + 75*0.20 + 65*0.10) * 0.25
|
||||
= 72.5 * 0.25 = 18.13
|
||||
|
||||
Overall Score = 20.85 + 17.25 + 14.80 + 18.13 = 71.03/100
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Migration-Strategie
|
||||
|
||||
### 6.1 Daten-Migration von Phase 0a
|
||||
|
||||
**Bestehende Daten:**
|
||||
- `profiles.goal_mode` (single mode)
|
||||
- `goals` mit `is_primary`
|
||||
|
||||
**Migrations-Logik:**
|
||||
```sql
|
||||
-- Migration 023: Goal System Redesign v2.0
|
||||
|
||||
-- 1. Erstelle focus_areas Tabelle
|
||||
CREATE TABLE focus_areas (...);
|
||||
|
||||
-- 2. Migriere bestehende goal_mode → focus_areas
|
||||
INSERT INTO focus_areas (profile_id, weight_loss_pct, muscle_gain_pct, ...)
|
||||
SELECT
|
||||
id,
|
||||
CASE goal_mode
|
||||
WHEN 'weight_loss' THEN 70 -- 70% Weight Loss + 15% Health + 15% Endurance
|
||||
WHEN 'strength' THEN 0
|
||||
-- ...
|
||||
END as weight_loss_pct,
|
||||
CASE goal_mode
|
||||
WHEN 'strength' THEN 60
|
||||
WHEN 'recomposition' THEN 30
|
||||
-- ...
|
||||
END as muscle_gain_pct,
|
||||
-- ... weitere
|
||||
FROM profiles
|
||||
WHERE goal_mode IS NOT NULL;
|
||||
|
||||
-- 3. Erweitere goals Tabelle
|
||||
ALTER TABLE goals ADD COLUMN goal_weight INT DEFAULT 100;
|
||||
ALTER TABLE goals ADD COLUMN target_value_secondary DECIMAL(10,2);
|
||||
ALTER TABLE goals ADD COLUMN current_value_secondary DECIMAL(10,2);
|
||||
|
||||
-- 4. Migriere is_primary → goal_weight
|
||||
UPDATE goals SET goal_weight = 100 WHERE is_primary = true;
|
||||
UPDATE goals SET goal_weight = 50 WHERE is_primary = false;
|
||||
|
||||
-- 5. Cleanup (später)
|
||||
-- ALTER TABLE profiles DROP COLUMN goal_mode; -- nach Verifikation
|
||||
-- ALTER TABLE goals DROP COLUMN is_primary; -- nach Verifikation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Implementierungs-Phasen
|
||||
|
||||
### Phase 1: Konzeption ✅ (DIESES DOKUMENT)
|
||||
**Dauer:** -
|
||||
**Ziel:** Vollständiges Redesign-Konzept
|
||||
|
||||
### Phase 2: Backend Redesign (6-8h)
|
||||
- Migration 023 erstellen
|
||||
- `focus_areas` Tabelle + CRUD
|
||||
- `goals` erweitern (weight, secondary values)
|
||||
- Datenquellen-Mapping korrigieren (lean_mass, VO2Max fix, etc.)
|
||||
- Scoring-System v2.0 implementieren
|
||||
|
||||
### Phase 3: Frontend Redesign (8-10h)
|
||||
- Fokus-Bereiche Slider-UI
|
||||
- Ziel-Editor mit Guidance (Richtwerte, Normen)
|
||||
- Gewichtungs-System in Goal-Liste
|
||||
- Compound Goals UI (Blutdruck zwei Werte)
|
||||
- Neue Goal-Typen (Tests) integrieren
|
||||
|
||||
### Phase 4: Testing & Refinement (2-3h)
|
||||
- Migration testen (Phase 0a → v2.0)
|
||||
- Scoring-Logik verifizieren
|
||||
- UI/UX Testing
|
||||
- Edge Cases (Summe ≠ 100%, keine Ziele, etc.)
|
||||
|
||||
**Total: 16-21h**
|
||||
|
||||
---
|
||||
|
||||
## 8. Offene Fragen / Entscheidungen
|
||||
|
||||
### 8.1 Focus Areas vs Goals Weight
|
||||
**Frage:** Brauchen wir BEIDE Gewichtungssysteme?
|
||||
- Focus Areas (Weight Loss 30%, Strength 25%, ...)
|
||||
- Goal Weights (Ziel "82kg" = 30%, Ziel "VO2Max 46" = 25%, ...)
|
||||
|
||||
**Option A:** NUR Focus Areas
|
||||
- Einfacher
|
||||
- Weniger Redundanz
|
||||
- Aber: Weniger granular
|
||||
|
||||
**Option B:** BEIDE Systeme
|
||||
- Focus Areas = Strategisch (Richtung)
|
||||
- Goal Weights = Taktisch (konkrete Prioritäten)
|
||||
- Komplexer, aber flexibler
|
||||
|
||||
**Empfehlung:** Option B - beide Systeme ergänzen sich
|
||||
|
||||
---
|
||||
|
||||
### 8.2 Konkrete vs Abstrakte Tests
|
||||
**Frage:** Wie konkret sollen Strength-Goals sein?
|
||||
|
||||
**Option A:** Sehr konkret
|
||||
- `bench_press_1rm`, `squat_1rm`, `deadlift_1rm`
|
||||
- Vorteil: Präzise, messbar
|
||||
- Nachteil: Viele Goal-Typen
|
||||
|
||||
**Option B:** Abstrakt mit Kontext
|
||||
- `strength` mit Sub-Type (Bench/Squat/Deadlift)
|
||||
- Vorteil: Flexibler
|
||||
- Nachteil: Komplizierteres Schema
|
||||
|
||||
**Empfehlung:** Option A - konkrete Typen, dafür klare Messbarkeit
|
||||
|
||||
---
|
||||
|
||||
### 8.3 Auto-Update von Current Values
|
||||
**Frage:** Wie oft sollen current_value aktualisiert werden?
|
||||
|
||||
**Option A:** On-Demand (beim Laden der Goals-Seite)
|
||||
- Vorteil: Keine Background-Jobs
|
||||
- Nachteil: Kann verzögert sein
|
||||
|
||||
**Option B:** Trigger-basiert (bei neuem Messwert)
|
||||
- Vorteil: Immer aktuell
|
||||
- Nachteil: Mehr Komplexität
|
||||
|
||||
**Empfehlung:** Option A für MVP, Option B später
|
||||
|
||||
---
|
||||
|
||||
## 9. Nächste Schritte
|
||||
|
||||
### User-Feedback einholen:
|
||||
1. ✅ Löst das Redesign alle genannten Probleme?
|
||||
2. ✅ Ist die Fokus-Bereiche UI verständlich?
|
||||
3. ✅ Sind die konkreten Goal-Typen sinnvoll?
|
||||
4. ✅ Brauchen wir beide Gewichtungssysteme?
|
||||
5. ✅ Fehlt noch etwas?
|
||||
|
||||
### Nach Freigabe:
|
||||
1. Migration 023 schreiben
|
||||
2. Backend implementieren
|
||||
3. Frontend implementieren
|
||||
4. Testing
|
||||
|
||||
---
|
||||
|
||||
**Erstellt:** 26. März 2026
|
||||
**Status:** 📋 WARTET AUF FEEDBACK
|
||||
**Nächster Schritt:** User-Review & Freigabe
|
||||
@@ -1,458 +0,0 @@
|
||||
# Konzept-Analyse: Fachkonzept vs. Gitea Issues
|
||||
|
||||
**Datum:** 26. März 2026
|
||||
**Analyst:** Claude Code
|
||||
**Basis:** `.claude/docs/functional/mitai_jinkendo_konzept_diagramme_auswertungen_v2.md`
|
||||
**Geprüfte Issues:** #26, #27, alle offenen
|
||||
|
||||
---
|
||||
|
||||
## 1. Executive Summary
|
||||
|
||||
### Kernerkenntnis
|
||||
Das Fachkonzept ist **wesentlich umfassender** als die aktuellen Gitea Issues #26 und #27. Es definiert ein 3-stufiges Analyse-System (Deskriptiv → Diagnostisch → Präskriptiv), das weit über einfache Charts und Korrelationen hinausgeht.
|
||||
|
||||
### Strategische Empfehlung
|
||||
**NICHT** Issues #26 und #27 einzeln implementieren, sondern:
|
||||
1. **Neu-Strukturierung:** Konzept-basierte Phasen-Issues erstellen
|
||||
2. **Platzhalter-First:** Erst Berechnungs-Platzhalter implementieren
|
||||
3. **Dann Visualisierung:** Charts nutzen die Platzhalter
|
||||
4. **Dann KI-Integration:** KI nutzt regelbasierte Scores + Rohdaten
|
||||
|
||||
---
|
||||
|
||||
## 2. Analyse: Issue #26 vs. Fachkonzept
|
||||
|
||||
### Issue #26: Charts & Visualisierungen erweitern
|
||||
**Status:** OPEN
|
||||
**Priority:** Medium-High
|
||||
**Aufwand:** 8-10h
|
||||
|
||||
**Definierte Charts:**
|
||||
- Gewicht-Trends (Line-Chart + Trendlinie)
|
||||
- Umfänge-Verlauf (Multi-Line)
|
||||
- Vitalwerte-Trends (RHR, HRV, BP)
|
||||
- Schlaf-Analyse (Dauer, Phasen)
|
||||
- Ernährungs-Charts (Kalorien, Makros)
|
||||
|
||||
### Fachkonzept: Diagrammkatalog
|
||||
|
||||
**KÖRPER (K1-K5):**
|
||||
- K1: Gewichtstrend + Trendkanal + Zielprojektion
|
||||
- 7d Rolling Median, 28d/90d Trend-Slope
|
||||
- Prozentuale Zielannäherung
|
||||
- Regelbasierte Hinweise (zu schnell/langsam)
|
||||
- K2: Körperzusammensetzung (Gewicht/FM/LBM)
|
||||
- FM = Gewicht × BF%, LBM = Gewicht × (1-BF%)
|
||||
- 28d/90d Änderung von FM und LBM
|
||||
- K3: Umfangs-Panel (8 Mini-Charts)
|
||||
- Links-Rechts Asymmetrie
|
||||
- Taille/Hüfte, Taille/Körpergröße
|
||||
- K4: Rekompositions-Detektor (Quadranten)
|
||||
- K5: Body Progress Score (0-100)
|
||||
|
||||
**ERNÄHRUNG (E1-E5):**
|
||||
- E1: Energieaufnahme vs. Verbrauch vs. Gewichtstrend
|
||||
- E2: Protein adequacy (g/Tag, g/kg, g/kg LBM)
|
||||
- E3: Makroverteilung + Wochenkonsistenz
|
||||
- E4: Ernährungs-Adhärenz-Score (0-100)
|
||||
- E5: Energieverfügbarkeits-Warnung
|
||||
|
||||
**AKTIVITÄT (A1-A8):**
|
||||
- A1: Trainingsvolumen pro Woche
|
||||
- A2: Intensitätsverteilung / Zonenbild
|
||||
- A3: Trainingsqualitäts-Matrix
|
||||
- A4: Fähigkeiten-Balance / Ability Radar
|
||||
- A5: Load-Monitoring (interne Last, Monotony, Strain)
|
||||
- A6: Aktivitäts-Goal-Alignment-Score (0-100)
|
||||
- A7: Ruhetags-/Recovery-Compliance
|
||||
- A8: VO2max-Entwicklung
|
||||
|
||||
### Bewertung
|
||||
❌ **Issue #26 ist zu eng gefasst**
|
||||
- Fokus nur auf Basis-Visualisierung
|
||||
- Keine Scores, keine Baselines, keine Confidence
|
||||
- Keine regelbasierten Hinweise
|
||||
- Keine Ziel-Abhängigkeit
|
||||
|
||||
✅ **Fachkonzept bietet:**
|
||||
- 18 dedizierte Charts (K1-K5, E1-E5, A1-A8)
|
||||
- Scores als eigenständige Visualisierungen
|
||||
- Regelbasierte Aussagen ohne KI
|
||||
- Ziel-Modi Steuerung
|
||||
|
||||
---
|
||||
|
||||
## 3. Analyse: Issue #27 vs. Fachkonzept
|
||||
|
||||
### Issue #27: Korrelationen & Insights erweitern
|
||||
**Status:** OPEN
|
||||
**Priority:** High
|
||||
**Aufwand:** 6-8h
|
||||
|
||||
**Definierte Korrelationen:**
|
||||
- Schlaf ↔ Erholung (Schlafdauer → RHR, Qualität → HRV)
|
||||
- Training ↔ Vitalwerte (Load → RHR-Anstieg, HRV-Abfall)
|
||||
- Ernährung ↔ Performance (Defizit → Intensität)
|
||||
- Blutdruck ↔ Lifestyle (Stress → BP, Training → BP)
|
||||
- Multi-Faktor Analyse (KI-Insights)
|
||||
|
||||
### Fachkonzept: Korrelationen (C1-C6)
|
||||
|
||||
**KORRELATIONEN (C1-C6):**
|
||||
- C1: Energie-Balance vs. Gewichtsveränderung (lagged)
|
||||
- Lags: 0, 3, 7, 10, 14 Tage
|
||||
- Bestes Lag ermitteln, Effektstärke, Confidence
|
||||
- C2: Protein adequacy vs. LBM-Trend
|
||||
- 28d Fenstervergleich, Training als Moderator
|
||||
- C3: Trainingslast vs. HRV/RHR (1-3 Tage verzögert)
|
||||
- Duale Lag-Auswertung, individuelle Ermüdungsreaktion
|
||||
- C4: Schlafdauer + Schlafregularität vs. Recovery
|
||||
- Bubble-Chart, Sleep Regularity Index
|
||||
- C5: Blutdruck-Kontextmatrix (Kontext-abhängig)
|
||||
- Messkontext, Schlaf Vor-Nacht, Training
|
||||
- C6: Plateau-Detektor (Ereignis-Karte)
|
||||
- Ziel-spezifische Plateau-Definitionen
|
||||
|
||||
### Zusätzlich: Lag-Analyse Prinzipien
|
||||
|
||||
**Zwingend im Fachkonzept:**
|
||||
- **NIE nur lag=0 prüfen**
|
||||
- Kalorienbilanz → Gewicht: 2-14 Tage Verzögerung
|
||||
- Protein/Krafttraining → LBM: 2-6 Wochen Verzögerung
|
||||
- Trainingslast → HRV/RHR: 1-3 Tage Verzögerung
|
||||
- Schlafdefizit → Recovery: 1-3 Tage Verzögerung
|
||||
|
||||
**Mindestdatenmenge:**
|
||||
- Korrelationen: mind. 21 gepaarte Tageswerte
|
||||
- Lag-basiert: mind. 28 gepaarte Tage
|
||||
- Confidence-Klassen (hoch/mittel/niedrig/nicht auswertbar)
|
||||
|
||||
### Bewertung
|
||||
❌ **Issue #27 ist zu oberflächlich**
|
||||
- Keine Lag-Analyse
|
||||
- Keine Confidence-Bewertung
|
||||
- Keine Mindestdatenmenge-Checks
|
||||
- Keine Ziel-Abhängigkeit
|
||||
|
||||
✅ **Fachkonzept bietet:**
|
||||
- 6 dedizierte Korrelations-Charts mit Lag-Analyse
|
||||
- Explizite Confidence-Bewertung
|
||||
- Medizinischer Sicherheitsmodus
|
||||
- Plateau-Detektion (regelbasiert)
|
||||
|
||||
---
|
||||
|
||||
## 4. Konflikt-Analyse
|
||||
|
||||
### Gibt es Widersprüche zwischen #26 und #27?
|
||||
**NEIN** – Sie sind komplementär:
|
||||
- #26: Deskriptive Ebene (Charts)
|
||||
- #27: Diagnostische Ebene (Korrelationen)
|
||||
|
||||
### Aber: Beide sind zu isoliert
|
||||
Das Fachkonzept zeigt: **Charts und Korrelationen müssen verzahnt sein**
|
||||
|
||||
**Beispiel:**
|
||||
```
|
||||
Fachkonzept C1: Energie-Balance vs. Gewichtsveränderung
|
||||
├─ Visualisierung: Lag-Heatmap (diagnostisch)
|
||||
├─ Berechnung: Cross-Correlation (0, 3, 7, 10, 14 Tage Lags)
|
||||
├─ Input-Daten: Tägliche Kalorienbilanz (E-Chart)
|
||||
├─ Input-Daten: 7d Gewichtsänderung (K-Chart)
|
||||
└─ Regelbasierte Aussage: "Energiebilanz zeigt sich bei dir nach ~7 Tagen im Gewicht"
|
||||
```
|
||||
|
||||
**Fazit:** Charts (K, E, A) liefern Basis-Daten für Korrelationen (C)
|
||||
|
||||
---
|
||||
|
||||
## 5. Neue Platzhalter aus Fachkonzept
|
||||
|
||||
### 5.1 KÖRPER (18 neue Platzhalter)
|
||||
|
||||
**Gewicht & Trends:**
|
||||
```python
|
||||
{{weight_7d_rolling_median}} # 7-Tage gleitender Median
|
||||
{{weight_28d_trend_slope}} # 28-Tage Trend-Steigung (kg/Tag)
|
||||
{{weight_90d_trend_slope}} # 90-Tage Trend-Steigung
|
||||
{{weight_goal_progress_pct}} # Prozentuale Zielannäherung
|
||||
{{weight_projection_days}} # Geschätzte Tage bis Zielgewicht
|
||||
{{weight_loss_rate_weekly}} # kg/Woche (28d Mittel)
|
||||
```
|
||||
|
||||
**Körperzusammensetzung:**
|
||||
```python
|
||||
{{fm_current}} # Fettmasse aktuell (kg)
|
||||
{{lbm_current}} # Magermasse aktuell (kg)
|
||||
{{fm_28d_delta}} # FM Änderung 28 Tage (kg)
|
||||
{{lbm_28d_delta}} # LBM Änderung 28 Tage (kg)
|
||||
{{fm_90d_delta}} # FM Änderung 90 Tage
|
||||
{{lbm_90d_delta}} # LBM Änderung 90 Tage
|
||||
{{recomposition_score}} # 0-100 (FM↓ + LBM↑ = ideal)
|
||||
```
|
||||
|
||||
**Umfänge:**
|
||||
```python
|
||||
{{waist_to_hip_ratio}} # Taille/Hüfte Verhältnis
|
||||
{{waist_to_height_ratio}} # Taille/Körpergröße (Gesundheitsmarker)
|
||||
{{arm_asymmetry_pct}} # Links-Rechts Differenz %
|
||||
{{leg_asymmetry_pct}} # Oberschenkel L-R Differenz
|
||||
{{waist_28d_delta}} # Taillenumfang Änderung 28d
|
||||
```
|
||||
|
||||
**Body Progress Score:**
|
||||
```python
|
||||
{{body_progress_score}} # 0-100 (zielabhängig gewichtet)
|
||||
```
|
||||
|
||||
### 5.2 ERNÄHRUNG (15 neue Platzhalter)
|
||||
|
||||
**Energie & Bilanz:**
|
||||
```python
|
||||
{{kcal_7d_avg}} # Bereits vorhanden? Prüfen
|
||||
{{kcal_28d_avg}} # 28-Tage Durchschnitt
|
||||
{{kcal_estimated_tdee}} # Geschätzter Gesamtumsatz
|
||||
{{kcal_balance_7d_avg}} # Durchschnittliche Bilanz 7d
|
||||
{{kcal_balance_28d_avg}} # Durchschnittliche Bilanz 28d
|
||||
{{energy_availability_status}} # "adequate" | "low" | "critical"
|
||||
```
|
||||
|
||||
**Protein:**
|
||||
```python
|
||||
{{protein_g_per_kg}} # Protein g/kg Körpergewicht
|
||||
{{protein_g_per_kg_lbm}} # Protein g/kg Magermasse
|
||||
{{protein_adequacy_score}} # 0-100 (Ziel: 1.6-2.2 g/kg)
|
||||
```
|
||||
|
||||
**Makros & Adhärenz:**
|
||||
```python
|
||||
{{carb_pct_7d_avg}} # % der Gesamtkalorien
|
||||
{{fat_pct_7d_avg}} # % der Gesamtkalorien
|
||||
{{macro_consistency_score}} # 0-100 (Regelmäßigkeit)
|
||||
{{nutrition_adherence_score}} # 0-100 (Gesamtscore)
|
||||
{{nutrition_days_7d}} # Erfasste Tage letzte 7d
|
||||
{{nutrition_days_28d}} # Erfasste Tage letzte 28d
|
||||
```
|
||||
|
||||
### 5.3 AKTIVITÄT (25 neue Platzhalter)
|
||||
|
||||
**Volumen:**
|
||||
```python
|
||||
{{activity_volume_7d_min}} # Gesamtminuten 7 Tage
|
||||
{{activity_volume_28d_min}} # Gesamtminuten 28 Tage
|
||||
{{activity_frequency_7d}} # Anzahl Sessions 7d
|
||||
{{activity_frequency_28d}} # Anzahl Sessions 28d
|
||||
{{activity_avg_duration_28d}} # Durchschn. Dauer pro Session
|
||||
```
|
||||
|
||||
**Intensität:**
|
||||
```python
|
||||
{{activity_z1_pct}} # % Zeit in Zone 1 (7d)
|
||||
{{activity_z2_pct}} # % Zeit in Zone 2
|
||||
{{activity_z3_pct}} # % Zeit in Zone 3
|
||||
{{activity_z4_pct}} # % Zeit in Zone 4
|
||||
{{activity_z5_pct}} # % Zeit in Zone 5
|
||||
{{activity_polarization_index}} # Polarisierung (Z1+Z2 vs Z4+Z5)
|
||||
```
|
||||
|
||||
**Qualität & Load:**
|
||||
```python
|
||||
{{activity_quality_avg_28d}} # Durchschn. Quality-Score
|
||||
{{activity_load_7d}} # Interne Last (7d Summe)
|
||||
{{activity_load_28d}} # Interne Last (28d Summe)
|
||||
{{activity_monotony_28d}} # Last-Variabilität
|
||||
{{activity_strain_28d}} # Load × Monotony
|
||||
{{activity_acwr}} # Acute:Chronic Workload Ratio
|
||||
```
|
||||
|
||||
**Fähigkeiten:**
|
||||
```python
|
||||
{{ability_strength_score}} # 0-100 (aus Training Types)
|
||||
{{ability_endurance_score}} # 0-100
|
||||
{{ability_mobility_score}} # 0-100
|
||||
{{ability_skills_score}} # 0-100
|
||||
{{ability_mindfulness_score}} # 0-100
|
||||
{{ability_balance_score}} # 0-100 (wie ausgewogen?)
|
||||
```
|
||||
|
||||
**Goal Alignment:**
|
||||
```python
|
||||
{{activity_goal_alignment_score}} # 0-100 (zielabhängig)
|
||||
{{rest_days_compliance}} # 0-100 (geplant vs. tatsächlich)
|
||||
```
|
||||
|
||||
### 5.4 RECOVERY & GESUNDHEIT (12 neue Platzhalter)
|
||||
|
||||
**Baselines:**
|
||||
```python
|
||||
{{rhr_7d_baseline}} # 7-Tage Baseline Ruhepuls
|
||||
{{rhr_28d_baseline}} # 28-Tage Baseline
|
||||
{{hrv_7d_baseline}} # 7-Tage Baseline HRV
|
||||
{{hrv_28d_baseline}} # 28-Tage Baseline
|
||||
```
|
||||
|
||||
**Deltas & Trends:**
|
||||
```python
|
||||
{{rhr_vs_baseline_7d}} # Abweichung von Baseline (bpm)
|
||||
{{hrv_vs_baseline_7d}} # Abweichung von Baseline (ms)
|
||||
{{vo2max_trend_28d}} # VO2max Entwicklung
|
||||
```
|
||||
|
||||
**Scores:**
|
||||
```python
|
||||
{{recovery_score}} # 0-100 (HRV, RHR, Schlaf)
|
||||
{{recovery_score_confidence}} # 0-100 (Datenqualität)
|
||||
{{sleep_regularity_index}} # Schlafregelmäßigkeit
|
||||
{{sleep_debt_hours}} # Akkumulierte Schlafschuld
|
||||
{{health_risk_score}} # 0-100 (Blutdruck, etc.)
|
||||
```
|
||||
|
||||
### 5.5 KORRELATIONEN (8 neue Platzhalter)
|
||||
|
||||
```python
|
||||
{{corr_energy_weight_lag}} # Bestes Lag Energie→Gewicht (Tage)
|
||||
{{corr_energy_weight_r}} # Korrelationskoeffizient
|
||||
{{corr_protein_lbm_r}} # Protein ↔ LBM Korrelation
|
||||
{{corr_load_hrv_lag}} # Bestes Lag Load→HRV
|
||||
{{corr_load_hrv_r}} # Korrelation
|
||||
{{corr_sleep_rhr_r}} # Schlaf ↔ RHR Korrelation
|
||||
{{plateau_detected}} # true|false (regelbasiert)
|
||||
{{plateau_type}} # "weight_loss" | "strength" | etc.
|
||||
```
|
||||
|
||||
### 5.6 META-PLATZHALTER (6 neue)
|
||||
|
||||
```python
|
||||
{{goal_mode}} # "weight_loss" | "strength" | etc.
|
||||
{{training_age_weeks}} # Trainingserfahrung
|
||||
{{data_quality_score}} # 0-100 (Gesamtdatenqualität)
|
||||
{{measurement_consistency}} # 0-100 (Messzeit-Konsistenz)
|
||||
{{analysis_confidence}} # "high" | "medium" | "low"
|
||||
{{analysis_timeframe}} # "7d" | "28d" | "90d"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Gesamt-Übersicht: Neue Platzhalter
|
||||
|
||||
| Kategorie | Anzahl | Beispiele |
|
||||
|-----------|--------|-----------|
|
||||
| KÖRPER | 18 | weight_28d_trend_slope, fm_28d_delta, recomposition_score |
|
||||
| ERNÄHRUNG | 15 | protein_g_per_kg_lbm, nutrition_adherence_score, energy_availability_status |
|
||||
| AKTIVITÄT | 25 | activity_quality_avg_28d, activity_strain_28d, ability_balance_score |
|
||||
| RECOVERY | 12 | recovery_score, sleep_regularity_index, sleep_debt_hours |
|
||||
| KORRELATIONEN | 8 | corr_energy_weight_lag, plateau_detected, corr_load_hrv_r |
|
||||
| META | 6 | goal_mode, data_quality_score, analysis_confidence |
|
||||
| **GESAMT** | **84** | **Neue Platzhalter aus Fachkonzept** |
|
||||
|
||||
---
|
||||
|
||||
## 7. Strategische Roadmap-Empfehlung
|
||||
|
||||
### Phase 0: Fundament (JETZT)
|
||||
**Ziel:** Berechnungs-Platzhalter implementieren
|
||||
**Aufwand:** 16-20h
|
||||
**Deliverables:**
|
||||
- 84 neue Platzhalter in `placeholder_resolver.py`
|
||||
- Baseline-Berechnungen (7d, 28d, 90d)
|
||||
- Score-Algorithmen (Body Progress, Nutrition Adherence, Activity Goal Alignment, Recovery)
|
||||
- Lag-Korrelations-Funktionen
|
||||
- Confidence-Berechnung
|
||||
|
||||
**Issues zu erstellen:**
|
||||
- #52: Baseline & Trend Calculations (Körper, Ernährung, Aktivität)
|
||||
- #53: Score Algorithms (4 Haupt-Scores)
|
||||
- #54: Correlation & Lag Analysis
|
||||
- #55: Confidence & Data Quality Metrics
|
||||
|
||||
### Phase 1: Visualisierung (DANN)
|
||||
**Ziel:** Charts nutzen die neuen Platzhalter
|
||||
**Aufwand:** 12-16h
|
||||
**Deliverables:**
|
||||
- K1-K5 Charts (Körper)
|
||||
- E1-E5 Charts (Ernährung)
|
||||
- A1-A8 Charts (Aktivität)
|
||||
- C1-C6 Charts (Korrelationen)
|
||||
|
||||
**Issues zu konsolidieren:**
|
||||
- #26 erweitern zu "Comprehensive Chart System (K, E, A, C)"
|
||||
- #27 erweitern zu "Correlation & Lag Analysis Charts"
|
||||
|
||||
### Phase 2: Regelbasierte Insights (DANACH)
|
||||
**Ziel:** System wird Coach (nicht nur Datensammler)
|
||||
**Aufwand:** 8-12h
|
||||
**Deliverables:**
|
||||
- Regelbasierte Hinweise ohne KI
|
||||
- Plateau-Detektion
|
||||
- Ziel-abhängige Interpretationen
|
||||
- Warnungen (Gesundheit, Übertraining, Energieverfügbarkeit)
|
||||
|
||||
**Neue Issues:**
|
||||
- #56: Rule-Based Recommendations Engine
|
||||
- #57: Goal-Mode System & Interpretation
|
||||
- #58: Health & Safety Warnings
|
||||
|
||||
### Phase 3: KI-Integration (SPÄTER)
|
||||
**Ziel:** KI nutzt Scores + Rohdaten + Regeln
|
||||
**Aufwand:** 6-8h
|
||||
**Deliverables:**
|
||||
- KI-Prompts nutzen neue Platzhalter
|
||||
- Contextual AI Analysis (nutzt goal_mode)
|
||||
- Multi-Faktor Insights
|
||||
|
||||
---
|
||||
|
||||
## 8. Aktions-Empfehlungen
|
||||
|
||||
### SOFORT (heute)
|
||||
1. ✅ **Issues #26 und #27 NICHT einzeln implementieren**
|
||||
2. ✅ **Neues Issue #52 erstellen:** Baseline & Trend Calculations
|
||||
3. ✅ **Neues Issue #53 erstellen:** Score Algorithms
|
||||
4. ✅ **Issue #26 umbennen/erweitern:** "Comprehensive Chart System (based on Fachkonzept)"
|
||||
5. ✅ **Issue #27 umbennen/erweitern:** "Correlation & Lag Analysis (based on Fachkonzept)"
|
||||
|
||||
### DIESE WOCHE
|
||||
6. ✅ **Implementierung starten:** Phase 0 - Platzhalter
|
||||
7. ✅ **Dokumentation:** Mapping Fachkonzept → Code
|
||||
8. ✅ **KI-Prompts vorbereiten:** Nutzen neue Platzhalter
|
||||
|
||||
### NÄCHSTE WOCHE
|
||||
9. ✅ **Implementierung:** Phase 1 - Charts
|
||||
10. ✅ **Testing:** Alle Scores & Berechnungen
|
||||
11. ✅ **Production:** Deployment vorbereiten
|
||||
|
||||
---
|
||||
|
||||
## 9. Zusammenfassung: Transformation Data Collector → Active Coach
|
||||
|
||||
### Aktueller Stand
|
||||
**Data Collector:**
|
||||
- Daten werden erfasst
|
||||
- Einfache Listen
|
||||
- Basis-Statistiken
|
||||
- KI-Analysen manuell angestoßen
|
||||
|
||||
### Ziel (nach Fachkonzept)
|
||||
**Active Coach:**
|
||||
- Daten werden **interpretiert**
|
||||
- Trends & Baselines
|
||||
- Scores & Confidence
|
||||
- Regelbasierte Hinweise
|
||||
- Ziel-abhängige Bewertung
|
||||
- Proaktive Warnungen
|
||||
- KI nutzt strukturierte Insights
|
||||
|
||||
---
|
||||
|
||||
## 10. Nächste Schritte
|
||||
|
||||
1. **Issues neu strukturieren** (heute)
|
||||
2. **Platzhalter implementieren** (Phase 0, diese Woche)
|
||||
3. **Charts implementieren** (Phase 1, nächste Woche)
|
||||
4. **Regelbasierte Insights** (Phase 2, Woche danach)
|
||||
5. **KI-Integration** (Phase 3, dann)
|
||||
|
||||
**Commit:** cd2609d
|
||||
**Analysiert von:** Claude Code
|
||||
**Basis:** Fachkonzept v2 (2086 Zeilen, 24.03.2026)
|
||||
+4
-1055
File diff suppressed because it is too large.
Load diff
@@ -1,460 +0,0 @@
|
||||
# Nächste Schritte nach Phase 0a
|
||||
|
||||
**Stand:** 26. März 2026, nach Completion von Phase 0a (Goal System)
|
||||
**Aktueller Branch:** `develop`
|
||||
**Deployed:** `dev.mitai.jinkendo.de`
|
||||
|
||||
---
|
||||
|
||||
## Aktueller Stand ✅
|
||||
|
||||
### Abgeschlossen
|
||||
- ✅ **Phase 0a:** Minimal Goal System (Strategic + Tactical)
|
||||
- Migration 022, goals.py Router, GoalsPage UI
|
||||
- Navigation von Dashboard + Analysis
|
||||
- Mobile-friendly Design
|
||||
- **Basis vorhanden für 120+ goal-aware Platzhalter**
|
||||
|
||||
### Offene Gitea Issues
|
||||
- 🔲 **#49:** Prompt-Zuordnung zu Verlaufsseiten (6-8h)
|
||||
- 🔲 **#47:** Wertetabelle Optimierung (4-6h)
|
||||
- 🔲 **#46:** KI Prompt-Ersteller (später)
|
||||
- 🔲 **#45:** KI Prompt-Optimierer (später)
|
||||
- 🔲 **#43, #42:** Enhanced Debug UI (später)
|
||||
|
||||
---
|
||||
|
||||
## Option A: Issue #49 - Prompt Page Assignment ⚡
|
||||
|
||||
**Aufwand:** 6-8 Stunden
|
||||
**Priorität:** Medium
|
||||
**Typ:** UX Enhancement
|
||||
**Labels:** feature, ux, enhancement
|
||||
|
||||
### Beschreibung
|
||||
KI-Prompts flexibel auf verschiedenen Verlaufsseiten verfügbar machen. Jeder Prompt kann auf mehreren Seiten gleichzeitig angeboten werden (Mehrfachauswahl).
|
||||
|
||||
### Problem
|
||||
**Aktuell:**
|
||||
- Prompts nur über zentrale Analyse-Seite verfügbar
|
||||
- Kein kontextbezogener Zugriff auf relevante Analysen
|
||||
- User muss immer zur Analyse-Seite navigieren
|
||||
|
||||
**Beispiel-Szenario:**
|
||||
```
|
||||
User ist auf: Gewicht → Verlauf
|
||||
Will: Gewichtstrend analysieren
|
||||
Muss: Zur Analyse-Seite → Prompt auswählen → Zurück
|
||||
```
|
||||
|
||||
**Wünschenswert:**
|
||||
```
|
||||
User ist auf: Gewicht → Verlauf
|
||||
Sieht: "🤖 KI-Analyse" Widget mit relevanten Prompts
|
||||
Kann: Direkt "Gewichtstrend-Analyse" starten
|
||||
```
|
||||
|
||||
### Technische Umsetzung
|
||||
|
||||
**Backend (2h):**
|
||||
```sql
|
||||
-- Migration 023
|
||||
ALTER TABLE ai_prompts ADD COLUMN available_on JSONB DEFAULT '["analysis"]';
|
||||
|
||||
-- Beispiel:
|
||||
{
|
||||
"slug": "weight_trend",
|
||||
"available_on": ["analysis", "weight_history"]
|
||||
}
|
||||
```
|
||||
|
||||
**API:**
|
||||
```python
|
||||
# Neuer Endpoint
|
||||
GET /api/prompts/for-page/{page_slug}
|
||||
→ Returns: List[Prompt] where available_on contains page_slug
|
||||
|
||||
# CRUD erweitern
|
||||
PUT /api/prompts/unified/{id}
|
||||
→ Body: {..., "available_on": ["analysis", "weight_history"]}
|
||||
```
|
||||
|
||||
**Frontend (4h):**
|
||||
```javascript
|
||||
// Wiederverwendbare Komponente
|
||||
<PagePrompts pageSlug="weight_history" />
|
||||
|
||||
// UnifiedPromptModal erweitern
|
||||
const PAGE_OPTIONS = [
|
||||
{ value: 'analysis', label: '📊 Analyse (Hauptseite)', default: true },
|
||||
{ value: 'weight_history', label: '⚖️ Gewicht → Verlauf' },
|
||||
{ value: 'nutrition_history', label: '🍎 Ernährung → Verlauf' },
|
||||
// ... 9 Optionen total
|
||||
]
|
||||
|
||||
// Multi-select checkboxes in Prompt-Editor
|
||||
```
|
||||
|
||||
**Integration in Verlaufsseiten (2h):**
|
||||
- WeightPage, NutritionPage, ActivityPage erweitern
|
||||
- Widget unterhalb Charts einfügen
|
||||
- Modal für Inline-Analyse
|
||||
|
||||
### Vorteile
|
||||
- ✅ Schneller Nutzen (UX-Verbesserung sofort sichtbar)
|
||||
- ✅ Nutzt bestehendes Unified Prompt System (Issue #28)
|
||||
- ✅ Relativ einfache Implementierung
|
||||
- ✅ Bereitet vor für Phase 0b (neue Platzhalter dann sofort auf allen Seiten nutzbar)
|
||||
|
||||
### Nachteile
|
||||
- ⚠️ Verzögert strategische Tiefe (goal-aware Analysen)
|
||||
- ⚠️ Erst sinnvoll wenn mehr Prompts existieren
|
||||
|
||||
**Dokumentation:** Siehe `docs/issues/issue-51-prompt-page-assignment.md`
|
||||
|
||||
---
|
||||
|
||||
## Option B: Phase 0b - Goal-Aware Placeholders 🎯
|
||||
|
||||
**Aufwand:** 16-20 Stunden
|
||||
**Priorität:** High (strategisch kritisch)
|
||||
**Typ:** Core Feature
|
||||
**Labels:** feature, ai, goal-system
|
||||
|
||||
### Beschreibung
|
||||
Implementierung von 120+ neuen KI-Platzhaltern die `goal_mode` berücksichtigen. Verwandelt System von "Datensammler" zu "intelligentem Coach".
|
||||
|
||||
### Problem
|
||||
**Aktuell:**
|
||||
- Ziele existieren, aber KI-Analysen ignorieren sie
|
||||
- Gleiche Daten werden für alle goal_modes gleich interpretiert
|
||||
- Keine goal-spezifischen Score-Berechnungen
|
||||
|
||||
**Beispiel:**
|
||||
```python
|
||||
# Gleiche Messung: -5kg FM, -2kg LBM
|
||||
# Aktuell: Generischer Score (z.B. 50/100)
|
||||
|
||||
# Mit Phase 0b:
|
||||
goal_mode = "weight_loss" → 78/100 (FM↓ gut!)
|
||||
goal_mode = "strength" → 32/100 (LBM↓ Katastrophe!)
|
||||
goal_mode = "recomposition" → 65/100 (beides relevant)
|
||||
```
|
||||
|
||||
### Technische Umsetzung
|
||||
|
||||
**1. Placeholder Functions (8-10h):**
|
||||
|
||||
**Kategorie: KÖRPER (18 neue):**
|
||||
```python
|
||||
def weight_7d_rolling_median(profile_id, goal_mode):
|
||||
"""Rolling median statt avg für Stabilität"""
|
||||
|
||||
def weight_28d_trend_slope(profile_id, goal_mode):
|
||||
"""Linear regression slope - kg/Woche"""
|
||||
|
||||
def fm_28d_delta(profile_id, goal_mode):
|
||||
"""Fettmasse-Veränderung 28 Tage"""
|
||||
|
||||
def lbm_28d_delta(profile_id, goal_mode):
|
||||
"""Magermasse-Veränderung 28 Tage"""
|
||||
|
||||
def recomposition_score(profile_id, goal_mode):
|
||||
"""FM↓ + LBM↑ Balance-Score"""
|
||||
# Nur relevant wenn goal_mode = "recomposition"
|
||||
|
||||
def waist_to_hip_ratio(profile_id):
|
||||
"""WHR - Bauchfettverteilung"""
|
||||
|
||||
def waist_to_height_ratio(profile_id):
|
||||
"""WHtR - Gesundheitsrisiko"""
|
||||
```
|
||||
|
||||
**Kategorie: ERNÄHRUNG (15 neue):**
|
||||
```python
|
||||
def protein_g_per_kg(profile_id, goal_mode):
|
||||
"""Protein pro kg Körpergewicht"""
|
||||
# Target abhängig von goal_mode:
|
||||
# strength: 2.0-2.2g/kg
|
||||
# weight_loss: 1.8-2.0g/kg
|
||||
# endurance: 1.4-1.6g/kg
|
||||
|
||||
def protein_g_per_kg_lbm(profile_id):
|
||||
"""Protein pro kg Magermasse (präziser)"""
|
||||
|
||||
def nutrition_adherence_score(profile_id, goal_mode):
|
||||
"""Wie gut hält User seine Makro-Ziele ein?"""
|
||||
# Ziele abhängig von goal_mode
|
||||
|
||||
def energy_availability_status(profile_id):
|
||||
"""kcal - activity_kcal - BMR = verfügbare Energie"""
|
||||
# RED-S Warnung wenn < 30 kcal/kg LBM
|
||||
```
|
||||
|
||||
**Kategorie: AKTIVITÄT (25 neue):**
|
||||
```python
|
||||
def activity_quality_avg_28d(profile_id):
|
||||
"""Durchschnittliche Trainingsqualität"""
|
||||
|
||||
def activity_strain_28d(profile_id):
|
||||
"""Kumulierte Belastung (Monotonie-Detektion)"""
|
||||
|
||||
def activity_monotony_28d(profile_id):
|
||||
"""Variation im Training (Plateaus erkennen)"""
|
||||
|
||||
def ability_balance_score(profile_id, goal_mode):
|
||||
"""Balance zwischen Fähigkeiten (Strength/Cardio/Mobility)"""
|
||||
# Gewichtung abhängig von goal_mode
|
||||
```
|
||||
|
||||
**Kategorie: RECOVERY (12 neue):**
|
||||
```python
|
||||
def recovery_score(profile_id):
|
||||
"""
|
||||
Kombiniert: RHR + HRV + Sleep Quality + Rest Days
|
||||
Score: 0-100
|
||||
"""
|
||||
|
||||
def sleep_regularity_index(profile_id):
|
||||
"""Wie regelmäßig sind Schlafzeiten? (0-100)"""
|
||||
|
||||
def sleep_debt_hours(profile_id):
|
||||
"""Kumulierte Schlafdifferenz zu Ziel"""
|
||||
```
|
||||
|
||||
**Kategorie: KORRELATIONEN (8 neue):**
|
||||
```python
|
||||
def corr_energy_weight_lag(profile_id):
|
||||
"""
|
||||
Korrelation Kaloriendefizit → Gewicht
|
||||
Mit Lag-Analysis (verzögerte Effekte)
|
||||
Confidence-Score basierend auf Datenmenge
|
||||
"""
|
||||
|
||||
def plateau_detected(profile_id):
|
||||
"""
|
||||
Boolean: Gewicht stagniert trotz Defizit?
|
||||
Trigger für Interventionen
|
||||
"""
|
||||
```
|
||||
|
||||
**Kategorie: META (6 neue):**
|
||||
```python
|
||||
def goal_mode(profile_id):
|
||||
"""Aktueller goal_mode (für Prompts verfügbar)"""
|
||||
|
||||
def data_quality_score(profile_id):
|
||||
"""Wie vollständig/konsistent sind Daten? (0-100)"""
|
||||
|
||||
def profile_age_years(profile_id):
|
||||
"""Alter für altersabhängige Normen"""
|
||||
```
|
||||
|
||||
**2. Score-Gewichtung (4-6h):**
|
||||
|
||||
```python
|
||||
# backend/score_calculator.py (NEU)
|
||||
|
||||
SCORE_WEIGHTS = {
|
||||
"weight_loss": {
|
||||
"body_progress": 0.30, # FM↓ wichtig
|
||||
"nutrition": 0.25, # Defizit wichtig
|
||||
"training_quality": 0.15, # Moderat wichtig
|
||||
"recovery": 0.15, # Moderat wichtig
|
||||
"adherence": 0.15 # Konsistenz wichtig
|
||||
},
|
||||
"strength": {
|
||||
"body_progress": 0.35, # LBM↑ KRITISCH
|
||||
"nutrition": 0.30, # Surplus + Protein
|
||||
"training_quality": 0.25, # Progressive Overload
|
||||
"recovery": 0.10 # Weniger wichtig
|
||||
},
|
||||
"endurance": {
|
||||
"training_quality": 0.40, # VO2Max, Pace wichtig
|
||||
"recovery": 0.25, # Übertraining vermeiden
|
||||
"body_progress": 0.15, # Gewicht sekundär
|
||||
"nutrition": 0.20 # Energie-Verfügbarkeit
|
||||
},
|
||||
# ... recomposition, health
|
||||
}
|
||||
|
||||
def calculate_overall_score(profile_id, goal_mode):
|
||||
"""Berechnet Gesamt-Score basierend auf goal_mode Gewichtung"""
|
||||
weights = SCORE_WEIGHTS[goal_mode]
|
||||
|
||||
scores = {
|
||||
"body_progress": calculate_body_progress_score(profile_id, goal_mode),
|
||||
"nutrition": calculate_nutrition_score(profile_id, goal_mode),
|
||||
"training_quality": calculate_training_score(profile_id, goal_mode),
|
||||
"recovery": calculate_recovery_score(profile_id),
|
||||
"adherence": calculate_adherence_score(profile_id, goal_mode)
|
||||
}
|
||||
|
||||
overall = sum(scores[key] * weights[key] for key in weights)
|
||||
return {
|
||||
"overall": round(overall, 1),
|
||||
"breakdown": scores,
|
||||
"weights": weights
|
||||
}
|
||||
```
|
||||
|
||||
**3. Baseline-Berechnungen (2-3h):**
|
||||
|
||||
```python
|
||||
def calculate_baselines(profile_id):
|
||||
"""
|
||||
Berechnet persönliche Referenzwerte:
|
||||
- 7d baseline (kurzfristig)
|
||||
- 28d baseline (mittelfristig)
|
||||
- 90d baseline (langfristig)
|
||||
|
||||
Für: Gewicht, RHR, HRV, Kalorien, Protein, etc.
|
||||
"""
|
||||
|
||||
def detect_anomalies(profile_id, metric, value):
|
||||
"""
|
||||
Ist Wert außerhalb von ±2 SD vom Baseline?
|
||||
→ Warnung für User
|
||||
"""
|
||||
```
|
||||
|
||||
**4. Integration in Prompts (1-2h):**
|
||||
|
||||
```python
|
||||
# Beispiel Prompt-Template:
|
||||
"""
|
||||
Du bist ein KI-Coach für {{goal_mode}} Training.
|
||||
|
||||
Aktueller Status:
|
||||
- Gewichtstrend: {{weight_28d_trend_slope}} kg/Woche
|
||||
- Fettmasse Δ28d: {{fm_28d_delta}} kg
|
||||
- Magermasse Δ28d: {{lbm_28d_delta}} kg
|
||||
- Rekompositions-Score: {{recomposition_score}}/100
|
||||
|
||||
Ernährung:
|
||||
- Protein/kg: {{protein_g_per_kg}} g/kg (Ziel: {{protein_target_for_mode}})
|
||||
- Adherence: {{nutrition_adherence_score}}/100
|
||||
|
||||
Training:
|
||||
- Qualität (28d): {{activity_quality_avg_28d}}/5.0
|
||||
- Monotonie: {{activity_monotony_28d}} (Warnung bei >2.0)
|
||||
|
||||
Recovery:
|
||||
- Recovery Score: {{recovery_score}}/100
|
||||
- Schlafschuld: {{sleep_debt_hours}}h
|
||||
|
||||
Gesamt-Score ({{goal_mode}}-optimiert): {{overall_score}}/100
|
||||
|
||||
Analyse den Fortschritt aus Sicht eines {{goal_mode}} Ziels...
|
||||
"""
|
||||
```
|
||||
|
||||
### Vorteile
|
||||
- ✅ Größter strategischer Impact (System wird intelligent)
|
||||
- ✅ Ziele werden tatsächlich genutzt (nicht nur Display)
|
||||
- ✅ Basis für alle zukünftigen Features
|
||||
- ✅ Automatische Trainingsphasen-Erkennung möglich
|
||||
|
||||
### Nachteile
|
||||
- ⚠️ Hoher Aufwand (16-20h)
|
||||
- ⚠️ Komplexe Logik (viel Testing nötig)
|
||||
- ⚠️ Erfordert mehr Daten für sinnvolle Scores
|
||||
|
||||
---
|
||||
|
||||
## Option C: Issue #47 - Value Table Refinement 🔬
|
||||
|
||||
**Aufwand:** 4-6 Stunden
|
||||
**Priorität:** Low (Polishing)
|
||||
**Typ:** Enhancement
|
||||
|
||||
### Beschreibung
|
||||
Wertetabelle übersichtlicher gestalten - Normal-Modus nur Einzelwerte, Experten-Modus mit Stage-Rohdaten.
|
||||
|
||||
### Vorteile
|
||||
- ✅ Bessere UX für Value Table
|
||||
- ✅ Weniger Überforderung im Normal-Modus
|
||||
|
||||
### Nachteile
|
||||
- ⚠️ Kosmetisch, kein funktionaler Impact
|
||||
- ⚠️ Besser warten bis Phase 0b (dann 120+ Platzhalter)
|
||||
|
||||
**Empfehlung:** Später (nach Phase 0b)
|
||||
|
||||
---
|
||||
|
||||
## Empfehlung 🎯
|
||||
|
||||
### Szenario 1: "Quick Wins first"
|
||||
```
|
||||
1. Issue #49 - Prompt Assignment (6-8h)
|
||||
→ Bessere UX sofort
|
||||
|
||||
2. Phase 0b - Goal-Aware Placeholders (16-20h)
|
||||
→ Neue Platzhalter profitieren von Page Assignment
|
||||
→ Volle Power mit beiden Features
|
||||
|
||||
Total: 22-28h
|
||||
```
|
||||
|
||||
### Szenario 2: "Strategic Depth first"
|
||||
```
|
||||
1. Phase 0b - Goal-Aware Placeholders (16-20h)
|
||||
→ System wird intelligent
|
||||
|
||||
2. Issue #49 - Prompt Assignment (6-8h)
|
||||
→ Intelligente Prompts dann auf allen Seiten
|
||||
|
||||
Total: 22-28h
|
||||
```
|
||||
|
||||
### Persönliche Empfehlung: **Szenario 1**
|
||||
|
||||
**Begründung:**
|
||||
- Issue #49 ist relativ einfach und bringt sofort UX-Nutzen
|
||||
- Nutzt bestehendes Unified Prompt System optimal
|
||||
- Phase 0b profitiert dann von besserer Navigation
|
||||
- User kann neue Platzhalter (Phase 0b) direkt auf relevanten Seiten nutzen
|
||||
- Psychologisch: Zwei Erfolgserlebnisse statt einem großen
|
||||
|
||||
---
|
||||
|
||||
## Nächste Session: Action Items
|
||||
|
||||
**Falls Issue #49 gewählt:**
|
||||
1. [ ] Migration 023 erstellen (available_on JSONB)
|
||||
2. [ ] Backend: `/api/prompts/for-page/{slug}` Endpoint
|
||||
3. [ ] Backend: CRUD erweitern (available_on in PUT)
|
||||
4. [ ] Frontend: PAGE_OPTIONS in UnifiedPromptModal
|
||||
5. [ ] Frontend: PagePrompts Komponente (wiederverwendbar)
|
||||
6. [ ] Integration: WeightPage, NutritionPage, ActivityPage
|
||||
7. [ ] Testing: Multi-select, Modal-Inline-Analyse
|
||||
|
||||
**Falls Phase 0b gewählt:**
|
||||
1. [ ] Placeholder-Funktionen kategorieweise implementieren (KÖRPER → ERNÄHRUNG → AKTIVITÄT → RECOVERY → KORRELATIONEN → META)
|
||||
2. [ ] Score-Gewichtung pro goal_mode definieren
|
||||
3. [ ] Backend: score_calculator.py erstellen
|
||||
4. [ ] Baseline-Berechnungen implementieren
|
||||
5. [ ] Integration in bestehende Prompts
|
||||
6. [ ] Testing mit verschiedenen goal_modes
|
||||
|
||||
---
|
||||
|
||||
## Metriken & Timeline
|
||||
|
||||
**Geschätzte Timeline (bei 4h/Tag Entwicklung):**
|
||||
|
||||
| Szenario | Dauer | Fertig bis |
|
||||
|----------|-------|------------|
|
||||
| Issue #49 | 1.5-2 Tage | ~28.03.2026 |
|
||||
| Phase 0b | 4-5 Tage | ~31.03.2026 |
|
||||
| Szenario 1 (Quick Wins first) | 5.5-7 Tage | ~02.04.2026 |
|
||||
| Szenario 2 (Strategic first) | 5.5-7 Tage | ~02.04.2026 |
|
||||
|
||||
**Bei 8h/Tag Entwicklung:** Timeline halbiert sich (~01.04.2026)
|
||||
|
||||
---
|
||||
|
||||
**Erstellt:** 26. März 2026
|
||||
**Status:** Aktiv - Wartet auf Entscheidung
|
||||
**Nächste Aktualisierung:** Nach Completion von gewähltem Path
|
||||
@@ -0,0 +1,58 @@
|
||||
# Projekt-Dokumentation (`docs/` im Repository-Root)
|
||||
|
||||
Dieser Ordner ist **immer mit Git versioniert**. Er ergänzt **`.claude/docs/`** (Specs, Landkarten) – siehe [`.claude/README.md`](../.claude/README.md) und [`.claude/rules/DOCUMENTATION.md`](../.claude/rules/DOCUMENTATION.md).
|
||||
|
||||
---
|
||||
|
||||
## Was gehört wohin? (Kurz)
|
||||
|
||||
| Inhalt | Ort |
|
||||
|--------|-----|
|
||||
| Kanonische **fachliche** Spec (WAS) | `.claude/docs/functional/` |
|
||||
| Kanonische **technische** Spec (WIE) | `.claude/docs/technical/` |
|
||||
| **Arbeitspapiere**, Status, Analysen | `.claude/docs/working/` |
|
||||
| **Issue-Epics**, Abnahme-Dokus, große Plan-Markdowns | **`docs/issues/`** (hier) |
|
||||
| Platzhalter **Governance** (Deploy-Pfade noch `docs/`) | **`docs/PLACEHOLDER_*.md`** (hier) |
|
||||
| Membership v9c (Inhalt) | **`.claude/docs/technical/MEMBERSHIP_SYSTEM.md`** · Stub: [`MEMBERSHIP_SYSTEM.md`](./MEMBERSHIP_SYSTEM.md) |
|
||||
|
||||
---
|
||||
|
||||
## `docs/issues/` – Index
|
||||
|
||||
| Datei |
|
||||
|-------|
|
||||
| `GUI_IA_ADMIN_NAV_2026-04-05.md` |
|
||||
| `issue-50-phase-0a-goal-system.md` |
|
||||
| `issue-50-value-table-refinement.md` |
|
||||
| `issue-51-prompt-page-assignment.md` |
|
||||
| `issue-52-blood-pressure-dual-targets.md` |
|
||||
| `issue-53-phase-0c-multi-layer-architecture.md` |
|
||||
| `issue-54-dynamic-placeholder-system.md` |
|
||||
| `issue-55-dynamic-aggregation-methods.md` |
|
||||
| `PHASE_PLAN_RESPONSIVE_UI.md` |
|
||||
| `REVIEW_OPEN_ISSUES_2026-04-04.md` |
|
||||
| `UMSETZUNGSPLAN_TRAININGSPROFILE_SPORTSPEZIFISCH_2026-04-05.md` |
|
||||
|
||||
---
|
||||
|
||||
## Root in `docs/` (Governance & Verweise)
|
||||
|
||||
| Datei | Rolle |
|
||||
|-------|--------|
|
||||
| `PLACEHOLDER_GOVERNANCE.md` | Normen Platzhalter |
|
||||
| `PLACEHOLDER_METADATA_*.md` | Validierung, Deployment, Summary |
|
||||
| `MEMBERSHIP_SYSTEM.md` | Nur Verweis auf `.claude/docs/technical/` |
|
||||
|
||||
Arbeitspapier, die früher hier lagen (`STATUS_*`, `GOALS_*`, `NEXT_STEPS_*`, `phase-0c-placeholder-…`), sind nach **`.claude/docs/working/`** verschoben.
|
||||
|
||||
---
|
||||
|
||||
## Gitea
|
||||
|
||||
Issues: http://192.168.2.144:3000/Lars/mitai-jinkendo/issues
|
||||
|
||||
Themen-Übersicht (lokal): **`.claude/docs/GITEA_ISSUES_INDEX.md`**
|
||||
|
||||
---
|
||||
|
||||
**Stand:** 2026-04-08
|
||||
@@ -1,272 +0,0 @@
|
||||
# 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
|
||||
@@ -1,194 +0,0 @@
|
||||
# Status Report: 26. März 2026
|
||||
|
||||
## Audit & Synchronisation
|
||||
|
||||
Vollständige Überprüfung aller Dokumente und Gitea Issues durchgeführt.
|
||||
|
||||
---
|
||||
|
||||
## ✅ Abgeschlossene Arbeiten
|
||||
|
||||
### 1. Gitea Issue #28: AI-Prompts Flexibilisierung
|
||||
**Status:** ✅ CLOSED (26.03.2026)
|
||||
|
||||
**Implementierte Features:**
|
||||
- Unified Prompt System (4 Phasen)
|
||||
- DB-Migration zu einheitlichem Schema (base + pipeline)
|
||||
- Universeller Executor (prompt_executor.py)
|
||||
- Frontend UI Consolidation (UnifiedPromptModal)
|
||||
- Debug & Development Tools (Test-Button, Export/Import)
|
||||
- 32 aktive Platzhalter mit Kategorisierung
|
||||
- `{{placeholder|d}}` Modifier
|
||||
|
||||
**Commits:** 20+ commits (2e0838c bis ae6bd0d)
|
||||
**Dokumentation:** CLAUDE.md "Feature: Unified Prompt System"
|
||||
|
||||
**Gitea Aktion:** Issue geschlossen mit Completion-Kommentar
|
||||
|
||||
---
|
||||
|
||||
### 2. Gitea Issue #44: BUG - Analysen löschen
|
||||
**Status:** ✅ CLOSED (26.03.2026)
|
||||
|
||||
**Fix:**
|
||||
- Delete-Button in InsightCard hinzugefügt
|
||||
- `api.deleteInsight(id)` Funktion implementiert
|
||||
- Auth-Token wird korrekt übergeben
|
||||
- Liste aktualisiert sich nach Löschen
|
||||
|
||||
**Commit:** c56d2b2
|
||||
**Dokumentation:** Gitea-Kommentar mit Code-Beispiel
|
||||
|
||||
**Gitea Aktion:** Issue geschlossen mit Fix-Details
|
||||
|
||||
---
|
||||
|
||||
### 3. Feature: Comprehensive Value Table
|
||||
**Status:** ✅ Basis-Implementierung COMPLETE (26.03.2026)
|
||||
|
||||
**Implementierte Features:**
|
||||
- Metadata Collection System (alle Platzhalter mit Werten)
|
||||
- Expert Mode Toggle (🔬 Experten-Modus)
|
||||
- Stage Output Extraction (Einzelwerte aus JSON)
|
||||
- Category Grouping (PROFIL, KÖRPER, ERNÄHRUNG, etc.)
|
||||
- Collapsible JSON für Stage-Rohdaten
|
||||
- Best-of-Each circ_summary mit Altersangaben
|
||||
|
||||
**Commits:** 10+ commits (c0a50de bis 6e651b5, 159fcab)
|
||||
**Dokumentation:** CLAUDE.md "Feature: Comprehensive Value Table"
|
||||
|
||||
**Gitea:** Basis abgeschlossen, Issue #47 für Refinement erstellt
|
||||
|
||||
---
|
||||
|
||||
### 4. Placeholder System Enhancements
|
||||
**Status:** ✅ COMPLETE
|
||||
|
||||
**Fixes & Verbesserungen:**
|
||||
- `circ_summary`: Alle 8 Umfangspunkte (statt nur 3)
|
||||
- `circ_summary`: Best-of-Each mit Altersangaben ("heute", "vor 2 Wochen")
|
||||
- `sleep_avg_quality`: Lowercase stage names fix
|
||||
- `calculate_age`: PostgreSQL DATE object handling
|
||||
- Stage outputs in debug info für Value Table
|
||||
|
||||
**Commits:** 7daa2e4, a43a9f1, 3ad1a19, d06d3d8, 159fcab, 6e651b5
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Neue/Offene Issues
|
||||
|
||||
### Gitea Issue #47: Wertetabelle Optimierung
|
||||
**Status:** 🔲 OPEN (neu erstellt 26.03.2026)
|
||||
**Priority:** Medium
|
||||
**Aufwand:** 4-6 Stunden
|
||||
|
||||
**Ziel:** Value Table übersichtlicher gestalten
|
||||
|
||||
**Kernpunkte:**
|
||||
- Normal-Modus: Nur Einzelwerte (~24 statt 32)
|
||||
- Experten-Modus: Zusätzlich Stage-Rohdaten
|
||||
- Beschreibungen für alle 32 Platzhalter vervollständigen
|
||||
- Schema-basierte Beschreibungen für extrahierte Werte
|
||||
|
||||
**Dokumentation:** `docs/issues/issue-50-value-table-refinement.md`
|
||||
|
||||
---
|
||||
|
||||
## 📊 Gitea Issue Übersicht
|
||||
|
||||
### Geschlossen (heute)
|
||||
- ✅ #28: AI-Prompts Flexibilisierung
|
||||
- ✅ #44: BUG - Analysen löschen
|
||||
|
||||
### Neu erstellt (heute)
|
||||
- 🆕 #47: Wertetabelle Optimierung
|
||||
|
||||
### Weiterhin offen (Backlog)
|
||||
- 🔲 #25: Ziele-System (Goals)
|
||||
- 🔲 #26: Charts erweitern
|
||||
- 🔲 #27: Korrelationen & Insights
|
||||
- 🔲 #29: Abilities-Matrix UI
|
||||
- 🔲 #30: Responsive UI
|
||||
- 🔲 #42, #43: Enhanced Debug UI
|
||||
- 🔲 #45: KI Prompt-Optimierer
|
||||
- 🔲 #46: KI Prompt-Ersteller
|
||||
|
||||
### Bereits geschlossen (früher)
|
||||
- ✅ #24: Quality-Filter für KI-Auswertungen
|
||||
|
||||
---
|
||||
|
||||
## 📝 Dokumentations-Updates
|
||||
|
||||
### CLAUDE.md
|
||||
- ✅ "Letzte Updates (26.03.2026)" Sektion hinzugefügt
|
||||
- ✅ Gitea Issue-Referenzen klargestellt (Prefix "Gitea #")
|
||||
- ✅ Feature-Sections umbenannt (nicht "Issue #28/47")
|
||||
- ✅ "Claude Code Verantwortlichkeiten" Sektion
|
||||
- ✅ Issue-Management via Gitea API dokumentiert
|
||||
|
||||
### docs/issues/
|
||||
- ✅ issue-50-value-table-refinement.md erstellt
|
||||
- ℹ️ Weitere Files in .claude/issues/ (nicht versioniert)
|
||||
|
||||
### Gitea Kommentare
|
||||
- ✅ Issue #28: Completion-Details mit Features & Commits
|
||||
- ✅ Issue #44: Fix-Details mit Code-Beispiel
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Nächste Schritte
|
||||
|
||||
### Empfohlen (Kurzfristig)
|
||||
1. **Testing auf dev.mitai.jinkendo.de:**
|
||||
- Value Table im Experten-Modus testen
|
||||
- Stage-Outputs JSON Anzeige prüfen
|
||||
- circ_summary mit Altersangaben verifizieren
|
||||
|
||||
2. **Production Deployment:**
|
||||
- Develop → Main Merge (wenn Tests OK)
|
||||
- Alle Features (Unified Prompts + Value Table) deployen
|
||||
|
||||
3. **Issue #47 Refinement:**
|
||||
- Wertetabelle im Normal-Modus optimieren
|
||||
- Beschreibungen vervollständigen
|
||||
|
||||
### Optional (Mittelfristig)
|
||||
4. **Weitere offene Issues priorisieren:**
|
||||
- #25: Ziele-System (Phase 1)
|
||||
- #27: Korrelationen (Phase 2)
|
||||
- #30: Responsive UI (Phase 0)
|
||||
|
||||
---
|
||||
|
||||
## 📈 Metriken
|
||||
|
||||
**Commits (heute):** 12
|
||||
**Issues geschlossen:** 2 (#28, #44)
|
||||
**Issues erstellt:** 1 (#47)
|
||||
**Dokumentations-Updates:** 3 (CLAUDE.md, STATUS_REPORT, issue-50)
|
||||
**Gitea Kommentare:** 2
|
||||
|
||||
**Entwicklungszeit (geschätzt):** ~6-8 Stunden
|
||||
- circ_summary Enhancement: 1h
|
||||
- Stage Outputs Fix: 1h
|
||||
- Value Table Collapsible JSON: 1h
|
||||
- Issue-Management System: 1h
|
||||
- Dokumentation & Sync: 2-4h
|
||||
|
||||
---
|
||||
|
||||
## ✅ Verifizierung
|
||||
|
||||
- [x] Alle Gitea Issues überprüft (47 Issues total)
|
||||
- [x] Abgeschlossene Arbeiten identifiziert (#28, #44)
|
||||
- [x] Issues in Gitea geschlossen
|
||||
- [x] Completion-Kommentare hinzugefügt
|
||||
- [x] CLAUDE.md aktualisiert
|
||||
- [x] Status Report erstellt
|
||||
- [x] Entwicklungs-Dokumentation aktuell
|
||||
|
||||
**Audit durchgeführt von:** Claude Code
|
||||
**Datum:** 26. März 2026, 14:55 Uhr
|
||||
**Branch:** develop
|
||||
**Letzter Commit:** 582f125
|
||||
@@ -1,284 +0,0 @@
|
||||
# Goal System - TODO & Offene Punkte
|
||||
|
||||
**Erstellt:** 27. März 2026
|
||||
**Status:** Aktiv
|
||||
**Zweck:** Zentrale Tracking-Liste für Goal System Entwicklung
|
||||
|
||||
---
|
||||
|
||||
## ✅ Erledigt (27.03.2026)
|
||||
|
||||
### Phase 0a: Minimal Goal System (26.03.2026)
|
||||
- ✅ Migration 022 (goal_mode, goals, training_phases, fitness_tests)
|
||||
- ✅ Backend Router goals.py (490 Zeilen)
|
||||
- ✅ Frontend GoalsPage (570 Zeilen)
|
||||
- ✅ Navigation Integration (Dashboard + Analysis)
|
||||
|
||||
### Phase 1: Quick Fixes (27.03.2026)
|
||||
- ✅ goal_utils.py Abstraction Layer
|
||||
- ✅ Primary Goal Toggle Fix
|
||||
- ✅ Lean Mass Berechnung
|
||||
- ✅ VO2Max Spaltenname Fix
|
||||
|
||||
---
|
||||
|
||||
## 🔲 Nächste Schritte (Priorität)
|
||||
|
||||
### Phase 1.5: Flexibles Goal System - DB-Registry ✅ KOMPLETT (27.03.2026)
|
||||
|
||||
**Status:** ✅ ABGESCHLOSSEN
|
||||
**Priorität:** CRITICAL (blockt Phase 0b)
|
||||
**Aufwand:** 8h (geplant 8-12h)
|
||||
**Entscheidung:** 27.03.2026 - Option B gewählt
|
||||
|
||||
**Problem:**
|
||||
- Aktuelles System: Hardcoded goal types (nur 8 Typen möglich)
|
||||
- Jedes neue Ziel braucht Code-Änderung + Deploy
|
||||
- Zukünftige Ziele (Meditation, Rituale, Planabweichung) nicht möglich
|
||||
|
||||
**Lösung: DB-Registry**
|
||||
- Goal Types in Datenbank definiert
|
||||
- Admin UI: Neue Ziele ohne Code erstellen
|
||||
- Universal Value Fetcher (konfigurierbar)
|
||||
- User kann eigene Custom-Metriken definieren
|
||||
|
||||
**Tasks:**
|
||||
- ✅ Migration 024: goal_type_definitions Tabelle
|
||||
- ✅ Backend: Universal Value Fetcher (_fetch_latest, _fetch_avg, _fetch_count)
|
||||
- ✅ Backend: CRUD API für Goal Type Definitions
|
||||
- ✅ Frontend: Dynamisches Goal Types Dropdown
|
||||
- ✅ Admin UI: Goal Type Management Page
|
||||
- ✅ Seed Data: 8 existierende Typen migriert
|
||||
- 🔲 Testing: Alle Goals + Custom Goal erstellen (NEXT)
|
||||
|
||||
**Warum JETZT (vor Phase 0b)?**
|
||||
- Phase 0b Platzhalter nutzen Goals für Score-Berechnungen
|
||||
- Flexible Goals → automatisch in Platzhaltern verfügbar
|
||||
- Später umbauen = 120+ Platzhalter anpassen (Doppelarbeit)
|
||||
|
||||
**Dokumentation:** Siehe unten "Flexibles Goal System Details"
|
||||
|
||||
---
|
||||
|
||||
### Phase 0b: Goal-Aware Placeholders (NACH 1.5 - 16-20h)
|
||||
|
||||
**Status:** 🔲 BEREIT ZUM START (Phase 1.5 ✅)
|
||||
**Priorität:** HIGH (strategisch kritisch)
|
||||
**Aufwand:** 16-20h
|
||||
**Blockt:** Intelligente KI-Analysen
|
||||
|
||||
**Tasks:**
|
||||
- [ ] 18 KÖRPER Platzhalter (weight_7d_rolling_median, fm_28d_delta, lbm_28d_delta, recomposition_score, etc.)
|
||||
- [ ] 15 ERNÄHRUNG Platzhalter (protein_g_per_kg, nutrition_adherence_score, energy_availability_status, etc.)
|
||||
- [ ] 25 AKTIVITÄT Platzhalter (activity_quality_avg_28d, activity_strain_28d, ability_balance_score, etc.)
|
||||
- [ ] 12 RECOVERY Platzhalter (recovery_score, sleep_regularity_index, sleep_debt_hours, etc.)
|
||||
- [ ] 8 KORRELATIONEN Platzhalter (corr_energy_weight_lag, plateau_detected, etc.)
|
||||
- [ ] 6 META Platzhalter (goal_mode, data_quality_score, profile_age_years, etc.)
|
||||
- [ ] Score-Gewichtung pro goal_mode (SCORE_WEIGHTS Dictionary)
|
||||
- [ ] Baseline-Berechnungen (7d/28d/90d Referenzwerte)
|
||||
- [ ] Integration in bestehende Prompts
|
||||
|
||||
**Vorteile:**
|
||||
- System wird "intelligent" (kein Datensammler mehr)
|
||||
- Ziele werden tatsächlich genutzt
|
||||
- Basis für automatische Trainingsphasen-Erkennung
|
||||
|
||||
**Dokumentation:** `docs/NEXT_STEPS_2026-03-26.md` (Zeile 116-300)
|
||||
|
||||
---
|
||||
|
||||
### v2.0 Redesign (SPÄTER - 8-10h)
|
||||
|
||||
**Status:** 📋 KONZEPTION
|
||||
**Priorität:** MEDIUM (nach Phase 0b & User-Feedback)
|
||||
**Aufwand:** 8-10h (dank Abstraction Layer)
|
||||
|
||||
**Probleme zu lösen:**
|
||||
1. ❌ Primärziel zu simplistisch (nur 1 erlaubt)
|
||||
2. ❌ Goal Mode zu simpel (nur 1 Modus wählbar)
|
||||
3. ✅ Fehlende Current Values (ERLEDIGT in Phase 1)
|
||||
4. ❌ Abstrakte Zieltypen (strength, flexibility)
|
||||
5. ❌ Blutdruck braucht 2 Werte (systolisch/diastolisch)
|
||||
6. ❌ Keine Guidance für User (Richtwerte fehlen)
|
||||
|
||||
**Lösung:**
|
||||
- Migration 023: focus_areas Tabelle mit Gewichtungssystem
|
||||
- UI: Slider für 6 Fokus-Bereiche (Summe = 100%)
|
||||
- Backend: `get_focus_weights()` V2 Implementierung (eine Funktion!)
|
||||
- Compound Goals für BP
|
||||
- Konkrete Test-basierte Goals (Cooper, Plank, etc.)
|
||||
- Richtwerte & Normen in UI
|
||||
|
||||
**Dokumentation:** `docs/GOAL_SYSTEM_REDESIGN_v2.md`
|
||||
|
||||
**Entscheidung:** ⏳ Wartet auf User-Feedback nach Phase 0b
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Verwandte Issues
|
||||
|
||||
### Gitea (http://192.168.2.144:3000/Lars/mitai-jinkendo/issues)
|
||||
- **#49:** Prompt-Zuordnung zu Verlaufsseiten (6-8h, Quick Win)
|
||||
- **#47:** Wertetabelle Optimierung (4-6h, Polishing)
|
||||
- **#50:** Phase 0a Goal System (✅ CLOSED)
|
||||
|
||||
### Interne Docs
|
||||
- `docs/issues/issue-50-phase-0a-goal-system.md` (✅ Completed)
|
||||
- `docs/issues/issue-51-prompt-page-assignment.md` (#49 Spec)
|
||||
|
||||
---
|
||||
|
||||
## 📊 Roadmap-Übersicht
|
||||
|
||||
| Phase | Was | Status | Aufwand |
|
||||
|-------|-----|--------|---------|
|
||||
| **Phase 0a** | Minimal Goal System | ✅ DONE | 3-4h |
|
||||
| **Phase 1** | Quick Fixes + Abstraction | ✅ DONE | 4-6h |
|
||||
| **Phase 1.5** | 🆕 **Flexibles Goal System (DB-Registry)** | ✅ **DONE** | 8h |
|
||||
| **Phase 0b** | Goal-Aware Placeholders | 🔲 READY | 16-20h |
|
||||
| **Issue #49** | Prompt Page Assignment | 🔲 OPEN | 6-8h |
|
||||
| **v2.0** | Redesign (Focus Areas) | 📋 LATER | 8-10h |
|
||||
|
||||
**Total Roadmap:** ~45-60h bis vollständiges intelligentes Goal System
|
||||
|
||||
**KRITISCH:** Phase 1.5 MUSS vor Phase 0b abgeschlossen sein, sonst Doppelarbeit!
|
||||
|
||||
---
|
||||
|
||||
## 💡 Wichtige Notizen
|
||||
|
||||
### Abstraction Layer (Keine Doppelarbeit!)
|
||||
**Datei:** `backend/goal_utils.py`
|
||||
|
||||
```python
|
||||
get_focus_weights(conn, profile_id)
|
||||
```
|
||||
|
||||
- **V1 (jetzt):** Mappt goal_mode → Gewichte
|
||||
- **V2 (v2.0):** Liest focus_areas Tabelle
|
||||
- **Vorteil:** 120+ Phase 0b Platzhalter müssen NICHT umgeschrieben werden
|
||||
|
||||
### Testing Checklist (nach jedem Deploy)
|
||||
- [ ] Goal Mode ändern → Gewichtung korrekt?
|
||||
- [ ] Primäres Ziel setzen → Andere auf false?
|
||||
- [ ] Lean Mass Ziel → Current Value berechnet?
|
||||
- [ ] VO2Max Ziel → Kein Server Error?
|
||||
- [ ] Mehrere Ziele → Progress korrekt?
|
||||
|
||||
---
|
||||
|
||||
## 📅 Timeline
|
||||
|
||||
| Datum | Event |
|
||||
|-------|-------|
|
||||
| 26.03.2026 | Phase 0a Complete |
|
||||
| 27.03.2026 | Phase 1 Complete (Quick Fixes) |
|
||||
| 28.03.2026 | **Phase 0b Start (geplant)** |
|
||||
| 02.04.2026 | Phase 0b Complete (geschätzt bei 4h/Tag) |
|
||||
| 04.04.2026 | v2.0 Redesign (wenn validiert) |
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Flexibles Goal System - Technische Details
|
||||
|
||||
### Architektur: DB-Registry Pattern
|
||||
|
||||
**Vorher (Phase 0a/1):**
|
||||
```javascript
|
||||
// Frontend: Hardcoded
|
||||
const GOAL_TYPES = {
|
||||
weight: { label: 'Gewicht', unit: 'kg', icon: '⚖️' }
|
||||
}
|
||||
|
||||
// Backend: Hardcoded if/elif
|
||||
if goal_type == 'weight':
|
||||
cur.execute("SELECT weight FROM weight_log...")
|
||||
elif goal_type == 'body_fat':
|
||||
cur.execute("SELECT body_fat_pct FROM caliper_log...")
|
||||
```
|
||||
|
||||
**Nachher (Phase 1.5):**
|
||||
```sql
|
||||
-- Datenbank: Konfigurierbare Goal Types
|
||||
CREATE TABLE goal_type_definitions (
|
||||
type_key VARCHAR(50) UNIQUE,
|
||||
label_de VARCHAR(100),
|
||||
unit VARCHAR(20),
|
||||
icon VARCHAR(10),
|
||||
category VARCHAR(50),
|
||||
source_table VARCHAR(50),
|
||||
source_column VARCHAR(50),
|
||||
aggregation_method VARCHAR(20), -- latest, avg_7d, count_7d, etc.
|
||||
calculation_formula TEXT, -- JSON für komplexe Berechnungen
|
||||
is_system BOOLEAN -- System-Typen nicht löschbar
|
||||
);
|
||||
```
|
||||
|
||||
```python
|
||||
# Backend: Universal Fetcher
|
||||
def get_current_value_for_goal(conn, profile_id, goal_type):
|
||||
"""Liest Config aus DB, führt Query aus"""
|
||||
config = get_goal_type_config(conn, goal_type)
|
||||
|
||||
if config['calculation_formula']:
|
||||
return execute_formula(conn, profile_id, config['calculation_formula'])
|
||||
else:
|
||||
return fetch_by_method(
|
||||
conn, profile_id,
|
||||
config['source_table'],
|
||||
config['source_column'],
|
||||
config['aggregation_method']
|
||||
)
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Frontend: Dynamisch
|
||||
const goalTypes = await api.getGoalTypeDefinitions()
|
||||
// Lädt aktuell verfügbare Typen von API
|
||||
```
|
||||
|
||||
### Vorteile:
|
||||
|
||||
**Flexibilität:**
|
||||
- ✅ Neue Ziele via Admin UI (KEIN Code-Deploy)
|
||||
- ✅ User kann Custom-Metriken definieren
|
||||
- ✅ Zukünftige Module automatisch integriert
|
||||
|
||||
**Beispiele neuer Ziele:**
|
||||
- 🧘 Meditation (min/Tag) → `meditation_log.duration_minutes`, avg_7d
|
||||
- 📅 Trainingshäufigkeit (x/Woche) → `activity_log.id`, count_7d
|
||||
- 📊 Planabweichung (%) → `activity_log.planned_vs_actual`, avg_30d
|
||||
- 🎯 Ritual-Adherence (%) → `rituals_log.completed`, avg_30d
|
||||
- 💤 Schlafqualität (%) → `sleep_log.quality_score`, avg_7d
|
||||
|
||||
**Integration mit Phase 0b:**
|
||||
- Platzhalter nutzen `get_current_value_for_goal()` → automatisch alle Typen verfügbar
|
||||
- Neue Ziele → sofort in KI-Analysen nutzbar
|
||||
- Keine Platzhalter-Anpassungen nötig
|
||||
|
||||
---
|
||||
|
||||
**Letzte Aktualisierung:** 27. März 2026 (Phase 1.5 ✅ ABGESCHLOSSEN)
|
||||
**Nächste Aktualisierung:** Nach Phase 0b Completion
|
||||
|
||||
---
|
||||
|
||||
## 🎉 Phase 1.5 Completion Report (27.03.2026)
|
||||
|
||||
**Commits:**
|
||||
- `65ee5f8` - Phase 1.5 Part 1/2 (Backend, Migration, Universal Fetcher)
|
||||
- `640ef81` - Phase 1.5 Part 2/2 (Frontend Dynamic, Admin UI) - **COMPLETE**
|
||||
|
||||
**Implementiert:**
|
||||
1. ✅ DB-Registry für Goal Types (8 System Types seeded)
|
||||
2. ✅ Universal Value Fetcher (8 Aggregationsmethoden)
|
||||
3. ✅ CRUD API (admin-only, System Types geschützt)
|
||||
4. ✅ Dynamic Frontend (keine hardcoded Types mehr)
|
||||
5. ✅ Admin UI (vollständiges CRUD Interface)
|
||||
|
||||
**System ist jetzt flexibel:**
|
||||
- Neue Goal Types via UI ohne Code-Deploy
|
||||
- Phase 0b Platzhalter nutzen automatisch alle Types
|
||||
- Custom Metrics möglich (Meditation, Rituale, etc.)
|
||||
|
||||
**Ready für Phase 0b:** 120+ Goal-Aware Placeholders 🚀
|
||||
@@ -133,7 +133,7 @@ listFitnessTests(), createFitnessTest(data)
|
||||
|
||||
## Dokumentation
|
||||
|
||||
- ✅ `docs/GOALS_SYSTEM_UNIFIED_ANALYSIS.md` (538 Zeilen)
|
||||
- ✅ `.claude/docs/working/GOALS_SYSTEM_UNIFIED_ANALYSIS.md` (538 Zeilen)
|
||||
- Analyse beider Fachkonzepte (Konzept v2 + GOALS_VITALS.md)
|
||||
- Zwei-Ebenen-Architektur erklärt
|
||||
- 120+ Placeholder-Kategorisierung für Phase 0b
|
||||
@@ -221,7 +221,7 @@ goal_mode = "health"
|
||||
- Score-Berechnungen mit goal_mode
|
||||
- Größter strategischer Impact
|
||||
|
||||
**Siehe:** `docs/NEXT_STEPS_2026-03-26.md` für detaillierte Planung
|
||||
**Siehe:** `.claude/docs/working/NEXT_STEPS_2026-03-26.md` für detaillierte Planung
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,422 +0,0 @@
|
||||
# Phase 0c: Placeholder Migration Analysis
|
||||
|
||||
**Erstellt:** 28. März 2026
|
||||
**Zweck:** Analyse welche Platzhalter zu Data Layer migriert werden müssen
|
||||
|
||||
---
|
||||
|
||||
## Gesamt-Übersicht
|
||||
|
||||
**Aktuelle Platzhalter:** 116
|
||||
**Nach Phase 0c Migration:**
|
||||
- ✅ **Bleiben einfach (kein Data Layer):** 8 Platzhalter
|
||||
- 🔄 **Gehen zu Data Layer:** 108 Platzhalter
|
||||
|
||||
---
|
||||
|
||||
## Kategorisierung: BLEIBEN EINFACH (8 Platzhalter)
|
||||
|
||||
Diese Platzhalter bleiben im KI Layer (placeholder_resolver.py) weil sie:
|
||||
- Keine Berechnungen durchführen
|
||||
- Keine Daten-Aggregation benötigen
|
||||
- Einfache Getter oder Konstanten sind
|
||||
|
||||
### Zeitraum (4 Platzhalter)
|
||||
```python
|
||||
'{{datum_heute}}': lambda pid: datetime.now().strftime('%d.%m.%Y')
|
||||
'{{zeitraum_7d}}': lambda pid: 'letzte 7 Tage'
|
||||
'{{zeitraum_30d}}': lambda pid: 'letzte 30 Tage'
|
||||
'{{zeitraum_90d}}': lambda pid: 'letzte 90 Tage'
|
||||
```
|
||||
**Begründung:** Konstanten oder einfache Datum-Formatierung. Kein Data Layer nötig.
|
||||
|
||||
### Profil - Basis (4 Platzhalter)
|
||||
```python
|
||||
'{{name}}': lambda pid: get_profile_data(pid).get('name', 'Nutzer')
|
||||
'{{age}}': lambda pid: calculate_age(get_profile_data(pid).get('dob'))
|
||||
'{{height}}': lambda pid: str(get_profile_data(pid).get('height', 'unbekannt'))
|
||||
'{{geschlecht}}': lambda pid: 'männlich' if get_profile_data(pid).get('sex') == 'm' else 'weiblich'
|
||||
```
|
||||
**Begründung:** Direkte Getter aus profiles Tabelle. Keine Aggregation.
|
||||
|
||||
---
|
||||
|
||||
## GEHEN ZU DATA LAYER (108 Platzhalter)
|
||||
|
||||
### 1. Körper (20 Platzhalter) → `data_layer.body_metrics`
|
||||
|
||||
#### Basis-Metriken (8):
|
||||
```python
|
||||
'{{weight_aktuell}}' → get_weight_trend_data()['last_value']
|
||||
'{{weight_trend}}' → get_weight_trend_data() (formatiert)
|
||||
'{{kf_aktuell}}' → get_body_composition_data()['body_fat_pct'][-1]
|
||||
'{{bmi}}' → get_body_composition_data() (berechnet)
|
||||
'{{caliper_summary}}' → get_caliper_summary_data()
|
||||
'{{circ_summary}}' → get_circumference_summary()
|
||||
'{{goal_weight}}' → get_active_goals() (filtered)
|
||||
'{{goal_bf_pct}}' → get_active_goals() (filtered)
|
||||
```
|
||||
|
||||
#### Phase 0b - Advanced Body (12):
|
||||
```python
|
||||
'{{weight_7d_median}}' → get_weight_trend_data()['rolling_median_7d'][-1]
|
||||
'{{weight_28d_slope}}' → get_weight_trend_data()['slope_28d']
|
||||
'{{weight_90d_slope}}' → get_weight_trend_data()['slope_90d']
|
||||
'{{fm_28d_change}}' → get_body_composition_data()['fm_delta_28d']
|
||||
'{{lbm_28d_change}}' → get_body_composition_data()['lbm_delta_28d']
|
||||
'{{waist_28d_delta}}' → get_circumference_summary()['changes']['waist_28d']
|
||||
'{{hip_28d_delta}}' → get_circumference_summary()['changes']['hip_28d']
|
||||
'{{chest_28d_delta}}' → get_circumference_summary()['changes']['chest_28d']
|
||||
'{{arm_28d_delta}}' → get_circumference_summary()['changes']['arm_28d']
|
||||
'{{thigh_28d_delta}}' → get_circumference_summary()['changes']['thigh_28d']
|
||||
'{{waist_hip_ratio}}' → get_circumference_summary()['ratios']['waist_to_hip']
|
||||
'{{recomposition_quadrant}}'→ get_body_composition_data()['recomposition_score']
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_weight_trend_data(profile_id, days=90)`
|
||||
- `get_body_composition_data(profile_id, days=90)`
|
||||
- `get_circumference_summary(profile_id, days=90)`
|
||||
- `get_caliper_summary_data(profile_id, days=90)`
|
||||
|
||||
---
|
||||
|
||||
### 2. Ernährung (14 Platzhalter) → `data_layer.nutrition_metrics`
|
||||
|
||||
#### Basis-Metriken (7):
|
||||
```python
|
||||
'{{kcal_avg}}' → get_energy_balance_data()['avg_intake']
|
||||
'{{protein_avg}}' → get_protein_adequacy_data()['avg_protein_g']
|
||||
'{{carb_avg}}' → get_macro_distribution_data()['avg_carbs_g']
|
||||
'{{fat_avg}}' → get_macro_distribution_data()['avg_fat_g']
|
||||
'{{nutrition_days}}' → get_energy_balance_data()['data_points']
|
||||
'{{protein_ziel_low}}' → get_protein_adequacy_data()['target_protein_g'] (low)
|
||||
'{{protein_ziel_high}}' → get_protein_adequacy_data()['target_protein_g'] (high)
|
||||
```
|
||||
|
||||
#### Phase 0b - Advanced Nutrition (7):
|
||||
```python
|
||||
'{{energy_balance_7d}}' → get_energy_balance_data()['avg_net']
|
||||
'{{energy_deficit_surplus}}'→ get_energy_balance_data()['deficit_surplus_avg']
|
||||
'{{protein_g_per_kg}}' → get_protein_adequacy_data()['avg_protein_per_kg']
|
||||
'{{protein_days_in_target}}'→ get_protein_adequacy_data()['adherence_pct']
|
||||
'{{protein_adequacy_28d}}' → get_protein_adequacy_data()['adherence_score']
|
||||
'{{macro_consistency_score}}'→ get_macro_distribution_data()['balance_score']
|
||||
'{{intake_volatility}}' → get_macro_distribution_data()['variability']
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_protein_adequacy_data(profile_id, days=28, goal_mode=None)`
|
||||
- `get_energy_balance_data(profile_id, days=28)`
|
||||
- `get_macro_distribution_data(profile_id, days=28)`
|
||||
|
||||
---
|
||||
|
||||
### 3. Training (16 Platzhalter) → `data_layer.activity_metrics`
|
||||
|
||||
#### Basis-Metriken (3):
|
||||
```python
|
||||
'{{activity_summary}}' → get_training_volume_data()['weekly_totals'] (formatted)
|
||||
'{{activity_detail}}' → get_training_volume_data()['by_type'] (formatted)
|
||||
'{{trainingstyp_verteilung}}'→ get_activity_quality_distribution()
|
||||
```
|
||||
|
||||
#### Phase 0b - Advanced Activity (13):
|
||||
```python
|
||||
'{{training_minutes_week}}' → get_training_volume_data()['weekly_totals'][0]['duration_min']
|
||||
'{{training_frequency_7d}}' → get_training_volume_data()['weekly_totals'][0]['sessions']
|
||||
'{{quality_sessions_pct}}' → get_activity_quality_distribution()['high_quality_pct']
|
||||
'{{ability_balance_strength}}' → get_ability_balance_data()['abilities']['strength']
|
||||
'{{ability_balance_endurance}}'→ get_ability_balance_data()['abilities']['cardio']
|
||||
'{{ability_balance_mental}}' → get_ability_balance_data()['abilities']['mental']
|
||||
'{{ability_balance_coordination}}'→ get_ability_balance_data()['abilities']['coordination']
|
||||
'{{ability_balance_mobility}}' → get_ability_balance_data()['abilities']['mobility']
|
||||
'{{proxy_internal_load_7d}}'→ get_training_volume_data()['strain']
|
||||
'{{monotony_score}}' → get_training_volume_data()['monotony']
|
||||
'{{strain_score}}' → get_training_volume_data()['strain']
|
||||
'{{rest_day_compliance}}' → get_recovery_score_data()['components']['rest_compliance']['score']
|
||||
'{{vo2max_trend_28d}}' → get_vitals_baseline_data()['vo2_max']['trend']
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_training_volume_data(profile_id, weeks=4)`
|
||||
- `get_activity_quality_distribution(profile_id, days=28)`
|
||||
- `get_ability_balance_data(profile_id, weeks=4)`
|
||||
|
||||
---
|
||||
|
||||
### 4. Schlaf & Erholung (10 Platzhalter) → `data_layer.recovery_metrics`
|
||||
|
||||
#### Basis-Metriken (3):
|
||||
```python
|
||||
'{{sleep_avg_duration}}' → get_sleep_regularity_data()['avg_duration_h']
|
||||
'{{sleep_avg_quality}}' → get_sleep_regularity_data()['avg_quality']
|
||||
'{{rest_days_count}}' → get_recovery_score_data()['components']['rest_compliance']['rest_days']
|
||||
```
|
||||
|
||||
#### Phase 0b - Advanced Recovery (7):
|
||||
```python
|
||||
'{{hrv_vs_baseline_pct}}' → get_vitals_baseline_data()['hrv']['deviation_pct']
|
||||
'{{rhr_vs_baseline_pct}}' → get_vitals_baseline_data()['rhr']['deviation_pct']
|
||||
'{{sleep_avg_duration_7d}}' → get_sleep_regularity_data()['avg_duration_h']
|
||||
'{{sleep_debt_hours}}' → get_sleep_regularity_data()['sleep_debt_h']
|
||||
'{{sleep_regularity_proxy}}'→ get_sleep_regularity_data()['regularity_score']
|
||||
'{{recent_load_balance_3d}}'→ get_recovery_score_data()['load_balance']
|
||||
'{{sleep_quality_7d}}' → get_sleep_regularity_data()['avg_quality']
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_recovery_score_data(profile_id, days=7)`
|
||||
- `get_sleep_regularity_data(profile_id, days=28)`
|
||||
- `get_vitals_baseline_data(profile_id, days=7)`
|
||||
|
||||
---
|
||||
|
||||
### 5. Vitalwerte (3 Platzhalter) → `data_layer.health_metrics`
|
||||
|
||||
```python
|
||||
'{{vitals_avg_hr}}' → get_vitals_baseline_data()['rhr']['current']
|
||||
'{{vitals_avg_hrv}}' → get_vitals_baseline_data()['hrv']['current']
|
||||
'{{vitals_vo2_max}}' → get_vitals_baseline_data()['vo2_max']['current']
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_vitals_baseline_data(profile_id, days=7)` (bereits in recovery)
|
||||
|
||||
---
|
||||
|
||||
### 6. Scores (6 Platzhalter) → Diverse Module
|
||||
|
||||
```python
|
||||
'{{goal_progress_score}}' → get_goal_progress_data() → goals.py
|
||||
'{{body_progress_score}}' → get_body_composition_data() → body_metrics.py
|
||||
'{{nutrition_score}}' → get_protein_adequacy_data() → nutrition_metrics.py
|
||||
'{{activity_score}}' → get_training_volume_data() → activity_metrics.py
|
||||
'{{recovery_score}}' → get_recovery_score_data()['score'] → recovery_metrics.py
|
||||
'{{data_quality_score}}' → get_data_quality_score() → utils.py (NEW)
|
||||
```
|
||||
|
||||
**Hinweis:** Scores nutzen bestehende Data Layer Funktionen, nur Formatierung nötig.
|
||||
|
||||
---
|
||||
|
||||
### 7. Top Goals/Focus (5 Platzhalter) → `data_layer.goals`
|
||||
|
||||
```python
|
||||
'{{top_goal_name}}' → get_active_goals()[0]['name']
|
||||
'{{top_goal_progress_pct}}' → get_active_goals()[0]['progress_pct']
|
||||
'{{top_goal_status}}' → get_active_goals()[0]['status']
|
||||
'{{top_focus_area_name}}' → get_weighted_focus_areas()[0]['name']
|
||||
'{{top_focus_area_progress}}'→ get_weighted_focus_areas()[0]['progress']
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_active_goals(profile_id)` (already exists from Phase 0b)
|
||||
- `get_weighted_focus_areas(profile_id)` (already exists from Phase 0b)
|
||||
|
||||
---
|
||||
|
||||
### 8. Category Scores (14 Platzhalter) → Formatierung nur
|
||||
|
||||
```python
|
||||
'{{focus_cat_körper_progress}}' → _format_from_aggregated_data()
|
||||
'{{focus_cat_körper_weight}}' → _format_from_aggregated_data()
|
||||
'{{focus_cat_ernährung_progress}}' → _format_from_aggregated_data()
|
||||
'{{focus_cat_ernährung_weight}}' → _format_from_aggregated_data()
|
||||
# ... (7 Kategorien × 2 = 14 total)
|
||||
```
|
||||
|
||||
**Hinweis:** Diese nutzen bereits aggregierte Daten aus Phase 0b.
|
||||
**Migration:** Nur KI Layer Formatierung, Data Layer nicht nötig (Daten kommen aus anderen Funktionen).
|
||||
|
||||
---
|
||||
|
||||
### 9. Korrelationen (7 Platzhalter) → `data_layer.correlations`
|
||||
|
||||
```python
|
||||
'{{correlation_energy_weight_lag}}' → get_correlation_data(pid, 'energy', 'weight')
|
||||
'{{correlation_protein_lbm}}' → get_correlation_data(pid, 'protein', 'lbm')
|
||||
'{{correlation_load_hrv}}' → get_correlation_data(pid, 'load', 'hrv')
|
||||
'{{correlation_load_rhr}}' → get_correlation_data(pid, 'load', 'rhr')
|
||||
'{{correlation_sleep_recovery}}' → get_correlation_data(pid, 'sleep', 'recovery')
|
||||
'{{plateau_detected}}' → detect_plateau(pid, 'weight')
|
||||
'{{top_drivers}}' → get_top_drivers(pid)
|
||||
```
|
||||
|
||||
**Data Layer Funktionen benötigt:**
|
||||
- `get_correlation_data(profile_id, metric_a, metric_b, days=90, max_lag=7)`
|
||||
- `detect_plateau(profile_id, metric, days=28)`
|
||||
- `get_top_drivers(profile_id)` (NEW - identifies top correlations)
|
||||
|
||||
---
|
||||
|
||||
### 10. JSON/Markdown (8 Platzhalter) → Formatierung nur
|
||||
|
||||
```python
|
||||
'{{active_goals_json}}' → json.dumps(get_active_goals(pid))
|
||||
'{{active_goals_md}}' → format_as_markdown(get_active_goals(pid))
|
||||
'{{focus_areas_weighted_json}}' → json.dumps(get_weighted_focus_areas(pid))
|
||||
'{{focus_areas_weighted_md}}' → format_as_markdown(get_weighted_focus_areas(pid))
|
||||
'{{focus_area_weights_json}}' → json.dumps(get_focus_area_weights(pid))
|
||||
'{{top_3_focus_areas}}' → format_top_3(get_weighted_focus_areas(pid))
|
||||
'{{top_3_goals_behind_schedule}}' → format_goals_behind(get_active_goals(pid))
|
||||
'{{top_3_goals_on_track}}' → format_goals_on_track(get_active_goals(pid))
|
||||
```
|
||||
|
||||
**Hinweis:** Diese nutzen bereits existierende Data Layer Funktionen.
|
||||
**Migration:** Nur KI Layer Formatierung (json.dumps, markdown, etc.).
|
||||
|
||||
---
|
||||
|
||||
## Data Layer Funktionen - Zusammenfassung
|
||||
|
||||
### Neue Funktionen zu erstellen (Phase 0c):
|
||||
|
||||
#### body_metrics.py (4 Funktionen):
|
||||
- ✅ `get_weight_trend_data()`
|
||||
- ✅ `get_body_composition_data()`
|
||||
- ✅ `get_circumference_summary()`
|
||||
- ✅ `get_caliper_summary_data()`
|
||||
|
||||
#### nutrition_metrics.py (3 Funktionen):
|
||||
- ✅ `get_protein_adequacy_data()`
|
||||
- ✅ `get_energy_balance_data()`
|
||||
- ✅ `get_macro_distribution_data()`
|
||||
|
||||
#### activity_metrics.py (3 Funktionen):
|
||||
- ✅ `get_training_volume_data()`
|
||||
- ✅ `get_activity_quality_distribution()`
|
||||
- ✅ `get_ability_balance_data()`
|
||||
|
||||
#### recovery_metrics.py (2 Funktionen):
|
||||
- ✅ `get_recovery_score_data()`
|
||||
- ✅ `get_sleep_regularity_data()`
|
||||
|
||||
#### health_metrics.py (2 Funktionen):
|
||||
- ✅ `get_vitals_baseline_data()`
|
||||
- ✅ `get_blood_pressure_data()` (aus Spec)
|
||||
|
||||
#### goals.py (3 Funktionen):
|
||||
- ✅ `get_active_goals()` (exists from Phase 0b)
|
||||
- ✅ `get_weighted_focus_areas()` (exists from Phase 0b)
|
||||
- ✅ `get_goal_progress_data()` (aus Spec)
|
||||
|
||||
#### correlations.py (3 Funktionen):
|
||||
- ✅ `get_correlation_data()`
|
||||
- ✅ `detect_plateau()`
|
||||
- 🆕 `get_top_drivers()` (NEW - not in spec)
|
||||
|
||||
#### utils.py (Shared):
|
||||
- ✅ `calculate_confidence()`
|
||||
- ✅ `calculate_baseline()`
|
||||
- ✅ `detect_outliers()`
|
||||
- ✅ `aggregate_data()`
|
||||
- ✅ `serialize_dates()`
|
||||
- 🆕 `get_data_quality_score()` (NEW)
|
||||
|
||||
**Total neue Funktionen:** 20 (aus Spec) + 2 (zusätzlich) = **22 Data Layer Funktionen**
|
||||
|
||||
---
|
||||
|
||||
## Migration-Aufwand pro Kategorie
|
||||
|
||||
| Kategorie | Platzhalter | Data Layer Funcs | Aufwand | Priorität |
|
||||
|-----------|-------------|------------------|---------|-----------|
|
||||
| Körper | 20 | 4 | 3-4h | High |
|
||||
| Ernährung | 14 | 3 | 2-3h | High |
|
||||
| Training | 16 | 3 | 3-4h | Medium |
|
||||
| Recovery | 10 | 2 | 2-3h | Medium |
|
||||
| Vitalwerte | 3 | 1 (shared) | 0.5h | Low |
|
||||
| Scores | 6 | 0 (use others) | 1h | Low |
|
||||
| Goals/Focus | 5 | 0 (exists) | 0.5h | Low |
|
||||
| Categories | 14 | 0 (formatting) | 1h | Low |
|
||||
| Korrelationen | 7 | 3 | 2-3h | Medium |
|
||||
| JSON/Markdown | 8 | 0 (formatting) | 0.5h | Low |
|
||||
| **TOTAL** | **108** | **22** | **16-22h** | - |
|
||||
|
||||
---
|
||||
|
||||
## KI Layer Refactoring-Muster
|
||||
|
||||
**VORHER (Phase 0b):**
|
||||
```python
|
||||
def get_latest_weight(profile_id: str) -> str:
|
||||
"""Returns latest weight with SQL + formatting"""
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute("""
|
||||
SELECT weight FROM weight_log
|
||||
WHERE profile_id = %s
|
||||
ORDER BY date DESC LIMIT 1
|
||||
""", (profile_id,))
|
||||
row = cur.fetchone()
|
||||
if not row:
|
||||
return "nicht verfügbar"
|
||||
return f"{row['weight']:.1f} kg"
|
||||
|
||||
PLACEHOLDER_MAP = {
|
||||
'{{weight_aktuell}}': get_latest_weight,
|
||||
}
|
||||
```
|
||||
|
||||
**NACHHER (Phase 0c):**
|
||||
```python
|
||||
from data_layer.body_metrics import get_weight_trend_data
|
||||
|
||||
def resolve_weight_aktuell(profile_id: str) -> str:
|
||||
"""Returns latest weight (formatted for KI)"""
|
||||
data = get_weight_trend_data(profile_id, days=7)
|
||||
|
||||
if data['confidence'] == 'insufficient':
|
||||
return "nicht verfügbar"
|
||||
|
||||
return f"{data['last_value']:.1f} kg"
|
||||
|
||||
PLACEHOLDER_MAP = {
|
||||
'{{weight_aktuell}}': resolve_weight_aktuell,
|
||||
}
|
||||
```
|
||||
|
||||
**Reduzierung:** Von ~15 Zeilen (SQL + Logic) zu ~7 Zeilen (Call + Format)
|
||||
|
||||
---
|
||||
|
||||
## Erwartetes Ergebnis nach Phase 0c
|
||||
|
||||
### Zeilen-Reduktion:
|
||||
- **placeholder_resolver.py:**
|
||||
- Vorher: ~1200 Zeilen
|
||||
- Nachher: ~400 Zeilen (67% Reduktion)
|
||||
|
||||
### Code-Qualität:
|
||||
- ✅ Keine SQL queries in placeholder_resolver.py
|
||||
- ✅ Keine Berechnungslogik in placeholder_resolver.py
|
||||
- ✅ Nur Formatierung für KI-Consumption
|
||||
|
||||
### Wiederverwendbarkeit:
|
||||
- ✅ 22 Data Layer Funktionen nutzbar für:
|
||||
- KI Layer (108 Platzhalter)
|
||||
- Charts Layer (10+ Charts)
|
||||
- API Endpoints (beliebig erweiterbar)
|
||||
|
||||
---
|
||||
|
||||
## Checkliste: Migration pro Platzhalter
|
||||
|
||||
Für jeden der **108 Platzhalter**:
|
||||
|
||||
```
|
||||
[ ] Data Layer Funktion existiert
|
||||
[ ] KI Layer ruft Data Layer Funktion auf
|
||||
[ ] Formatierung für KI korrekt
|
||||
[ ] Fehlerbehandlung (insufficient data)
|
||||
[ ] Test: Platzhalter liefert gleichen Output wie vorher
|
||||
[ ] In PLACEHOLDER_MAP registriert
|
||||
[ ] Dokumentiert
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Erstellt:** 28. März 2026
|
||||
**Status:** Ready for Phase 0c Implementation
|
||||
**Nächster Schritt:** Data Layer Funktionen implementieren (Start mit utils.py)
|
||||
@@ -1,64 +0,0 @@
|
||||
# Test-Prompt für Phase 0b - Goal-Aware Placeholders
|
||||
|
||||
## Schnelltest-Prompt für Calculation Engine
|
||||
|
||||
**Zweck:** Validierung der 100+ Phase 0b Placeholders ohne JSON-Formatters
|
||||
|
||||
### Test-Prompt (in Admin UI → KI-Prompts erstellen):
|
||||
|
||||
```
|
||||
Du bist ein Fitness-Coach. Analysiere den Fortschritt:
|
||||
|
||||
## Gesamtfortschritt
|
||||
- Goal Progress Score: {{goal_progress_score}}/100
|
||||
- Body: {{body_progress_score}}/100
|
||||
- Nutrition: {{nutrition_score}}/100
|
||||
- Activity: {{activity_score}}/100
|
||||
- Recovery: {{recovery_score}}/100
|
||||
|
||||
## Kategorie-Fortschritte
|
||||
- Körper: {{focus_cat_körper_progress}}% (Prio: {{focus_cat_körper_weight}}%)
|
||||
- Ernährung: {{focus_cat_ernährung_progress}}% (Prio: {{focus_cat_ernährung_weight}}%)
|
||||
- Aktivität: {{focus_cat_aktivität_progress}}% (Prio: {{focus_cat_aktivität_weight}}%)
|
||||
|
||||
## Körper-Metriken
|
||||
- Gewicht 7d: {{weight_7d_median}} kg
|
||||
- FM Änderung 28d: {{fm_28d_change}} kg
|
||||
- LBM Änderung 28d: {{lbm_28d_change}} kg
|
||||
- Rekomposition: {{recomposition_quadrant}}
|
||||
|
||||
## Ernährung
|
||||
- Energiebilanz: {{energy_balance_7d}} kcal/Tag
|
||||
- Protein g/kg: {{protein_g_per_kg}}
|
||||
- Protein Adequacy: {{protein_adequacy_28d}}/100
|
||||
|
||||
## Aktivität
|
||||
- Minuten/Woche: {{training_minutes_week}}
|
||||
- Qualität: {{quality_sessions_pct}}%
|
||||
- Kraft-Balance: {{ability_balance_strength}}/100
|
||||
|
||||
## Recovery
|
||||
- HRV vs Baseline: {{hrv_vs_baseline_pct}}%
|
||||
- Schlaf 7d: {{sleep_avg_duration_7d}}h
|
||||
- Schlafqualität: {{sleep_quality_7d}}/100
|
||||
|
||||
Gib 3 konkrete Empfehlungen basierend auf den schwächsten Scores.
|
||||
```
|
||||
|
||||
### Erwartetes Verhalten:
|
||||
✅ Alle Placeholders lösen auf (numerisch oder "nicht verfügbar")
|
||||
✅ Keine Python Exceptions
|
||||
✅ Scores haben Werte 0-100 oder "nicht verfügbar"
|
||||
|
||||
### Test-Schritte:
|
||||
1. Admin → KI-Prompts → "Neu erstellen"
|
||||
2. Type: "base", Name: "Phase 0b Quick Test"
|
||||
3. Template einfügen
|
||||
4. "Test" Button → Profil wählen
|
||||
5. Debug-Viewer prüfen: "Unresolved Placeholders" sollte leer sein
|
||||
6. Wenn Errors: Console Log prüfen
|
||||
|
||||
### Bekannte Limitierungen (aktuell):
|
||||
- JSON-Formatters (active_goals_json, etc.) → geben leere Arrays
|
||||
- Top Goal Name → "nicht verfügbar" (needs goal_utils extension)
|
||||
- Correlations → Placeholder-Werte (noch nicht echte Berechnungen)
|
||||
Reference in new issue
Block a user