Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an easy way for user to add a README and dataset_description to their output #221

Open
Remi-Gau opened this issue Jan 3, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@Remi-Gau
Copy link
Contributor

Remi-Gau commented Jan 3, 2023

as the dataset_description and the README.md are required by the specification

https://bids-specification.readthedocs.io/en/latest/modality-agnostic-files.html

I think there should be a way to automatically add them in the output dataset, possibly by using some of the config to populate them.

Another good plus would be to have an easy way to generate a method section + list of references a la fmriprep, possibly by relying on jinja templates or similar for more flexibility.

@Remi-Gau
Copy link
Contributor Author

Remi-Gau commented Jan 3, 2023

related to #154

@pvandyken
Copy link
Contributor

#154 stalled because it wasn't clear what's the best way to approach this. Thinking about it now, my preferred approach would be to make dataset_description.json files using a rule within the snakemake folder:

# something like this

rule generate_dataset_description:
  input: inputs['dataset'].path
  output: output / "dataset_description.json"
  run:
    # modify the description file accordingly

Currently, my inputs['dataset'].path syntax wouldn't work because of #216, but once that's resolved, you'd achieve it by defining the dataset component within pybids_inputs. Alternatively, once #223 is implemented, you could access the dataset_description via the pybids layout.

I like the idea of templating, but I think it's ultimately beyond the scope of snakebids. I'd rather spend time trying to make snakebids play well with 3rd party tools that achieve these tasks.

@tkkuehn, not sure if you have thoughts on this?

@Remi-Gau
Copy link
Contributor Author

Remi-Gau commented Jan 7, 2023

so more something that should go in the cookiecutter: like a rule that people can opt in ?

@akhanf
Copy link
Member

akhanf commented Jan 8, 2023

I haven't tried it out, but there is now built-in jinja templating with snakemake:

https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#template-rendering-integration

So the rule-based option would be pretty trivial. I agree having this in the cookiecutter and/or example-snakebids app would make sense.

@pvandyken pvandyken added the enhancement New feature or request label Feb 21, 2023
@kaitj
Copy link
Contributor

kaitj commented Jun 13, 2023

Have a very basic implementation for this now using cookiecutter and the template integration. Some of the implementation details should be discussed. Briefly:

  1. It uses cookiecutter to set up the snakebids app with opt in for creating dataset metadata
  2. If the user opts in, it creates the necessary rules and jinja templates for a barebones README.md and dataset_description.json file, where the file context can be updated via the rule params. Where it can, it will pull data from the defined cookiecutter variables.

@kaitj kaitj self-assigned this Jun 23, 2023
@kaitj
Copy link
Contributor

kaitj commented Jun 23, 2023

During the dev lunch, we discussed moving this away from the cookiecutter / snakemake integration and generating these files with pure Python and as a Snakebids plugin that is run (potentially as a post-workflow hook).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants