dandi / dandi-cli

DANDI command line client to facilitate common operations
https://dandi.readthedocs.io/
Apache License 2.0
22 stars 28 forks source link

request: dandiset.get_subjects() in the Python API #1457

Open bendichter opened 4 months ago

bendichter commented 4 months ago

Or it could be named .get_subject_ids or something like that. It would return a list of the subject IDs.

yarikoptic commented 3 months ago

ATM we have separate abstractions for local and remote Dandisets (@jwodder could correct me if I am wrong). Which one of more interest for you here @bendichter ?

We could also have both DANDI and BIDS dandisets. In BIDS there could be a case where subject_id is also present in participants.tsv and have no sub- folder. Anyways for BIDS -- worth looking into integrating/reusing other BIDS-oriented frameworks (pybids etc). With DANDI layouts - also see if/how we could avoid reinventing the wheel.

bendichter commented 3 months ago

I was thinking more for remote dandisets but I suppose either could be useful.

yarikoptic commented 3 months ago

indeed. Let's aim to implement get_subject_ids for both, which would be based on pretty much what we already have in https://github.com/dandi/dandi-schema/blob/HEAD/dandischema/metadata.py#L392 but there we go through all the assets, and here we would want to avoid that and just list folders sub- folders at the top level (remote or local), sanitize labels, and return them (likely sorted for consistency).