add-dataset: populate n_subjects / n_sessions from OpenNeuroStudies metadata
- Dominant language
- Python
- Stars
- 1
- Forks
- 4
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 24
Description
The ledger's identity columns include `n_subjects` and `n_sessions` (the dataset's own counts — not a per-pipeline inclusion size), but `add-dataset` only writes `url` and `processing_level`, leaving both blank. Surfaced in the 2026-07-09 on-cluster mriqc run (ds005165 registered with both count columns empty).
`add-dataset` already fetches the OpenNeuroStudies per-study metadata TSV via `select.fetch_openneuro_study_metadata()` (the same fetch that derives `processing_level`) but discards the payload, keeping only the level (`_, processing_level = ...`). That TSV carries one row per subject (or per subject×session), so `n_subjects` / `n_sessions` are derivable from it with **no extra network call** — compute and write them into the same row.
Notes:
- These are INPUT columns (iterate reads, never overwrites), so populate at `add-dataset` and keep them hand-editable — same pattern as `processing_level`.
- On a metadata-fetch failure (or a `--processing-level` override with no fetch), leave them blank, as `processing_level` already does.
- Decide the `n_sessions` semantics: blank vs 0 for subject-only datasets, and total session-rows vs per-subject.
Consumers / related: resource estimation (#3) wants these; the bids-study ledger RF (#56) keeps them wide; session→subject aggregation (#11).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the add-dataset path where select.fetch_openneuro_study_metadata() currently returns only processing_level, then inspect the metadata TSV and the ledger-row write. Define the subject-only and session-count semantics, populate both counts on a successful fetch, and preserve blank values on fetch failure or a processing-level override without a fetch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100