`metadata.nwb.get_metadata()` validates the whole BIDS dataset for every NWB file, then discards the result
I maintainer di solito rispondono entro 1 giorno
@CodyCBakerPhD ci sta già lavorando.
Dal 13/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
For an NWB file inside a BIDS dataset, dandi.metadata.nwb.get_metadata() builds a new BIDSDatasetDescriptionAsset (via find_bids_dataset_description()) and asks it for the file's BIDS metadata and BIDS version:
https://github.com/dandi/dandi-cli/blob/ad8f64d9abeada4bf87b68eb1a69bea36895ba03/dandi/metadata/nwb.py#L56-L83
The object is new, so its caches are empty, and each call validates the whole dataset twice:
- metadata:
_get_metadata()→ bidsschematoolsvalidate_bids(self.bids_root)(bids.py#L100) - version:
get_validation_bids_version()→_validate()→ denobids_validate(self.bids_root)(bids.py#L121)
NWBBIDSAsset.get_metadata() (used by upload and validate) reaches this function through NWBAsset.get_metadata() → nwb2asset(). So the description object that find_dandi_files() shares across the dataset, whose results are cached, is not reused. A dataset with N NWB files gets 2N extra full-dataset validations. Counted on ieeg_epilepsyNWB from bids-examples with #1958 applied: one NWBBIDSAsset.get_metadata() runs validate_bids twice and bids_validate once.
For NWB files the result is discarded anyway. The BIDS branch can only set the Participant fields that are also in metadata_all_fields: age, genotype, identifier, sex, species, strain. _get_pynwb_metadata() then overwrites every one of them, with None when the NWB file lacks the value. The only key that survives is bids_version, which is always None (#1961). On ieeg_epilepsyNWB, get_metadata() returns the same dict with the BIDS branch disabled, apart from bids_version: None. (The BIDS metadata here comes only from path entities, i.e. subject_id/session_id; participants.tsv is not read.)
History
- #1164 (
dandi lsfor BIDS) added the BIDS branch, at first only for non-NWB files (else:). Commit 11c18f5a then moved it in front of the NWB branch (if bids: … elif nwb:). - #1183 changed
eliftoifso that both branches run for NWB files ("joint BIDS-NWB metadata extraction"). That is also what closed thefiles.bids→metadata.nwb→files.bidsloop that #1958 fixes.
Suggested fix
Skip the BIDS branch for NWB files in nwb.get_metadata(). It is still needed for non-NWB BIDS files in dandi ls and organize. If BIDS values should ever fill gaps in NWB metadata, NWBBIDSAsset.get_metadata() is the place to do it: it already merges both and holds the dataset-wide, cached description. That would also make metadata.nwb stop depending on files.bids for NWB files, which removes the call loop altogether rather than only the recursive call.
- Lingua principale
- Python
- Stelle
- 29
- Fork
- 37
- Merge medio
- 1g 10h
- PR unite (30g)
- 17
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dandi/dandi-cli
-
pynwb metadata: get neurodata typesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
BIDS bug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
dandi/dandi-cli#1961 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
dandi/dandi-cli#1920 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di dandi/dandi-cli
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anchore/grype-db#1149 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `hermes plugins update` clones an entire monorepo twice - `subdir` is resolved but dropped at both catalog-update call sitesForse già presa @HootRock l’ha presa oggi. Apertacomp/cli P2 type/perf
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NousResearch/hermes-agent#142417 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
SMC SPEC
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
tenstorrent/tt-oca-harness#3287 ·
I maintainer di solito rispondono entro 1 giorno
-
bug enhancement python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DewaldOosthuizen/tech-cheat-sheets-and-notes#392 ·
I maintainer di solito rispondono entro 1 giorno
-
Critical advisories on mainApertasecurity
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
fabriziosalmi/wildbox#801 ·
I maintainer di solito rispondono entro 1 giorno