Skip to content

Chart the probes and each model's passes by conservation law on the site - #156

Merged
chrimerss merged 2 commits into
mainfrom
site/law-charts
Oct 1, 2026
Merged

chrimerss merged 2 commits into
mainfrom
site/law-charts

Conversation

@chrimerss

Copy link
Copy Markdown
Contributor

Adds two charts to the site.

Probes: a pie of the 35 merged probes by law: mass 23, energy 7, momentum 5. Counts sit on the slices, and the legend gives percentages that sum to 100.

Models: three compact panels, one per law, with the models as rows in the same order as the models table.

  • Each panel has its own scale: its full width is every probe under that law.
  • The gray bar is how many of those probes could score the model. The fill, blue for mass, orange for energy and green for momentum, is how many it passed.
  • N/A probes count in neither number, as in the table, so each row adds up to the table's N / M. A dash means no probe under that law could score the model.

Each cell has a hover and keyboard-focus tooltip (for example, summa: 1 of 4 energy probes passed, 3 N/A). Escape dismisses it. "Show the numbers" opens the per-law counts as a table.

Both charts work in en/es/zh, in light and dark mode, and at phone width. On a phone the per-cell numbers move to the tooltip and the table, and model names wrap at underscores. The law colors are checked for color-vision deficiency on both surfaces. Green #008300 failed against the orange for protanopia, so the green is #22A06B in light mode and #1BAF7A in dark.

Keeping it current

The page stays one self-contained file. The chart data is a JSON block in site/index.html, written by a new stdlib-only scripts/site_standings.py from models/result.csv.

  • It uses the same standing rule as _archived_standings: the newest archived version per model, with N/A excluded. Each probe's law is read from its probe.yaml.
  • After archiving rows or merging a probe, run python3 scripts/site_standings.py. --check exits 1 when the block is stale.
  • tests/test_docs_in_sync.py::test_site_charts_are_drawn_from_the_archive fails when the block is stale, when a law is miscounted, when a model is missing, or when a model's per-law sums differ from the standing the tables are checked against.
  • The AGENTS.md merge checklist says when to run the script.

The probe workflow now also runs on pull requests that touch site/, scripts/ or tests/, so a stale chart or table is caught before the pages workflow deploys it. Before this, such PRs skipped CI.

Checked

  • pytest -q: 1279 passed.
  • The new test fails on a hand-edited count.
  • Rendered in the browser in all three languages, in both themes, at 375 px with no horizontal scroll, with the tooltip on pointer and focus.
  • An independent review pass found six issues. All are fixed:
    • each probe's law is read from probe.yaml;
    • the CI paths are extended;
    • the test now catches a dropped model;
    • the caption element is valid HTML;
    • the tooltip stays open while focused and closes on Escape;
    • the pie percentages sum to 100.

The probes section gains a pie of the merged probes by law. The models
section gains three compact panels, one per law, with the models as rows.
Each panel is on its own scale: its full width is every probe under that
law, the gray bar is how many could score the model, and the fill in the
law's color (blue, orange, green) is how many it passed. A small law like
momentum is as readable as mass that way. Each cell has a hover and focus
tooltip, and a details table gives the numbers. Both charts work in
en/es/zh, in both themes and at phone width, where the numbers move to the
tooltip and the table. The colors are validated for color-vision
deficiency on both surfaces.

The data is a JSON block inside site/index.html, so the page stays one
self-contained file. scripts/site_standings.py writes it from
models/result.csv, by the same standing rule as _archived_standings, with
each probe's law read from its probe.yaml. test_docs_in_sync now fails
when the block is stale or disagrees with that standing. The AGENTS.md
checklist says when to run the script.

The probe workflow now also runs on pull requests that touch site/,
scripts/ or tests/, so a stale chart or table is caught before the pages
workflow deploys it.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 20:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The light-theme mass-slice label does not meet minimum text contrast requirements.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds localized, responsive charts showing probe distribution and model performance by conservation law.

Changes:

  • Adds accessible pie and bar charts with generated standings data.
  • Introduces archive-driven chart generation and consistency tests.
  • Expands CI paths and documents chart refresh steps.
File Description
site/​index.html Adds chart UI, translations, data, and rendering logic.
scripts/​site_standings.py Generates chart data from probes and archived results.
tests/​test_docs_in_sync.py Verifies chart data against the archive.
.github/​workflows/​probe-pr.yml Runs validation for site, script, and test changes.
AGENTS.md Documents chart refresh requirements.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread site/index.html Outdated
Copilot's review on #156 caught that the label picker chose white on the
light-mode mass blue (#2A78D6) at 4.42:1, short of the 4.5:1 WCAG AA asks
of 14px text, because the darker candidate was the site's ink rather than
black, and the ink only reached 3.66:1 there. Against white and true black
one of the two always clears 4.5:1. Every slice now does: 4.76 to 6.56:1 in
light mode, 5.41 to 7.46:1 in dark.
@chrimerss
chrimerss merged commit 36b5328 into main Oct 1, 2026
2 checks passed
Barbhuiya12 added a commit to Barbhuiya12/hydroturing that referenced this pull request Oct 2, 2026
…nowpack-ripening

Conflicts in README.md, models/result.csv and site/index.html. Counts are
re-derived for both probes: thirty-six, twenty-three mass, eight energy, five
momentum. The flowchart keeps main's taller pillars with the ripening entry
in the energy one. sacsma_snow17 1.2.0 is archived on
mass/groundwater-datum-invariance (N/A) after main's 1.1.0 row, and
modflow6 6.7.0-adapter.2 on this probe (N/A); the site chart data is
regenerated with scripts/site_standings.py.
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.

2 participants