rf(schema): Make participants/sessions.tsv content available, add glob() and zip() functions#2359
Draft
effigies wants to merge 6 commits intobids-standard:masterfrom
Draft
rf(schema): Make participants/sessions.tsv content available, add glob() and zip() functions#2359effigies wants to merge 6 commits intobids-standard:masterfrom
effigies wants to merge 6 commits intobids-standard:masterfrom
Conversation
Collaborator
Member
|
Related validator PR bids-standard/bids-validator#366 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BEP36 proposes more extensive checks comparing the contents of
/participants.tsv,/sessions.tsvand/phenotype/*.tsvto one another and other session directories. This PR introduces schema changes to facilitate this.We require access to at least
sessions.tsvcontents, and we (@rwblair and I) proposedataset.sessions_tsvas an object mapping column headers onto column contents.For consistency, and because the
dataset.subjectscontext object is an awkward way of accessing the various lists of subject IDs, we propose to makedataset.participants_tsvalong the same lines, withdataset.participants_tsv.participant_idrendering obsoletedataset.subjects.participant_id.We also need to collate rows across columns. The natural operation in Python is
zip(), so we propose that here. It is not used in any checks, yet.With
dataset.subjects.sub_dirsbeing the only remaining content ofdataset.subjects, a more general way of achieving the same goal was desired. Aglob()function seems to fit the bill, which can be used to create lists of files in selectors/checks. This PR demonstrates the use ofglob()anddataset.participants_tsvto obsoletedataset.subjectsaltogether.Would be interested in people's thoughts on these changes. Open to any alternatives.
Additional thoughts on refactoring the validation context
I think the validation context is due a bit of a rethink after a couple years, and getting rid of
dataset.subjectsI think is a good idea regardless of what happens to BEP36, but I'm not married to this approach. I think we should aim for consistency and get rid ofsubject.sessions(and maybesubject), but that hasn't been thought through, yet.Other things in the context that are as-yet unused:
dataset.tree- Theexists()and here-introducedglob()functions do what we might imagine this object should do. Unclear how it could be used without functions or at least comprehensions and predicates.dataset.ignored- There may be checks to write using this, but until we try, it's unclear if this is the right interface.Things that might be reconsidered:
fileobject that represent the file. Perhaps collating the filepath, and similar general filesystem-level attributes should intofile.pathand so-on would make sense.file?file.nifti_headerorfile.columnsmake sense. That said, I'm inclined to leavefileto just contain the fields that do not need more than astatto establish. The principle could bedatasetis populated at validation start,fileis populated when reading the filesystem metadata,nifti_headerand so on require additional opens or computations to populate.cc @ericearl @surchs