Skip to content

Fix/weekly aggregation and aliases 1134 - #1185

Closed
MILAN-123865 wants to merge 3 commits into
Aditya8369:mainfrom
MILAN-123865:fix/weekly-aggregation-and-aliases-1134
Closed

MILAN-123865 wants to merge 3 commits into
Aditya8369:mainfrom
MILAN-123865:fix/weekly-aggregation-and-aliases-1134

Conversation

@MILAN-123865

Copy link
Copy Markdown
Contributor

Pull Request

Description

Please provide a brief summary of your changes.


Related Issue

Closes #


Type of Change

  • Bug Fix
  • New Feature
  • Documentation
  • UI/UX Improvement
  • Refactoring
  • Performance Improvement
  • Accessibility

Changes Made


Testing

  • Tested locally
  • No console errors
  • Existing functionality works as expected

Screenshots

If applicable, attach screenshots or screen recordings.


Checklist

  • My code follows the project guidelines.
  • I have tested my changes.
  • I have updated the documentation if required.
  • My changes address the related issue.
  • This PR focuses on a single issue.

Additional Notes

Add any additional information for reviewers here.

Summary of Changes
Unique Weekly Bucket Keying:

Replaced day-of-month week ordinal (${startOfWeek.getFullYear()}-W${Math.ceil(startOfWeek.getDate() / 7)}) with ISO date format of the week's starting Monday (YYYY-MM-DD).
Ensures weeks spanning across different months (e.g. Jan, Feb, Mar) generate unique bucket keys (2026-01-05, 2026-02-02, 2026-03-02) and do not aggregate together into 2026-W1.
Keeps rawTime unique and sortable across all granularities.
Unified Field Alias Resolution:

Extracted getPollutantValue(item, key) helper function.
Standardized alias resolution for us_aqi (maxAqi, aqi, AQI), pm2_5 (pm25, PM2.5), pm10 (pm10, PM10), nitrogen_dioxide (no2, NO2), ozone (ozone, Ozone), and carbon_monoxide (co, CO).
Replaced broken string.replace('_', '') in the hourly path so both hourly and bucketed (3h, daily, weekly) granularities use identical alias resolution logic.
Unit Tests:

Added unit test cases for getPollutantValue alias matching, hourly multi-alias aggregation, and multi-month weekly bucket separation (7/7 tests passed).
Verified ESLint with 0 errors.

closes #1134

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@MILAN-123865 is attempting to deploy a commit to the Aditya Mahajan's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

Thank You for Your Contribution! 🎉

Hi @MILAN-123865,

Thank you for opening this Pull Request and contributing to our project. We truly appreciate your efforts.

Please make sure that:

  • Your code follows the project's guidelines.
  • You have linked the appropriate issue (if applicable).
  • Screenshots are added for UI/UX changes.
  • Your PR is ready for review.

The maintainer @Aditya8369 will review your PR shortly!

Happy Contributing! 🚀

@github-actions github-actions Bot added the ECSoC26 Contributions considered under ECSoC'26 label Aug 31, 2026
@Aditya8369 Aditya8369 closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26 Contributions considered under ECSoC'26

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weekly granularity merges different months into one bar: aggregateData keys weeks by day-of-month, so Jan, Feb and Mar all become "2026-W1"

2 participants