debug: add logging to Apple Health import to diagnose skipped rows
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:
parent
7dcab1d7a3
commit
6a7b78c3eb
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user