`metadata.nwb.get_metadata()` validates the whole BIDS dataset for every NWB file, then discards the result
Los mantenedores suelen responder en 1 día
@CodyCBakerPhD ya está trabajando en esto.
Desde el 13/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 29
- Forks
- 37
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 20
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dandi/dandi-cli
-
pynwb metadata: get neurodata typesQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
BIDS bug
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
dandi/dandi-cli#1961 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
dandi/dandi-cli#1920 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
Todos los issues de dandi/dandi-cli
Issues similares
-
bot-triaged module: LrScheduler module: optimizer triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
documentation glm5 llm-model
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vllm-project/vllm-ascend#19062 ·
Los mantenedores suelen responder en 1 día
-
Author Page: shuai-zhao-llmAbiertoauthor-page correction
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
acl-org/acl-anthology#10496 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Issue Type: Bug Report
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
celery/celery#10875 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
SasanLabs/VulnerableApp#836 ·
Los mantenedores suelen responder en 1 día