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

Implement basic function for inheritance principle support within bidsschematools #1181

Open
yarikoptic opened this issue Aug 3, 2022 · 0 comments
Labels
inheritance schema-code Updates or changes to the code used to parse, filter, and render the schema.

Comments

@yarikoptic
Copy link
Collaborator

NB Originally was destined to be posted as reply in #102 but then I decided to make it a separate issue.

A single function cannot cover the entirety of the Inheritance Principle (IP below). I see different target needs:

  • need for validation -- formulated in text and implemented within validator(s) in multiple (!) checks:
    • a file path, if not of a known other file type (top level, a known leaf file) can be considered to be a file to be inherited from. IP 1,2 and [ENH] Inheritance principle: Relaxation allowing multiple files per directory #1003 by @TheChymera provides that implementation.
    • additional errors: implementations of IP 3,4
    • warning level (REF-WARNINGS):
      • a file path determined to be of "inheritance group" must have at least one file present it gets "inherited from" (I think current IP lacks that RECOMMENDED)
      • common metadata should be stored in a single location following RECOMMENDed IP Corollary 2.
  • need for use:
    • get_metadata_files(path: Path) -> list[Path] - given that data (metadata) input path would provide all (available in the dataset) files in the order to be loaded to establish the metadata record. Such function would also be helpful for a validator mode to operate on a "partial BIDS dataset" (e.g. a single subj/ses) as we might need (per our discussion with @satra and @TheChymera ): IP 2-3.
      • reciprocally to this, for validation of REF-WARNINGS above having get_affected_files(path: Path) -> list[Path] would be of great help to see which files would consider a given metadata file path due to inheritance principle. Such functionality would also be greatly useful for some hypothetical bids move so people could get informed while doing smth like bids move task-1_bold.json task-2_bold.json on the top level and thus affecting files down under.
    • get_metadata(path: Path) -> dict - given the data (or even metadata?) file path, load all pertinent metadata. Internally uses get_metadata_files first to get the list of files and then loads them: IP 5. Yet to be coded AFAIK in bidsschematools.

Given your work on #1003, do you think @TheChymera you could provide such get_metadata_files(path: Path) -> list[Path] implementation of get_metadata_files following the current set of IP rules?

PS also filed #1180 which would eventually relate here as inheritance principle would require querying filesystem for availability of a particular filename.

@yarikoptic yarikoptic added the schema-code Updates or changes to the code used to parse, filter, and render the schema. label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inheritance schema-code Updates or changes to the code used to parse, filter, and render the schema.
Projects
None yet
Development

No branches or pull requests

2 participants