Skip to content

fix: adopt 2024 EPA PM2.5 AQI breakpoints for cross-platform alignment#6273

Merged
jamesarich merged 1 commit into
mainfrom
claude/pm25-2024-epa-breakpoints-6272
Jul 15, 2026
Merged

fix: adopt 2024 EPA PM2.5 AQI breakpoints for cross-platform alignment#6273
jamesarich merged 1 commit into
mainfrom
claude/pm25-2024-epa-breakpoints-6272

Conversation

@jamesarich

@jamesarich jamesarich commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Why

Part of the cross-platform AQI alignment work (meshtastic/design#54). iOS is landing a computed EPA NowCast AQI (meshtastic/Meshtastic-Apple#2075) built on the current (2024) EPA PM2.5 24-hour breakpoint table. Android's already-merged implementation (#6102) used the legacy (pre-2024) table, so the same PM2.5 reading produced a different AQI per platform — exactly the divergence design#54 exists to prevent.

This lands the 2024 table on Android before the iOS feature ships, so the two never present diverging curves.

Fixes #6272.

🐛 Changes

Swapped the PM2.5 breakpoint constants in core/model/.../util/AirQualityIndex.kt from the legacy table to the current 2024 EPA table (AQS parameter 88101):

PM2.5 (µg/m³) legacy AQI PM2.5 (µg/m³) 2024 AQI
0.0–12.0 0–50 0.0–9.0 0–50
12.1–35.4 51–100 9.1–35.4 51–100
35.5–55.4 101–150 35.5–55.4 101–150
55.5–150.4 151–200 55.5–125.4 151–200
150.5–250.4 201–300 125.5–225.4 201–300
250.5–500.4 301–500 225.5–325.4 301–500

Constants only. The NowCast weighting (12h rolling window, 0.5 min weight factor) and the Equation-1 linear interpolation are untouched.

🛠️ Testing Performed

Updated AirQualityIndexTest breakpoint vectors to the 2024 table and re-derived the affected expected AQI values:

Verified locally: ./gradlew :core:model:allTests (all 11 AirQualityIndex tests pass), plus spotlessApply spotlessCheck detekt all clean.

Summary by CodeRabbit

  • Bug Fixes

    • Updated PM2.5 air-quality calculations to use the EPA’s 2024 breakpoint values.
    • Improved AQI accuracy for low-to-mid PM2.5 concentrations, including a PM2.5 reading of 10 µg/m³ mapping to an AQI of 53.
  • Tests

    • Added regression coverage to verify AQI results against the updated EPA guidance.

Android's PM2.5→AQI conversion (#6102) used the legacy (pre-2024) EPA
breakpoint table. iOS is landing a computed NowCast AQI
(meshtastic/Meshtastic-Apple#2075) on the current 2024 EPA PM2.5
24-hour table, so the same reading produced a different AQI per
platform — the exact divergence meshtastic/design#54 exists to prevent.

Swap the breakpoint constants to the 2024 EPA table (AQS parameter
88101). NowCast weighting (12h rolling window, 0.5 min weight factor)
and the Equation-1 interpolation are unchanged. Landing this before the
iOS feature ships keeps the two curves aligned.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 69b835da-4662-4b81-9382-22ba0ec425fc

📥 Commits

Reviewing files that changed from the base of the PR and between 0c21e98 and 43f16c7.

📒 Files selected for processing (2)
  • core/model/src/commonMain/kotlin/org/meshtastic/core/model/util/AirQualityIndex.kt
  • core/model/src/commonTest/kotlin/org/meshtastic/core/model/util/AirQualityIndexTest.kt

📝 Walkthrough

Walkthrough

The PM2.5 AQI breakpoint table now uses 2024 EPA concentration ranges. Existing breakpoint tests were updated, and a regression test verifies that 10.0 µg/m³ maps to AQI 53.

Changes

PM2.5 AQI breakpoint update

Layer / File(s) Summary
Breakpoint table and validation
core/model/src/commonMain/.../AirQualityIndex.kt, core/model/src/commonTest/.../AirQualityIndexTest.kt
The PM2.5 concentration ranges use the 2024 EPA table, with updated breakpoint assertions and a regression test for 10.0 µg/m³ → AQI 53.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Meshtastic Apple issue 2040 — Both changes update PM2.5-to-AQI breakpoint calculations, and this PR applies the corresponding 2024 EPA table on Android.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adopting the 2024 EPA PM2.5 AQI breakpoints for cross-platform alignment.
Linked Issues check ✅ Passed The breakpoint constants and tests were updated to the 2024 EPA table, matching the linked issue's requirements and preserving interpolation logic.
Out of Scope Changes check ✅ Passed The PR stays focused on AQI breakpoint updates and test adjustments, with no unrelated code changes visible in the summary.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bugfix PR tag label Jul 15, 2026
@jamesarich
jamesarich marked this pull request as ready for review July 15, 2026 12:04
@jamesarich
jamesarich added this pull request to the merge queue Jul 15, 2026
Merged via the queue into main with commit 67b3740 Jul 15, 2026
17 checks passed
@jamesarich
jamesarich deleted the claude/pm25-2024-epa-breakpoints-6272 branch July 15, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update PM2.5 AQI breakpoints to current (2024) EPA table for cross-platform alignment

1 participant