feat: Apple Health CSV import for sleep data (v9d Phase 2c)
Backend: - New endpoint POST /api/sleep/import/apple-health - Parses Apple Health sleep CSV format - Maps German phase names (Kern→light, REM→rem, Tief→deep, Wach→awake) - Aggregates segments by night (wake date) - Stores raw segments in JSONB (sleep_segments) - Does NOT overwrite manual entries (source='manual') Frontend: - Import button in SleepPage with file picker - Progress indicator during import - Success/error messages - Auto-refresh after import Documentation: - Added architecture rules reference to CLAUDE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b65efd3b71
commit
b1a92c01fc
4 files changed
+272
-27
No files matched your search
@@ -223,4 +223,11 @@ export const api = {
|
||||
getSleepDebt: (days=14) => req(`/sleep/debt?days=${days}`),
|
||||
getSleepTrend: (days=30) => req(`/sleep/trend?days=${days}`),
|
||||
getSleepPhases: (days=30) => req(`/sleep/phases?days=${days}`),
|
||||
|
||||
// Sleep Import (v9d Phase 2c)
|
||||
importAppleHealthSleep: (file) => {
|
||||
const fd = new FormData()
|
||||
fd.append('file', file)
|
||||
return req('/sleep/import/apple-health', {method:'POST', body:fd})
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user