debug: add logging to Apple Health import to diagnose skipped rows
All checks were successful
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s

Logs:
- CSV column names from first row
- Rows skipped due to missing date
- Rows skipped due to no vitals data
- Shows which fields were found/missing

Helps diagnose CSV format mismatches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-23 16:38:18 +01:00
parent 7dcab1d7a3
commit 6a7b78c3eb

View File

@ -311,10 +311,18 @@ async def import_apple_health_baseline(
with get_db() as conn:
cur = get_cursor(conn)
# Log available columns for debugging
first_row = True
for row in reader:
try:
if first_row:
logger.info(f"CSV Columns: {list(row.keys())}")
first_row = False
date = row.get('Start')[:10] if row.get('Start') else None
if not date:
logger.warning(f"Skipped row (no date): Start='{row.get('Start')}'")
skipped += 1
continue
@ -327,6 +335,7 @@ async def import_apple_health_baseline(
# Skip if no baseline vitals
if not any([rhr, hrv, vo2, spo2, resp_rate]):
logger.warning(f"Skipped row {date} (no vitals): RHR={rhr}, HRV={hrv}, VO2={vo2}, SpO2={spo2}, RespRate={resp_rate}")
skipped += 1
continue