pybids icon indicating copy to clipboard operation
pybids copied to clipboard

Feature request: Creating dataset_description.json files

Open christian-oreilly opened this issue 6 years ago • 4 comments

I looked a bit a pybids code and am I right to conclude that there is currently no utility function in pybids to create dataset_description.json files? I am new to pybids, but it seems to me that pybids is focused more on "reading" BIDS dataset path trees and not much on "writing" them. I would like to use pybids to manage paths in one of my packages. In this context, I create various artifacts (head and brain models, EEG cortical sources, etc.) while performing data analyses and I would like to create derivative sub-trees for these artifacts. In doing so, I would need create the derivative folders and the accompanying dataset_description.json files. Although I could write all the boilerplate code in my own package, it seems to make sense that it would be part of a package like pybids since I guess this is pretty standard BIDS usage... isn't it? Accordingly, I would like to make feature request for that. I don't mind providing the code myself, but I need this to be vetted by pybids developers first.

christian-oreilly avatar Nov 22 '19 15:11 christian-oreilly

@christian-oreilly that's correct, there's currently no such functionality. I think it would be a great addition though, and would be happy to review a PR. It could probably be a standalone function that we put in a (new) utilities module, as the BIDSLayout class is already pretty bloated, and this feels like a separate thing. Let me know if you have any other questions or need any pointers.

tyarkoni avatar Nov 22 '19 16:11 tyarkoni

We have some one-off utility functions:

  • https://github.com/poldracklab/fitlins/blob/1e45226a77abd7b2d4366808f800922537400839/fitlins/utils/bids.py#L112-L153
  • https://github.com/poldracklab/fmriprep/blob/a774bb55efb6163e9ad860e6a0be0e4cfa426745/fmriprep/utils/bids.py#L16-L61

These can probably be made less application specific.

effigies avatar Nov 22 '19 16:11 effigies

@effigies Thanks. It seems like a good start.

@tyarkoni Why not in bids/utils.py instead of a new utilities module?

christian-oreilly avatar Nov 22 '19 16:11 christian-oreilly

bids/utils.py mostly contains very general utilities that are (or could be) useful package-wide. There's actually some stuff in there that should probably move into a bids/layout/utils.py module (well, really just make_bidsfile()), which is also where I'd put what you're proposing.

tyarkoni avatar Nov 22 '19 17:11 tyarkoni