feat(schema, csv_parser): Update activity log schema and parsing logic
Deploy Development / deploy (push) Successful in 48s
Build Test / pytest-backend (push) Successful in 3s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Increased precision for `kcal_active`, `kcal_resting`, `hr_avg`, and `hr_max` fields in the activity log schema.
- Added a new function `_activity_hr_bpm` to validate heart rate values during CSV import, ensuring they fall within plausible ranges.
- Updated the CSV parser to utilize the new heart rate validation function for improved data integrity.
- Enhanced the type converter to accommodate additional aliases for energy fields in CSV imports.
- Added a test to verify conversion of active energy from kJ to kcal, ensuring accurate data handling.
This commit is contained in:
Lars committed 2026-04-11 06:41:23 +02:00
1 parent 08a2485f43
commit 6945b748cb
7 files changed
+70 -11

No files matched your search

+4 -4
View File
@@ -160,10 +160,10 @@ CREATE TABLE IF NOT EXISTS activity_log (
end_time TIME,
activity_type VARCHAR(50) NOT NULL,
duration_min NUMERIC(6,2),
kcal_active NUMERIC(7,2),
kcal_resting NUMERIC(7,2),
hr_avg NUMERIC(5,2),
hr_max NUMERIC(5,2),
kcal_active NUMERIC(12,2),
kcal_resting NUMERIC(12,2),
hr_avg NUMERIC(6,2),
hr_max NUMERIC(6,2),
distance_km NUMERIC(7,2),
rpe INTEGER CHECK (rpe >= 1 AND rpe <= 10),
source VARCHAR(20) DEFAULT 'manual',