feat(csv-import): Enhance Apple sleep CSV import functionality
- Integrated date parsing improvements using dateutil for better handling of various date formats in sleep data. - Added total sleep hours to the nights dictionary for comprehensive sleep analysis. - Updated the import logic to handle cases where sleep duration is zero, providing appropriate warnings. - Enhanced the CSV import interface to detect Apple sleep CSV format and provide user feedback on template selection. - Improved the admin CSV template editor to accommodate new sleep import requirements and clarify usage instructions.
This commit is contained in:
1 parent
26ab11eb7b
commit
41cc0ed2a8
6 files changed
+223
-54
No files matched your search
@@ -0,0 +1,27 @@
|
||||
-- Migration 045: Schlaf-Systemvorlage — Signatur wie „Schlafanalyse“-Export (Date/Time, Sources, …)
|
||||
-- Ergänzt die Vorlage aus 044 für besseres Matching; Import-Logik unverändert (Apple-Aggregat-Parser).
|
||||
|
||||
UPDATE csv_field_mappings
|
||||
SET
|
||||
column_signature = ARRAY[
|
||||
'Date/Time',
|
||||
'Start',
|
||||
'End',
|
||||
'Total Sleep (hr)',
|
||||
'Asleep (Unspecified) (hr)',
|
||||
'In Bed (hr)',
|
||||
'Core (hr)',
|
||||
'Deep (hr)',
|
||||
'REM (hr)',
|
||||
'Awake (hr)',
|
||||
'Sources'
|
||||
]::TEXT[],
|
||||
description = COALESCE(
|
||||
description,
|
||||
'Apple-Health-Schlafanalyse (Nacht-Zusammenfassung): Spalten wie Date/Time, Start/End mit Zeitzone, Kern/Tief/REM etc.'
|
||||
),
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE is_system = true
|
||||
AND profile_id IS NULL
|
||||
AND module = 'sleep'
|
||||
AND mapping_name = 'Apple Health Schlaf (Schlafanalyse / Nacht)';
|
||||
Reference in new issue
Block a user