Skip to content

Commit 41bd037

Browse files
ryan-williamsclaude
andcommitted
fix(lambda): use FIELDS constant for consistent parquet column order
When creating new monthly parquet files, the hardcoded column list had wrong order and was missing `pm10`. This caused February 2026 data to be written with scrambled columns, making the frontend display wrong metrics (CO2 showing humidity values, etc.). Now imports `FIELDS` from `storage.py` to ensure consistent column order across all parquet files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b1fe8c6 commit 41bd037

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/awair/lmbda/updater.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ def update_s3_data():
8787
with atomic_edit(s3_bucket, s3_key, create_ok=True, download=file_exists) as tmp_path:
8888
tmp_path = Path(tmp_path)
8989

90-
# If file doesn't exist, create empty DataFrame
90+
# If file doesn't exist, create empty DataFrame with correct column order
9191
if not tmp_path.exists():
9292
print('Creating initial parquet file')
93-
empty_df = pd.DataFrame(columns=['timestamp', 'temp', 'humid', 'co2', 'voc', 'pm25'])
93+
from awair.storage import FIELDS
94+
empty_df = pd.DataFrame(columns=FIELDS)
9495
empty_df.to_parquet(tmp_path, index=False, row_group_size=DEFAULT_ROW_GROUP_SIZE)
9596

9697
# Use ParquetStorage to manage updates

0 commit comments

Comments
 (0)