Fix: Replace hardcoded CO₂ factor with IPCC-sourced waste-type-specific emission map#172
Merged
Shruti070107 merged 2 commits intoMay 23, 2026
Conversation
…ic emission map- Add CO2_FACTORS map keyed by wasteType × processingMethod (IPCC 2006 / GHG Protocol)- Add getCO2Factor(wasteType, processingMethod) resolver with fallback for unknown types- Replace all 4 usages of hardcoded 0.62 in app.js with dynamic per-order factor- Replace flat ESG totalCO2 calculation with per-order breakdown using getCO2Factor- Add Emission Factor Methodology table to ESG PDF with per-row factor attribution- Add Processing Method selector to plant Log Output form (anaerobic digestion / composting / biogas)- Persist plant's chosen processingMethod to account for consistent CO₂ calculations- Pre-select saved processingMethod on Log Output form re-renderCloses Shruti070107#131
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.
📝 PR Description
The platform previously used a single hardcoded constant (
0.62 kg CO₂/kg)across all waste types and processing methods in 5 separate locations. ESG
PDF reports generated from this figure were being used by organizations for
real CSR disclosures, making scientific accuracy a critical requirement — not
a cosmetic one.
This PR replaces every instance of the flat constant with a
CO2_FACTORSlookup map keyed by
wasteType × processingMethod, sourced from IPCC 2006Guidelines (Volume 5 — Waste) and the GHG Protocol Scope 3 Technical
Guidance. The ESG PDF now includes a per-row methodology table showing
exactly which factor was applied to each dispatch and why.
🎯 GSSoC Points Target
level:criticalquality:exceptionalgssoc:approved,level:critical,quality:exceptional💎 Quality Checklist (Mandatory for "Exceptional")
getCO2Factoris a pure O(1) lookup.co2Detailsmap runs once at report generation — zero re-renders.getCO2Factor.CO2_FACTORSandPROCESSING_METHODSfully commented with data source. Zero new console logs.📸 Screenshots / Video
The ESG PDF now includes a Emission Factor Methodology section showing:
With a source attribution footnote: "IPCC 2006 Guidelines for National
Greenhouse Gas Inventories (Volume 5 — Waste) and GHG Protocol Scope 3
Technical Guidance."
Plant operators now see a Processing Method dropdown in their Log Output
form (Anaerobic Digestion / Composting / Biogas Recovery), which persists to
their account and is applied to all subsequent CO₂ calculations.
🧪 Testing Done
offsetKgin emissions ledger differs correctly per methodCloses #131