Skip to content

ADR 0137: quality views drawn in the browser - #2342

Merged
neuromechanist merged 8 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/issue-2324-adr-0137
Nov 24, 2026
Merged

neuromechanist merged 8 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/issue-2324-adr-0137

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Docs only: Architecture Decision Record (ADR) 0137, status proposed, for the live quality views of epic #2324.
NEMAR stores no figure image; a quality view is declared data that the browser draws.

  • Adds .context/decisions/0137-quality-views-are-declared-data-drawn-in-the-browser-and-no-figure-image-is-stored.md.
  • Adds a partial-supersession pointer under ADR 0134's header (decisions 2, 6, 7 and 9 where they name figures, and the rejected alternative of array outputs); the rest of 0134 is unchanged.
  • README: 0137 added to the load-bearing list and the index, and a note on the 0134 index line.
  • 0137 was free on dev, main, the epic branch, every remote branch and every open PR.

The ADR includes these decisions, made with the plan:

  • Activations: nemar.ic-activity.v1 applies no preprocessing.
    It is one multiply of the serving copy's kept channels by the unmixing, sphere and average-reference matrices folded together, in store row order with the unit folded in.
    So activations approximate what was decomposed, by design, and the caption says so.
    The 1 Hz high-pass is a declared display filter.
    Nothing is drawn on a channel-set mismatch or a published-digest mismatch.
    When no digest is published, activations draw with a "not checked" caption; an archive decomposition keeps its own caption.
  • Decomposition (nemar-ica decomposes the Zarr serving copy (PZ) nemar-process#79): nemar-ica reads the Zarr serving copy, and on both Zarr and BIDS input its decomposition reads preprocessed data:
    a high-pass filter, a conditional 50 or 60 Hz band-stop (ZapLine-plus later), artifact subspace reconstruction with a cutoff of 30 that repairs bursts and cuts nothing, and bad-channel removal.
    The record states decomposition_input.
    A store input's content_sha256 may be null only for profile archive.
  • Electrode positions: a coordinate frame is never assumed.
    Without measured positions in a known frame, positions are inferred by nemar.sensor-labels.v1, which neuroschema owns.
    It uses normalized labels, aliases such as T3/T7, and MNE-Python's standard montages at a pinned version, with provenance recorded.
    The defaults are at least 8 channels matched and a share of at least 0.8.
    Its refusal reasons are duplicate_label, montage_ambiguous, too_few_matched, too_few_channels, bipolar_labels, labels_unrecognized and share_too_low.
    On a refusal no map is drawn and the view says why.
    This applies to the viewer's live map and to sensor-field views with no layout role.
  • Public derivative: the newest catalog or published one by stored_at.
  • Spectrum: Welch, 2 s Hamming windows, 50% overlap, decibels relative to 1 µV²/Hz, and an upper bound of 125 Hz recorded as a parameter.
  • Metric names: plugin metrics are <plugin>:<name>; recipe metrics are bare names declared by the recipe.
    A qualityMetric names one producer, and the plugin that would re-report floor values is dropped.
  • Plan hash: holds each plugin's identity (name, version, tree_sha256) and its outcome.

Merge order: this merges now, ahead of the release. The ADR names neuroschema 0.6.0 as in preparation (nemarOrg/neuroschema#21), and confirming the montage licenses remains a precondition of that release.

Part of #2324

Update (lead amendments)

Commit 7847639 folds in the Zarr decomposition (PZ), nemar.sensor-labels.v1, and the null-only-for-archive rule for the store digest.

Update (review round 1)

Commit 3335c59 fixes every Important, Low and Nit item from the round-1 docs review (no Critical findings).

  • Spectrum bound: 125 Hz unless the recording's Nyquist frequency is lower, the recorded bound saying which, so spectra compare where their bounds agree.
  • Store digest: content_sha256 may be null only when the view's derivative has profile archive.
  • Homes: names the two ADR 0134 rows it replaces.
    Metric naming moves to the plugin manifest, and the no-samples rule stays in signalJourney's nemar namespace (now its own row).
  • Supersession scope: "where it names figures or a floor value" in both headers.
    Both README index entries list the same items, including the rejected alternative of array outputs.
  • Smaller fixes:
    • view file sizes run from tens of kilobytes to about 1.5 megabytes at 256 channels;
    • the route is "the first route that serves a derivative's product files";
    • website ADR 0035 is marked "to be written in W1";
    • the converter follow-up is Converter: write each Zarr group's content digest at commit #2343;
    • "concealment" is now "anonymity (ADR 0065)";
    • the server hashes a file "when it reads it from storage";
    • the archive decomposition_input fields are listed.
  • Frame rule: scoped to the viewer and any sensor-field view without a layout role.
    A recipe's layout role records coordinate_system (possibly n/a) and position_source.
  • Nits:

Update (design revision)

Commit ae7bbc6 applies the revised decomposition and activation design.

  • Decision 5: the decomposition always reads preprocessed data on both inputs; the raw-input text is removed.
  • Decision 9: activations are a plain multiply that approximates the decomposition by design, with a caption that says so.
    The "reproduces exactly" claim is removed, and the refusals are unchanged.
  • Consequences: the approximation bullet now names the test that holds the folding, and a known limitation covers electrocardiography channel typing on Zarr input (eegprep-lean: set channel types from the Zarr group's channel_type sccn/eegprep#668).
  • Alternatives: "decompose the raw serving copy so activations are exact" is rejected, because on one fixture brain components fell from 11 to 7 of 18 and line-noise components rose from 3 to 6.
    "Redo the preprocessing in the browser" is also rejected.

Update (owner decisions before merge)

Commit 16e3517 aligns the ADR with the owner's later decisions. Merge commit 9cfb8f8 brings in the epic branch (#2350).

Test plan

  • bun test test/adr-index.unit.test.ts: 11 pass
  • NEMAR_DOCS_CHECKOUT=<docs checkout> bun test test/docs-links.unit.test.ts: 18 pass
  • bun run lint and the pre-commit typecheck: clean (no code changed)
  • typos on the two ADR files: clean

Views are declared data the browser draws; no figure image is stored. Folds in the decisions on activations, electrode positions inferred from names, the public derivative, spectrum parameters, metric names and the plan hash. Indexed in both README lists. Tested: bun test test/adr-index.unit.test.ts.
Adds the pointer under ADR 0134's header and a note on its index line; the rest of 0134 is unchanged. Tested: bun test test/adr-index.unit.test.ts.
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2342

Version: 0.10.40-PR2342.a0ec441
Commit: a0ec441


🤖 Updated on each push.

Activations reproduce the Zarr decomposition input exactly (store-content rounding, unit, average reference) with the 1 Hz high-pass as a display filter; positions from names are nemar.sensor-labels.v1 with stated defaults and refusal reasons; a store content_sha256 is null only for profile archive. Tested: adr-index and docs-links tests.
Spectrum bound, archive-only null digest, homes rows named, supersession scope aligned across headers and index, file sizes and caps, first product-file route, anonymity gate, layout-role frame fields, converter follow-up #2343, README status date. Tested: adr-index and docs-links tests.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review: r1 comments lens (docs-only, one reviewer): 4 Important, 8 Low, 4 nits, all wording, all fixed in 3335c59. No second round (wording-only fixes). Held until neuroschema 0.6.0 (nemarOrg/neuroschema#21) is released, then re-check the citation and merge into the epic branch.

The decomposition always reads preprocessed data (high-pass, line-noise removal, ASR cutoff 30, bad channels removed) on Zarr and BIDS inputs; activations are one browser multiply by the folded unmixing, sphere and average-reference matrices and approximate the decomposition input by design. Adds the raw-input alternative with the fixture numbers and the sccn/eegprep#668 limitation. Tested: adr-index and docs-links tests.
Line noise is a conditional 50/60 Hz band-stop until ZapLine-plus parity is measured; ASR repairs bursts only and reports asrBurstFraction (sccn/eegprep#684); channel types kept per row and keyed (sccn/eegprep#669, #2344); a view refuses rather than mislead; neuroschema 0.6.0 marked in preparation (nemarOrg/neuroschema#21), montage licensing stays a release precondition. Tested: adr-index test.
Decision 1 and the README load-bearing line: an activation or signal-window view that has no bad-segment table says so on the page. Tested: adr-index and docs-links tests.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review: r1 comments lens (docs-only): 4 Important, 8 Low, 4 nits, all fixed (3335c59); later refreshes for the owner's revised decomposition (ae7bbc6) and the decisions made since (16e3517, a0ec441: band-stop until ZapLine-plus, ASR repairs and reports asrBurstFraction, per-row channel types keyed into the derivative, refuse-rather-than-mislead rule, 0.6.0 in preparation). Verified: adr-index and docs-links tests pass. Merging into the epic branch at the owner's request, ahead of the neuroschema 0.6.0 release.

@neuromechanist
neuromechanist merged commit b05416a into feature/issue-2324-epic-pipeline-progress Nov 24, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-2324-adr-0137 branch November 24, 2026 03:01

This branch was previously deployed

1 inactive deployment
npm — a0ec441e Deployed Nov 24, 2026 by neuromechanist via publish #4831
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