Render the trend chart instead of the placeholder - #32
Open
marvinm2 wants to merge 2 commits into
Open
Conversation
Builds one Vega-Lite spec per data source from the same long-form records the table is rendered from, and draws it into the existing #trend-chart element. Clicking a summary card switches the chart, reusing the currentFilter hook that was already there but unused. Stacked bars rather than lines: load_tsv drops zero rows, so a period with no data is absent rather than zero, and a line would interpolate through the gap and show numbers that were never reported. Series are capped at the six busiest packages with the rest grouped as Other, which covers 93-99% of the total in every current report; galaxy_runs carries 17 packages and no categorical scale stays readable at that width. Periods stay ordinal with an explicit chronological sort. The reports mix 2026-02 with 2026-W01 and Vega-Lite cannot parse the ISO week form as a date. The sort key tolerates an unrecognised label rather than raising. Colours move into CSS custom properties, so the palette can be changed in one place. The series colours are Okabe-Ito with yellow and black dropped and orange and sky darkened, so every bar fill clears 3:1 against the card. Also removes an unused json import, which ruff was already flagging, and makes the summary cards reachable from the keyboard.
The wordmark is blue on an opaque white ground, with no transparency, so it needs a light banner: on the previous dark one it measures 1.4:1 against the background and cannot be read. The image is committed rather than linked from the brand portal, so the page does not depend on a preview URL that may be rotated. It is the 1000x preview export; if there is an official SVG in the brand portal that would be better.
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.
Closes #27.
The trend chart section now draws a chart instead of the placeholder. One Vega-Lite spec per data source is built in
dashboard.pyfrom the same long-form records the table already uses, and the template renders whichever source is selected. Clicking a summary card switches the chart, reusing thecurrentFilterhook that was already in the script but unused.Some choices worth explaining.
Stacked bars rather than lines.
load_tsvdrops rows with a count of zero, so a period with no data is absent rather than zero, and a line mark would draw straight through the gap and show numbers that were never reported. Bars leave the gap visible.Series are capped at the six busiest packages, with the rest grouped as Other.
galaxy_runs.tsvhas 17 packages andgithub_views.tsv14, and no categorical colour scale stays readable at that width. The cap hides very little: over the committed 2026 reports the top six carry 99% of PyPI downloads, 93% of GitHub views, 98% of Galaxy runs and 93% of Bioconda downloads. The table below still lists every package.Periods stay ordinal with an explicit chronological sort, which is what the earlier implementation did. The reports mix
2026-02with2026-W01and Vega-Lite cannot parse the ISO week form as a date. The sort key returns a last-place key for an unrecognised label rather than raising, so one odd row cannot reorder a series.Colours moved into CSS custom properties at the top of the template, so the palette can be changed in one place. The series colours are Okabe-Ito with yellow and black dropped and orange and sky darkened, so every bar fill clears 3:1 against the white card.
The banner now carries the MUNI RECETOX wordmark and is light rather than the Bootstrap blue gradient. The wordmark is blue on an opaque white ground, and on a dark banner it measures 1.4:1 and cannot be read. The image is committed rather than linked from the brand portal so the page does not depend on a preview URL. It is the 1000x preview export; if there is an official SVG that would be better, and I am happy to drop the logo entirely if you would rather it was not there.
Vega, Vega-Lite and Vega-Embed load from jsDelivr with pinned versions and SRI hashes, matching how Bootstrap is already loaded. Each hash is reproducible with
curl -sL <url> | openssl dgst -sha384 -binary | openssl base64 -A.docs/index.htmlis regenerated and included, so the chart appears on the live site when this merges. Without it the chart would not show up until #25 is sorted out, because the weekly commit cannot trigger a deploy. The file grows from 170KB to 212KB, and nearly all of that is one long line of inline chart data.Two things to flag. The Galaxy Runs card in this branch still reads 123,958, which is the double counting in #26 rather than anything the chart does; #31 fixes it and the two branches merge cleanly. And the GitHub Views chart stops at
2026-W14, which is #28.Two small changes I made while in the files, happy to pull either out. The unused
import jsonis removed, which ruff was already flagging on main. And the summary cards getrole="button",tabindex="0"and a keydown handler, since they were click-only and unreachable from a keyboard.Tested with
python -m unittest discover -s testsfrom the repo root: 28 tests intest_dashboard.py, 15 of them new, all passing, andruff check src testsclean. I also loaded the generated page and checked each source renders, that the ISO-week axis orders correctly across the 2025/2026 boundary, that Show All shows a message rather than an empty axis, and that the chart still draws at a 340px container width.One observation I did not act on:
altair==6.0.0is pinned but never imported. It is worth keeping anyway, because it is what pulls in jinja2, which the template rendering needs and which is not declared directly.