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

Use BIDS schema in CuBIDS #392

Merged
merged 23 commits into from
Feb 5, 2025
Merged

Use BIDS schema in CuBIDS #392

merged 23 commits into from
Feb 5, 2025

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Jan 16, 2025

Closes #271.

To do

  • Add method to download new copy of schema.
  • Add ability to feed in a schema version to relevant CuBIDS commands.
  • Determine where the schema should be used.
  • It might be nice to have something like dependabot to automatically download the newest stable version of the schema whenever there's a new release of the specification. Not sure how feasible that it though.

Changes proposed in this pull request

  • Download a copy of the BIDS schema in JSON format to the CuBIDS data directory.
  • Load the schema in the CuBIDS class and store as an attribute.
  • Use the schema to define valid entities, the order in which they can appear, and valid datatypes.

@tsalo tsalo added the enhancement New feature or request label Jan 16, 2025
@tsalo tsalo marked this pull request as ready for review January 28, 2025 16:41
@tsalo tsalo requested a review from mattcieslak January 29, 2025 21:04
Copy link
Contributor

@mattcieslak mattcieslak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic!

@@ -177,6 +178,17 @@ def _parse_validate():
help="Lets user run a locally installed BIDS validator. Default is set to False ",
required=False,
)
parser.add_argument(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great idea. Note to future self: add section to docs that show where to get these files and suggest that users grab a copy at the start of a project.

cubids/cubids.py Outdated
file_keys = ["task", "acquisition", "direction", "reconstruction", "run"]
valid_entities = schema["rules"]["entities"]
entity_names_to_keys = entity_names_to_keys = {
k: v["name"] for k, v in schema["objects"]["entities"].items()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so great to see

cubids/utils.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this get re-introduced? May need a merge from main

@tsalo
Copy link
Member Author

tsalo commented Feb 5, 2025

I've opened #427 about tracking changes to the schema, so I'll merge this now.

@tsalo tsalo changed the title Start adding schema to CuBIDS Use BIDS schema in CuBIDS Feb 5, 2025
@tsalo tsalo merged commit 7650e19 into main Feb 5, 2025
10 checks passed
@tsalo tsalo deleted the schema branch February 5, 2025 20:31
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

Successfully merging this pull request may close these issues.

Entities in CuBIDS.change_filename are not comprehensive/up-to-date
2 participants