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

Fetch BIDS information from schema #34

Merged
merged 7 commits into from
Jun 21, 2024
Merged

Fetch BIDS information from schema #34

merged 7 commits into from
Jun 21, 2024

Conversation

nx10
Copy link
Collaborator

@nx10 nx10 commented Jun 20, 2024

This PR makes bids2table fetch BIDS entity definitions and BIDS datatypes from the official BIDS schema.
This will ensure bids2table is always up-to-date and does not need to be changed when the schema changes.

Custom schema definitions can be injected via bids2table.entities.set_bids_schema_path(...).

See also ohbm/hackathon2024#22

@effigies

Note: run (incorrectly) was an integer before - hence certain changes in the tests.

return entity_schema["name"], Optional[type_], field_


BIDSEntities: Any = make_dataclass(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BIDSEntities: Any = make_dataclass(
BIDSEntities: type = make_dataclass(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had it like this, but mypy does not like it at all (results in everything being flagged missing-attr). There is an open issue: python/mypy#6063

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool...

bids2table/entities.py Outdated Show resolved Hide resolved
bids2table/entities.py Show resolved Hide resolved
bids2table/entities.py Outdated Show resolved Hide resolved
bids2table/entities.py Outdated Show resolved Hide resolved
Copy link
Contributor

@effigies effigies left a comment

Choose a reason for hiding this comment

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

I think these need to be reverted now?

tests/test_table.py Outdated Show resolved Hide resolved
tests/test_entities.py Outdated Show resolved Hide resolved
@clane9
Copy link
Collaborator

clane9 commented Jun 20, 2024

This is a very nice addition, thanks @nx10, @effigies! I think it looks good to me.

@clane9 clane9 merged commit 7650e8c into main Jun 21, 2024
3 checks passed
@clane9 clane9 deleted the bids-schema branch June 21, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants