Skip to content

Add impact equivalence conversions for dashboard overview#243

Merged
jnioche merged 8 commits into
DigitalPebble:mainfrom
dpol1:feat/206-impact-equivalences
Jul 4, 2026
Merged

Add impact equivalence conversions for dashboard overview#243
jnioche merged 8 commits into
DigitalPebble:mainfrom
dpol1:feat/206-impact-equivalences

Conversation

@dpol1

@dpol1 dpol1 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Closes #206

dpol1 added 5 commits July 1, 2026 16:55
Pure-Python helpers that translate emissions (kg CO2e), energy (kWh), and
water (L) totals into everyday comparisons: family-car km, flights,
home-years, cups of tea, Olympic pools, and bathtubs. Conversion factors are
documented constants with cited sources so they stay auditable and easy to
tune. No third-party dependencies.
Render an "In everyday terms" block beneath the overview metric cards,
translating the emissions, energy, and water totals into the comparisons
requested in DigitalPebble#206. Metric labels reuse the dashboard palette (brown
emissions, yellow energy, blue water) to stay consistent with the charts.

Kept lightweight per the issue: a compact caption block, no extra selector.
Note the "In everyday terms" overview block in the dashboard how-to and point
to reporting/equivalences.py for tuning the conversion factors.
Replace the single-caption "In everyday terms" block with per-metric cards in
the style of Cloud Carbon Footprint and EcoLogits: each equivalence gets an
icon, a prominent number, and a muted label, aligned on a fixed icon column.
Metric identity is carried by a small colored dot plus the metric name,
matching the chart palette without relying on color alone.

Add a sidebar "Equivalence style" selector that switches the second
comparison of each metric between neutral sets — Everyday (flights, cups of
tea, bathtubs), Tech (streaming hours, smartphone charges, washing cycles),
and Nature (tree-years, solar-panel days, rainfall). The first comparison
(car km, home-years, Olympic pools) stays fixed so totals remain comparable.
New factors are documented constants with cited sources.

Also trim trailing zeros from equivalence quantities ("8 flights" instead of
"8.0 flights").

Refs DigitalPebble#206
@jnioche jnioche added this to the 1.2 milestone Jul 2, 2026
@jnioche

jnioche commented Jul 3, 2026

Copy link
Copy Markdown
Member

Really nice, thanks @dpol1

Is there any way we could display the source for the conversion factors? It is merely for illustration I know but it would give users more confidence in the numbers.

It would be great to reuse the same script when generating the static reports, for consistency

Add a user-facing factor table (comparison, factor, source) to
equivalences.py, built from the same constants as the conversions so the
displayed values cannot drift, and show it in a "Conversion factors and
sources" expander under the overview equivalence tiles.
dpol1 added a commit to dpol1/spruce that referenced this pull request Jul 3, 2026
Reuse reporting/equivalences.py in report.py so the static report and the
dashboard stay consistent: an "In Everyday Terms" section after the billing
summary converts the emissions, energy, and water totals with the same
factors, followed by the factor/source table. Text only (no icons) so the
section renders cleanly in Markdown, HTML, and PDF output.

Requested in review of DigitalPebble#243.
Reuse reporting/equivalences.py in report.py so the static report and the
dashboard stay consistent: an "In Everyday Terms" section after the billing
summary converts the emissions, energy, and water totals with the same
factors, followed by the factor/source table. Text only (no icons) so the
section renders cleanly in Markdown, HTML, and PDF output.
@dpol1 dpol1 force-pushed the feat/206-impact-equivalences branch from a84bf19 to d32c681 Compare July 3, 2026 18:01
@dpol1

dpol1 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed a first pass for both points:

  • factors and sources are shown in a "Conversion factors and sources" expander under the equivalence tiles — the table is generated from the same constants used for the conversions, so the displayed values can't drift
  • report.py now reuses reporting/equivalences.py: the static report gets an "In Everyday Terms" section after the billing summary, with the same factors and sources

I'm not settled on the expander though. I checked how CCF handles this: no table in the UI, just a Source: EPA Equivalencies Calculator link under the comparison card. I'd rather follow that pattern — a short source line under the tiles linking to the official sources (DEFRA, IEA, EPA, Eurostat), plus a methodology page in the docs holding the full factor table. The report keeps the table as is, an appendix makes sense there.

Still finishing this, will update the PR.

@jnioche

jnioche commented Jul 4, 2026

Copy link
Copy Markdown
Member

. I'd rather follow that pattern — a short source line under the tiles linking to the official sources (DEFRA, IEA, EPA, Eurostat), plus a methodology page in the docs holding the full factor table.

that's pretty much what I had in mind: just pointers to references
The static report could do the same

Replace the factor table in the dashboard expander and in the static report
with a single line of links to where the conversion factors come from
(DEFRA, atmosfair, IEA, EPA, Eurostat). The full factor table moves to the
methodology page of the documentation.
@dpol1

dpol1 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

It should work now - I choose the "lazy" way. Also added links in docs dor transparency

@jnioche

jnioche commented Jul 4, 2026

Copy link
Copy Markdown
Member

Lovely!

image

@jnioche jnioche merged commit 0d2a02c into DigitalPebble:main Jul 4, 2026
2 checks passed
@dpol1

dpol1 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

Please update with that screenshot the docs

@dpol1 dpol1 deleted the feat/206-impact-equivalences branch July 4, 2026 15:04
@jnioche

jnioche commented Jul 4, 2026

Copy link
Copy Markdown
Member

Please update with that screenshot the docs

c726bf0

@dpol1

dpol1 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks J

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add impact equivalences to dashboard overview

2 participants