Fix: Estimated AQI now matches Current AQI when Scenario Simulator sliders are at 0%#114
Merged
Aditya8369 merged 1 commit intoJul 9, 2026
Conversation
|
@AimaMuzammil 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. |
Contributor
Author
|
Hi @Aditya8369! This PR fixes Issue #113. Could you please review it |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🎉 Your PR just got merged, @AimaMuzammil — thank you for contributing to Pollution Control Hub! Your work is now part of the project. Here's what to do next:
We really appreciate you taking the time. See you in the next PR! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #113 — The Scenario Simulator was showing a reduced "Estimated AQI"
even when all intervention sliders were at 0% and no policy scenario was
selected.
Root Cause
The
estimatedAqivalue was always recalculated using the localestimateAQI()function, even when no reduction was applied. Since thisfunction uses a different formula than the one used by the Open-Meteo API
(which provides
current.us_aqi), the two values could differ slightlyeven with identical pollutant inputs.
Fix
Added a
hasReductioncheck: if all sliders are at 0% (no reductionselected),
estimatedAqinow usescurrent.us_aqidirectly instead ofrecalculating it. The same fix was applied to the
simulateCity()function used for the city comparison cards, to prevent the same issue
there.
Testing Done
Clean Fuel Switch, Combined Policy) — Estimated AQI still correctly
decreases based on the selected reduction
Chennai, Hyderabad) — all showing correct before/after values
Before (bug):

Sliders at 0%, but Estimated AQI shows a fake -29% reduction (77 → 55)
After (fixed):

Sliders at 0%, Current AQI and Estimated AQI now match exactly (77 → 77)
I'm an ECSoC'26 contributor in the UI Components track.