viz: link the localized gallery examples, and fix the two dashboard bugs they exposed - #4317
Merged
Merged
Conversation
…allery Both smart dashboards were already deployed to GitHub Pages by the viz-gallery-pages workflow -- it stages examples/viz wholesale -- but gallery.html never linked them. The commits that added them (5a2ba09, d498b88) did not touch gen_gallery.py, so the generator had no entry to render and the pages were only reachable by direct URL. Add them as SCREENSHOTS link-outs rather than embedded iframes: at 17.0 MB and 5.0 MB they are far past the 0.1-1.5 MB range of the embedded smart_*.html figures, so embedding would have added ~22 MB to every gallery page load. This matches the existing Pittsburgh/Boston treatment. Neither dataset is committed, so both entries carry a verbatim `cmd` and are reused as-is rather than regenerated per run. Preview images are captured at 2140x2482 to match the existing three. README.md was stale on two counts that gen_gallery.py's own consistency check flags: the link-out count (three -> five) and the page size range (3.6-6.9 MB -> 3.9-20.6 MB). The regenerated smart_*.html pages carry a new Compiled: timestamp, and smart_nyc311.html a re-encoded stats sidecar and popup id. smart_allegheny_dogs.html additionally picks up the GeoJSON ring-winding normalization from 8c854c9, which fixed viz.rs but refreshed only the Colombia dashboard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…bels responsively Two dashboard fixes surfaced while adding the localized gallery examples. 1. `Notable Characteristics` rendered in English inside otherwise fully Spanish/Portuguese dictionary drawers. The obvious fix -- have describegpt emit the heading in the target language -- would have broken OKF export: `okf_short_description` (describegpt.rs) finds that exact English literal to cut the lead prose it needs for OKF's frontmatter `description:` key. The literal is load-bearing and must survive in the stored schema. So localize at RENDER time instead, after all marker parsing: `localize_dict_heading` swaps the one structural literal for a curated catalog string at the single ATX heading render site. The schema and describegpt's parser are untouched -- verified on the Colombia dashboard, which now has 0 occurrences of the English heading in its HTML and 1 in its schema. Uncurated locales and reworded headings fall through to English, i.e. to today's behavior. 2. KPI tile labels collided with their neighbours. `wrap_kpi_label` wraps against a CHARACTER budget fixed at generation time, but the KPI row spans ~550px to ~1800px on the same page -- narrow windows, and the --dict-info drawer opening, which shrinks the plot with no window resize event. No character count is right at both ends. `KPI_REWRAP_SCRIPT` re-wraps against the tile's measured pixel width and re-applies on every resize, via a ResizeObserver on the plot div (a window listener would miss the drawer case). It finds its labels by a `name` marker rather than annotation index, since the two emission sites produce different index layouts. Tile width comes from the pitch between adjacent label centers, so nothing extra is serialized. The Rust wrap stays as the pre-JS baseline, with its ceiling lowered 36 -> 28 (measured: labels run ~6.7px/char, tiles ~183px at the narrow case). Verified in-browser on the regenerated Colombia dashboard: at 1070px with the drawer open (plot 549px, tiles 183px) no label overlaps and none is wider than its tile; widened to 2360px they re-join into single lines, which the static wrap alone would never do. Regenerates the Colombia dashboard, its preview image, and the embedded gallery figures so the fixes are live in the published examples. Per-page the diff is the script block, a Compiled: timestamp, and `name` attributes only where a KPI row exists -- confirmed byte-exact on three pages. Also adds the two new dictionaries to the README table, which was presented as a complete list (roborev). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
…ed heading The Brazil link-out was left on the pre-fix binary in 637001b on the grounds that it has no KPI row, so it would gain only the inert re-wrap script. That reasoning covered the KPI fix but missed the other one: its dictionary drawer still rendered the English `Notable Characteristics` inside an otherwise fully Portuguese dashboard. Regenerated with the same command the entry documents. The drawer now reads `Características notáveis`, while the schema keeps the English literal that describegpt's `okf_short_description` cuts on -- 0 English headings in the HTML, 1 in the schema, matching Colombia. Confirms the KPI reasoning too: the page carries exactly one occurrence of the marker string (the script's own constant) and no `name` attributes, i.e. no KPI tiles to tag, and its plotly data line is unchanged. Preview image re-captured since the heading is visible in it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Both localized smart dashboards were already deployed to GitHub Pages — the
viz-gallery-pagesworkflow stagesexamples/vizwholesale — butgallery.htmlnever linked them, so they were reachable only by direct URL. The commits that added them (5a2ba093e,d498b8873) didn't touchgen_gallery.py, so the generator had no entry to render.Fixing that surfaced two dashboard bugs, which are the second commit.
1. Gallery entries (
b2d74cda0)Added as
SCREENSHOTSlink-outs rather than embedded iframes: at 17.0 MB and 5.0 MB they're far past the 0.1–1.5 MB range of the embedded figures, so embedding would have added ~22 MB to every gallery page load. Matches the existing Pittsburgh/Boston treatment. Neither dataset is committed, so both carry a verbatimcmd.README.mdwas stale on two countsgen_gallery.py's own consistency check flags — the link-out count (three → five) and the page size range (3.6–6.9 MB → 3.9–20.6 MB) — plus the dictionary table was presented as a complete list while omitting both new dictionaries.2.
Notable Characteristicsrendered in English (637001ba5)Inside otherwise fully Spanish/Portuguese dictionary drawers.
The obvious fix would have broken OKF export.
okf_short_description(describegpt.rs:5513) finds that exact English literal to cut the lead prose it needs for OKF's frontmatterdescription:key. The string is load-bearing and has to survive in the stored schema — prompting the model to translate it would silently break OKF short-description extraction on every non-English run.So it's localized at render time, after all marker parsing:
localize_dict_headingswaps the one structural literal for a curated catalog string at the single ATX heading render site. Verified on the Colombia dashboard — 0 occurrences of the English heading in its HTML, 1 still in its schema. Uncurated locales and reworded headings fall through to English, i.e. to today's behavior.3. KPI tile labels collided with their neighbours
wrap_kpi_labelwraps against a character budget fixed at generation time, but the KPI row spans ~550px to ~1800px on the same page — narrow windows, and the--dict-infodrawer opening, which shrinks the plot with no window resize event. No character count is right at both ends.KPI_REWRAP_SCRIPTre-wraps against the tile's measured pixel width on every resize, via aResizeObserveron the plot div (a window listener would miss the drawer case). It finds its labels by anamemarker rather than annotation index, since the two emission sites produce different index layouts, and derives tile width from the pitch between adjacent label centers so nothing extra is serialized. The Rust wrap stays as the pre-JS baseline, ceiling lowered 36 → 28 (measured: ~6.7 px/char, tiles ~183px at the narrow case).Verified in-browser, not just compiled
The wide case is what proves the JS is doing the work — the static wrap alone would leave them wrapped forever.
Regenerated artifacts
The Colombia dashboard, its preview image, and the embedded gallery figures, so the fixes are live in the published examples. Per page the diff is the script block, a
Compiled:timestamp, andnameattributes only where a KPI row exists — confirmed byte-exact on three pages. Colombia's extra 26 characters are two new<br>s from the tightened baseline wrap.Not included
Six committed artifacts still render the English
Notable Characteristics, becausegen_gallery.pycannot refresh them without their uncommitted source data:pitt311data,smart_boston_311_2025,smart_dict_sunburst,smart_dict_treemap,smart_geospatial,smart_world_choropleth. Two of those (pitt311data,smart_boston_311_2025) are link-out dashboards reachable from the gallery, so this is a user-visible residual gap, not just an internal one. Refreshing them needs the datasets and each entry'scmd.Testing
295 unit + 395 integration viz tests pass;
cargo clippy --bin qsv -F all_featuresclean.One test needed a fix worth noting:
render_dict_markdown_atx_headingsbegan failing by returning Italian — localizing that render path made the assertion locale-sensitive, and it wasn't holding theenglish_locale()mutex against concurrently-running tests. Added the guard plus two new tests covering the localization (including that non-marker headings pass through untouched) and the marker/script agreement.🤖 Generated with Claude Code