Repository navigation
Phase 2: channel count + electrode-system compute (#858) - #861
Merged
neuromechanist merged 1 commit intoJun 28, 2026
Merged
neuromechanist merged 1 commit into
neuromechanist merged 1 commit into
Conversation
Phase 2 of epic #854. Populate the migration-0054 columns during enrichment: - channel-montage.ts (pure, unit-tested): parseChannelsTsv, parseEegChannelCount, resolveNChannels (measured channels.tsv EEG count wins over a disagreeing sidecar), classifyElectrodeSystem (egi-geodesic / biosemi / 10-20 / 10-10 / 10-05 / other), grounded in MNE-derived label sets (montage-label-sets.ts). - getBidsTreeStats samples an exemplar eeg channels.tsv + eeg.json from the subjects it already walks and runs the classifiers (best-effort: a probe failure leaves the columns NULL, never breaks the modality/subject walk). - writeDatasetMetadataColumns COALESCE-writes n_channels + electrode_system; the reindex caller threads them through. EEG-only for now; populated via the reindex/walk path (the LLM-enrich path omits them, COALESCE-safe). Backfill of existing rows is phase 3 (#859). Closes #858. Part of #854.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR861Version: 🤖 Updated on each push. |
neuromechanist
merged commit Jun 28, 2026
2152018
into
feature/issue-854-epic-channel-montage
1 check passed
This branch was previously deployed
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.
Summary
Populates the Phase 1 columns (
n_channels,electrode_system) during enrichment.channel-montage.ts(pure, unit-tested) —parseChannelsTsv,parseEegChannelCount,resolveNChannels(the measuredchannels.tsvEEG count wins over a disagreeingEEGChannelCountsidecar, per the data-source decision), and
classifyElectrodeSystem(
egi-geodesic/biosemi/10-20/10-10/10-05/other). Tier detection is grounded inMNE-derived label sets (
montage-label-sets.ts, auto-generated): BioSemi A-bank and EGI pure-Enumbering are matched first (their labels overlap the standard set), then the finest standard tier present.
getBidsTreeStatscaptures an exemplar EEG*_channels.tsv+*_eeg.jsonfrom the subjects italready walks and runs the classifiers in a best-effort probe (
probeChannelMontage): any failure(annex pointer, fetch error, parse miss) leaves the columns NULL and never disturbs the existing
modality/subject/task walk.
writeDatasetMetadataColumnsCOALESCE-writes the two new columns; the reindex caller threads themthrough
computeDatasetMetadataColumns.EEG-only for now (channel count + scalp montage are EEG concepts). Populated via the reindex/walk path;
the LLM-enrich path omits them (COALESCE-safe — it has the tree but not file content). Backfill of the
existing ~646 rows is Phase 3 (#859).
Testing
test/channel-montage.unit.test.ts— 18 tests with real-shape inputs: HBNE1..E128+Cz→egi-geodesic/129;BioSemi
A1..D32→biosemi; classic + legacy-T3/T4 →10-20; intermediate →10-10; fine/h-suffixed →10-05;measured-wins-on-disagreement; pointer/garbled → null.
tsc --noEmitgreen; metadata-columns + reindex suites unchanged.nm099999(no-mock D1 policy).Regenerating the label sets
Closes #858. Part of epic #854.