Skip to content

Suggest questions about the dataset on screen - #478

Merged
neuromechanist merged 8 commits into
developfrom
feature/dataset-questions
Sep 24, 2026
Merged

neuromechanist merged 8 commits into
developfrom
feature/dataset-questions

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Closes #477. On a page that names a dataset with setDataset, the widget suggests questions about that dataset, filled from facts the page passes, rather than the community's general list. NEMAR is the only community that sets any; every other community is unchanged.

Also makes nm000132 (ERP CORE) NEMAR's example dataset: the general suggestion "Tell me about dataset nm000132" replaces nm000219, and the prompt's example identifier and its describe-dataset step name it too.

Changes

  • widget.dataset_suggested_questions (DatasetSuggestedQuestion): {text, needs_zarr} templates. text must name its dataset with {dataset_id}, may use {subject} and {task}, and accepts no other blank, no unbalanced brace and no markup; at most 10. resolve() and the API omit the field when unset.
  • setDataset({ id, zarr, subject, task }): subject and task are optional BIDS labels (^[A-Za-z0-9]{1,64}$, no prefix); an invalid one is refused with a warning and leaves the previous dataset in place, as an invalid zarr already is.
  • Opening screen of a dataset page: up to three templates in the community's order, skipping a needs_zarr one without a Zarr copy and one with a blank the page did not fill; the general list when none fits.
  • Mid-conversation: a dataset the conversation has not been on yet gets a compact row of up to two, labeled "About :", above the input. Each sent message records the dataset on screen (dataset on the user message, validated when history loads), so the row goes once the reader sends from that page and stays gone after a reload. Nothing is offered while a reply streams.
  • The remembered widget block (The widget flashes its default look on every page load #475) carries the templates, and a fresh config without them resets to none.
  • NEMAR's five templates; the two that run code (a 10 second plot and a power spectrum) are needs_zarr and stay within the chat runtime, which has no scipy.
  • Docs: docs/community-widget.md.

The website half, passing subject and task from the Zarr index, is a separate nemarOrg/website PR; until it lands, nemar.org's dataset pages show the three templates without those blanks.

Testing

  • frontend/test-widget-dataset-questions.js, new, 51 checks, in both CI workflows; 22 single-line mutations of the new widget code each fail it.
  • Every other Bun suite CI runs, and build-runtime-bundle.js --check.
  • Full offline pytest: 2947 passed (test_version_shows_version deselected, the local-only test_version_shows_version fails locally and passes in CI, because rich colorizes on a TTY #434).
  • ruff check and format.
  • In Chrome with widget_e2e.py --nemar: the opening three and the compact row, light and dark, and no overflow at phone width.

The general suggested question, the prompt's example identifier and its
describe-dataset step, and the setDataset example in the widget docs now
name nm000132, a public EEG dataset with a Zarr copy, instead of
nm000219, nm000329 and nm000103.

Tested: test_communities_endpoint.py and test_community.py pass.
A widget block can now carry question templates for a dataset page
(#477): {dataset_id} required, {subject} and {task} optional, nothing
else, and needs_zarr on the ones that run code against a recording.
resolve() and the API omit the field when a community sets none.

Tested: test_community.py (the new TestDatasetSuggestedQuestions: blank,
brace, markup, length, unknown-field and count refusals); full offline
pytest, 2947 passed.
setDataset takes subject and task, BIDS labels, beside id and zarr. On
a dataset page the opening screen shows up to three filled templates,
needs_zarr ones only with a Zarr copy, and the general list when none
fits; mid-conversation a dataset new to the conversation gets a compact
row of two. Each sent message records the dataset on screen, so the row
goes once the reader sends from that page, and stays gone on reload.

Tested: test-widget-dataset-questions.js (51, in both CI workflows), and
22 single-line mutations of the new code each fail it; every other Bun
suite CI runs passes; checked in Chrome, light, dark and at phone width.
Five templates: what the dataset is and how it was recorded, a 10 second
plot and a power spectrum of the page's first Zarr recording (needs_zarr),
how to download it, and which events it annotates. The two that run code
stay within the chat runtime, which has no scipy.

Tested: test_communities_endpoint.py (NEMAR alone sends the field, every
template names its dataset, three need no Zarr copy).
The dataset_suggested_questions field and its rules, setDataset's new
subject and task, and the setConfig key.

Tested: docs only.
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-dataset-questions-demo.osc.earth
Branch feature/dataset-questions
Commit 549c3ab

This preview will be updated automatically when you push new commits.

Review of #478. An invalid subject or task no longer refuses the whole
setDataset call, which kept the previous dataset, and its notebook icon,
on screen; only that fact is dropped. A pop-out is told the dataset on
screen when it opens and on every later setDataset, so its suggestions
follow the page. The harness page takes subject and task too.

Tested: test-widget-dataset-questions.js (64), with tests for both, for
a malformed setConfig value and for the hidden empty area; 29 single-line
mutations each fail it; the color-scheme, first-paint, capsule, notebook
and tools suites pass; bundle check.
Review of #478: an unquoted YAML number or a null where the text belongs
must fail as a config error, not as an AttributeError.

Tested: TestDatasetSuggestedQuestions, 22 pass; removing the isinstance
guard fails the five new cases.
Review of #478: NEMAR's config comment no longer says nemar.org passes
subject and task (website#356 is open); BIDS is spelled out where the
widget docs first use it; long sentences break at clause punctuation;
the pop-out and the dropped-label rule are documented; and a CHANGELOG
entry.

Tested: docs and comments only; test_communities_endpoint.py passes.
@neuromechanist

Copy link
Copy Markdown
Member Author

Review response

Four Sonnet reviews (code, tests, error handling, docs). Every finding is addressed in 6553b29, c939a29 and 196dd7b.

Error handling

  • A bad subject or task refused the whole setDataset call, which kept the previous dataset on screen, notebook icon included, over a fact that only fills question blanks. Now only that fact is dropped, with a warning, and the rest of the call applies. An invalid zarr still refuses the call as before: that rule predates this PR, its tests and docs define it, and zarr gates the notebook, so changing it is a separate decision. Because the new facts no longer abort anything, this PR does not widen that path.
  • A malformed template is skipped silently. From the server this cannot happen, since the config fails to load. From setConfig, a non-array value or bad entries now fall back to the general list, and that path is tested. A per-template warning was not added: a template with an unfilled blank is skipped on most pages by design, and a warning there would fire constantly.

Code

  • The pop-out never learned the dataset, so it lost the dataset questions. openPopout now writes window.__OSA_DATASET__, the pop-out applies it through applySetDataset's own checks, and every later setDataset on the opener is forwarded, as setColorScheme already is. Tested: the written preset, forwarding, a null preset and a malformed one.
  • The currentDataset comment names its new readers.

Tests

  • A non-array datasetSuggestedQuestions from setConfig ('oops', an object, a number).
  • The hidden area when there is nothing to suggest. All eight communities set general questions, so no real widget changes.
  • A non-string text (an unquoted YAML number, null, a list) fails as a ValidationError naming the field. Removing the isinstance guard fails all five cases.
  • The widget suite is now 64 checks; 29 single-line mutations of the new widget code each fail it.

Docs

  • NEMAR's config comment no longer says nemar.org passes subject and task: that is Pass the recording's subject and task, and re-pin staging nemarOrg/website#356, still open.
  • The public setDataset comment shows the new shape.
  • BIDS is spelled out on first use in docs/community-widget.md, and long sentences break at clause punctuation.
  • The pop-out and the dropped-label rule are documented, and there is a CHANGELOG entry.
  • The harness page (widget-e2e-dataset.js) takes subject and task too.

@neuromechanist
neuromechanist merged commit 7092864 into develop Sep 24, 2026
18 checks passed
@neuromechanist
neuromechanist deleted the feature/dataset-questions branch September 24, 2026 16:03
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