Skip to content

feat: add PM2.5/AQI cigarettes-per-day equivalent - #1132

Open
vedant7007 wants to merge 1 commit into
Aditya8369:mainfrom
vedant7007:feat/cigarette-equivalent
Open

feat: add PM2.5/AQI cigarettes-per-day equivalent#1132
vedant7007 wants to merge 1 commit into
Aditya8369:mainfrom
vedant7007:feat/cigarette-equivalent

Conversation

@vedant7007

Copy link
Copy Markdown
Contributor

What & why

Closes #1131.

Makes air-quality numbers visceral by expressing exposure as an equivalent number of cigarettes/day (Berkeley Earth: ~22 µg/m³ PM2.5 over a day ≈ 1 cigarette).

Changes

  • src/utils/cigaretteEquivalent.js — pure pm25ToCigarettes(pm25) and aqiToCigarettes(aqi). The AQI path reuses the existing aqiToPm25 from exposureModel.js (no duplicated AQI math). Non-finite / non-positive input returns 0.
  • src/components/CigaretteEquivalent.jsx — small card rendering ≈ N cigarettes/day; returns null for clean air (0) so it never shows a meaningless "0 cigarettes". Accepts aqi or raw pm25.

Testing

  • cigaretteEquivalent.test.js (6) + CigaretteEquivalent.test.jsx (3) → 9/9 green via vitest run.
  • eslint on all four new files → clean.

Note: this branch is off main, whose build job is currently red due to three pre-existing syntax errors (App.jsx / Leaderboard.jsx / NoisePollutionTracker.jsx) — fixed in companion PR #1130. This feature touches none of those files; once #1130 lands the build goes green here.

Contributing as part of Elite Coders Summer of Code (ECSoC 2026).

pm25ToCigarettes / aqiToCigarettes (Berkeley Earth: ~22 ug/m3 PM2.5 per
day per cigarette); the AQI path reuses exposureModel's aqiToPm25. Adds
a small CigaretteEquivalent card that hides itself for clean air.

Closes Aditya8369#1131
@vedant7007
vedant7007 requested a review from Aditya8369 as a code owner August 29, 2026 15:44
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@vedant7007 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 github-actions Bot added the ECSoC26 Contributions considered under ECSoC'26 label Aug 29, 2026
@github-actions

Copy link
Copy Markdown

Thank You for Your Contribution! 🎉

Hi @vedant7007,

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! 🚀

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.

Add PM2.5/AQI to cigarettes-per-day equivalent (util + card)

1 participant