Repository navigation
Description
Summary
nemar dataset download <id> always pulls the full annex contents. For multi-GB datasets where the user only wants a few subjects or one task, this wastes bandwidth + time. Add BIDS entity filters that pass through to git annex get --include/--exclude so the clone stays a structurally valid BIDS dataset (all symlinks present) but only matching files have content locally.
Inspired by openneuro-py which exposes --include/--exclude. NEMAR upgrade: BIDS-aware shortcuts.
Proposed flags (on nemar dataset download only)
| Flag | Example | Maps to |
|---|---|---|
--subjects |
sub-01,02 |
--include='sub-01/**' --include='sub-02/**' |
--sessions |
ses-pre,post |
--include='**/ses-pre/**' --include='**/ses-post/**' |
--tasks |
rest,nback |
--include='**/*_task-rest_*' --include='**/*_task-nback_*' |
--runs |
1,2 |
expands both padded + unpadded: *_run-1_*, *_run-01_*, *_run-2_*, *_run-02_* |
--datatypes |
eeg,emg |
--include='**/eeg/**' --include='**/emg/**' |
--include |
'sub-01/eeg/*.edf' |
pass-through (repeatable + comma-list) |
--exclude |
'derivatives/**' |
pass-through (repeatable + comma-list) |
Locked decisions
- Entity normalization: accept
01andsub-01; strip prefix if present, re-add when building globs. - Run zero-padding:
--runs 1matches bothrun-1andrun-01(expand both globs). --no-datamutex:--no-data+ any filter is an error (explicit, since they conflict).- Essential BIDS files: handled automatically by the existing largefiles config (
*.tsv/*.json/README/LICENSE/CHANGES/.bidsignoreare not annexed; they land viagit clone). - Filters apply only to
download, notget: keepsnemar dataset getsimple; users can re-rungit annex get <path>to pull more later.
Why pass-through to git-annex
git-annex already implements glob matching (--include/--exclude). No need for a JS BIDS parser. Each flag becomes a small list of globs appended to the git annex get call. ~50 LOC, not 250.
Files touched
src/commands/dataset.ts—downloadaction: parse flags, build glob list, pass togetDatasetDatasrc/lib/git-annex.ts— extendgetDatasetDataoptions to acceptincludes: string[]/excludes: string[]- New:
src/lib/bids-filter.ts— small flag→glob translator (entity normalization, run-padding expansion) - Tests: unit test the translator (pure function), add one
--subjectsstep totest/e2e-test.tsagainst nm099999
Acceptance
nemar dataset download nm000132 --subjects sub-01clones the full repo (metadata + symlinks intact, valid BIDS) and only pulls annex content forsub-01/**.nemar dataset download nm000132 --subjects 01,02 --tasks restfilters to those subjects ∩ tasks (intersection of include groups).nemar dataset download nm000132 --runs 1matches bothrun-1andrun-01.nemar dataset download nm000132 --no-data --subjects sub-01errors with "cannot combine --no-data with filters".- After a filtered download,
git annex get <other-path>works to pull more files.
Related
Bundled with #347 (--resume) and #348 (--update) in a single PR (feature/issue-347-348-N-download-ux).
Activity
Add --resume, --update, and BIDS entity filters to dataset download (#…