Skip to content

Add a trait browser to the website - #76

Draft
ehwenk wants to merge 1 commit into
developfrom
trait-browser
Draft

ehwenk wants to merge 1 commit into
developfrom
trait-browser

Conversation

@ehwenk

@ehwenk ehwenk commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

The AusTraits website and data portal want an interactive way to browse APD traits, and it should stay in step with each APD release rather than being maintained separately.

`make site` now also writes `trait_browser.html` (linked from the navbar): every trait in a zoomable tree by trait group, searchable by structure, characteristic and keyword. Its data is built from `data/` by `R/trait_browser.R`, so it updates with each release, and `/APD/trait_browser.html` becomes a published URL.

🤖 Generated with Claude Code

make site now writes docs/trait_browser.html: every trait in a
zoomable tree by trait group, searchable by structure, characteristic
and keyword. Its data is built from data/ (R/trait_browser.R), so it
updates with each release. Linked from the navbar; also to be
embedded by the AusTraits website and data portal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehwenk

ehwenk commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

Working notes.

Draft until the hierarchy fixes on fixes-to-vocabularies are merged — the browser shows the trait hierarchy prominently, and it should not go live with the 2.2.0 hierarchy. Nothing here is public before a release anyway: the site deploys only from master.

Preview. The render check on this PR uploads the built site as the site artefact (14-day retention; re-run the workflow for a fresh one). trait_browser.html in it is self-contained apart from d3 (cdnjs) and Google Fonts, so it can be opened locally or trial-embedded.

Where it came from. A port of the browser previously built from austraits.build's config/traits.yml (branch trait-browser-tool there, kept until this ships). Built from APD it has 559 traits rather than 684; the other ~125 are austraits.build-only traits not yet in APD.

Design.

  • assets/trait_browser.html is the page with an empty <script type="application/json" id="trait-data"> block (44 KB, reviewable); apd_write_trait_browser() fills it at make site and writes docs/trait_browser.html (~476 KB).
  • Data comes from apd_read_inputs(), not export/APD_traits.csv: some labels contain the CSV's "; " delimiter ("ratio; proportion"), so the flat strings cannot be split back reliably.
  • Trait-group paths follow the hierarchy's Parent column — the one published as skos:broader — not the tier_* columns, which are stale for about half the groups (fixed separately on fixes-to-vocabularies).
  • All 700 trait-group placements resolve; 100 traits sit under more than one group.
  • Each trait links to its w3id URI; the page shows the APD version and build date, and the CC BY 4.0 licence.
  • jsonlite added to DESCRIPTION.

Tests. make check: 1,601 pass, including 14 new in test-trait-browser.R. make site succeeds. Headless Chromium smoke test at 1400 px and 400 px: no console errors; search, trait detail and the w3id link work.

@ehwenk

ehwenk commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

Note for after fixes-to-vocabularies merges: it adds R/hierarchy.R with the same apd_trait_group_paths() (identical behaviour), plus make sync-hierarchy to bring the tier_*/hierarchy columns into line with Parent. Rebase this PR onto develop then, and delete the copy in R/trait_browser.R and its path test.

@ehwenk ehwenk mentioned this pull request Nov 14, 2026
17 tasks

This branch has not been deployed

No deployments
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.

1 participant