build-story: render audience tabs from published AI-summary nanopubs - #27
Merged
Conversation
fetch_published_summaries() queries the nanopub network for AI plain-language summary nanopubs schema:about the apex (see the AI-summary template), and the blog renders the audience tabs from those signed, agent-attributed nanopubs — each tab links back to its nanopublication. Falls back to a committed audience.json when none are published (or the network is unavailable), so existing behaviour is unchanged. - render_audience: link to the signed nanopub (aud-prov) when np_uri is present; skip empty section headings / title (a published summary is one prose block). - main(): prefer published summaries over audience.json. - 5 new offline tests (parsing, one-per-audience, network-error fallback, provenance link, file-backed has no link). 129 tests pass; live smoke against the sado synthesis renders both published summaries with provenance links.
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.
What
build_story.pynow renders the story page's audience tabs ("For the general public", "For schools", …) from the published, signed AI-summary nanopublications on the network — instead of a localaudience.json. Each tab links back to its nanopublication, which isschema:aboutthe chain apex and attributed to an AI software agent (see the AI plain-language summary template).Why
The AI plain-language summaries are first-class, signed artefacts on the nanopub network (agent-attributed, versioned, supersede-able). The reader-facing page should render those on-network artefacts and cite them, rather than an ad-hoc committed file — so what the reader sees is exactly what was published, with a provenance link to verify it.
How
fetch_published_summaries(apex)— SPARQL-queries the nanopub network for AI-summary nanopubsschema:aboutthe apex, carryingschema:audience+rdfs:comment; keeps one live summary per audience.render_audience— links each tab to its signed nanopub (.aud-prov) when present; skips empty headings (a published summary is a single prose block).main()— prefers published summaries; falls back tonanopubs/audience.jsonwhen none are published or the network is unavailable, so existing behaviour is unchanged.Verification
sado-estuary-replication-2026) against the dev Science Live API renders both published summary nanopubs as audience tabs, each with a provenance link toplatform-dev.No new dependencies (stdlib
urllib).