Skip to content

feat: historical pollution explorer(#892) - #893

Open
PrathamReddy888 wants to merge 6 commits into
Aditya8369:mainfrom
PrathamReddy888:FEATURE]-📊-Historical-Pollution-Explorer-#892

Hidden character warning

The head ref may contain hidden characters: "FEATURE]-\ud83d\udcca-Historical-Pollution-Explorer-#892"
Open

feat: historical pollution explorer(#892)#893
PrathamReddy888 wants to merge 6 commits into
Aditya8369:mainfrom
PrathamReddy888:FEATURE]-📊-Historical-Pollution-Explorer-#892

Conversation

@PrathamReddy888

@PrathamReddy888 PrathamReddy888 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

Closes #892.

Adds an interactive Historical Pollution Explorer that lets users investigate pollution across years, cities, and pollutants in a single view. Example use case — "compare Pune's PM2.5 between January and August" — is now a one-click preset ("Jan – Aug (this year)").

This builds on the existing historicalDataService.js (Open-Meteo fetch + IndexedDB cache) and historicalAggregate.js (hourly → daily rollup) by adding a higher-level aggregation layer (weekly / monthly / yearly resampling), moving-average computation, period-over-period percentage change, and a multi-location comparison overlay.


Related Issue

Closes #892


Type of Change

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

Changes Made

  • New utility module: historicalExplorer.js with pure helpers (resampling, moving average, % change, half-range change, highest periods, CSV generation).
  • New service wrapper: historicalExplorerService.js with single-city and multi-city fetch (parallel via Promise.allSettled).
  • New component: HistoricalPollutionExplorer.jsx with city multi-select, pollutant selector, view toggle, chart-type toggle, date presets, stats strip, charts with moving-average overlay + safe-limit reference line, multi-city comparison chart, highest-periods list, and CSV export.
  • Integration: App.jsx updated with import, nav entry, and render branch.
  • Tests: 42 unit tests — 34 for helpers, 8 for component (service + recharts + i18n mocked).

Testing

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

Test Coverage:

  • historicalExplorer.test.js: 34 cases covering resampling, moving average, % change, half-range change, highest-periods ranking, CSV generation.
  • HistoricalPollutionExplorer.test.jsx: 8 cases covering loading, success render, error state, multi-city comparison, CSV export, pollutant switching, view switching, highest-periods list.

Screenshots

not applicable


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

  • Architecture decisions:

    • Pure helpers (no React/fetch) for unit-testability.
    • Reuses existing fetch + cache + aggregate pipeline.
    • Promise.allSettled ensures multi-city fetch resilience.
    • SAFE_LIMITS reused for reference lines.
    • Two CSV schemas: daily (existing format) vs aggregated (new).
    • Moving average overlay only on daily view.
  • Out of scope / follow-ups:

    • Add i18n keys for new strings.
    • "Save view as shareable URL" feature.
    • Per-city CSV export in comparison mode.

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

@PrathamReddy888 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 @PrathamReddy888,

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 20, 2026
@Aditya8369

Copy link
Copy Markdown
Owner

@PrathamReddy888 change the branch name and push again

@PrathamReddy888 PrathamReddy888 changed the title feat(explorer): historical pollution explorer with multi-city comparison (#892) feat: historical pollution explorer(#892) Aug 21, 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.

[FEATURE] 📊 Historical Pollution Explorer

2 participants