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

[SCHEMA] Add full object definitions for valid values in schema #919

Merged
merged 66 commits into from
Jun 27, 2023

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Nov 1, 2021

This PR adds new information to the schema, but should not affect how it is rendered in the specification.

will simplify finding a solution for:

I'm not going to write a rendering function based on tags in this PR. I think it can go in a future one.

Changes proposed:

  • Convert certain valid values (enums) in the schema to full objects. Specifically, these object definitions contain "name" and "description" fields. In most cases, they're still nested within the parent object definitions, rather than stored as distinct objects and referenced in the objects that use them.

To do:

@@ -1705,6 +1733,7 @@ PCASLType:
Type the gradient pulses used in the `"control"` condition:
`"balanced"` or `"unbalanced"`.
type: string
# TODO: Add definitions for these values.
Copy link
Member Author

Choose a reason for hiding this comment

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

What do the different PCASLType values mean?

@@ -2082,6 +2145,7 @@ SampleOrigin:
Values MUST be one of `"blood"`, `"saliva"`, `"brain"`, `"csf"`,
`"breast milk"`, `"bile"`, `"amniotic fluid"`, `"other biospecimen"`.
type: string
# TODO: Add definitions for these values.
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we describe the different SampleOrigin values?

@@ -2387,6 +2453,7 @@ SpoilingType:
Specifies which spoiling method(s) are used by a spoiled sequence.
Accepted values: `"RF"`, `"GRADIENT"` or `"COMBINED"`.
type: string
# TODO: Add definitions for these values.
Copy link
Member Author

Choose a reason for hiding this comment

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

What do the different SpoilingType values mean?

@@ -2468,6 +2535,7 @@ TissueOrigin:
Values MUST be one of `"gray matter"`, `"white matter"`, `"csf"`,
`"meninges"`, `"macrovascular"` or `microvascular`.
type: string
# TODO: Add definitions for these values.
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we describe the different TissueOrigin values?

@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Patch coverage: 79.54% and project coverage change: -0.18 ⚠️

Comparison is base (f2cea0f) 88.00% compared to head (41189dc) 87.83%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #919      +/-   ##
==========================================
- Coverage   88.00%   87.83%   -0.18%     
==========================================
  Files          16       16              
  Lines        1326     1356      +30     
==========================================
+ Hits         1167     1191      +24     
- Misses        159      165       +6     
Impacted Files Coverage Δ
tools/schemacode/bidsschematools/render/utils.py 85.18% <0.00%> (ø)
tools/schemacode/bidsschematools/schema.py 79.61% <81.81%> (-0.18%) ⬇️
tools/schemacode/bidsschematools/rules.py 98.96% <83.33%> (-1.04%) ⬇️
tools/schemacode/bidsschematools/render/text.py 95.53% <87.50%> (-1.10%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

I'm not 100% sure about this one. I grabbed values from the coordinate systems appendix.
Comment on lines 3063 to 3093
_NonstandardTemplateCoordSys:
type: string
enum:
- individual:
name: individual
description: |
Participant specific anatomical space (for example derived from T1w and/or T2w images).
This coordinate system requires specifying an additional, participant-specific file to be fully defined.
In context of surfaces this space has been referred to as `fsnative`.

In order for this space to be interpretable, `SpatialReference` metadata MUST be provided.
- study:
name: study
description: |
Custom space defined using a group/study-specific template.
This coordinate system requires specifying an additional file to be fully defined.

In order for this space to be interpretable, `SpatialReference` metadata MUST be provided.
_NonTemplateCoordSys:
type: string
enum:
- scanner:
name: scanner
description: |
The intrinsic coordinate system of the original image (the first entry of `RawSources`)
after reconstruction and conversion to NIfTI or equivalent for the case of surfaces and dual volume/surface files.

The `scanner` coordinate system is implicit and assumed by default if the derivative filename does not
define **any** `space-<label>`.
Please note that `space-scanner` SHOULD NOT be used,
it is mentioned in this specification to make its existence explicit.
Copy link
Member Author

Choose a reason for hiding this comment

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

@tsalo tsalo added the schema Issues related to the YAML schema representation of the specification. Patch version release. label Jan 31, 2022
@effigies
Copy link
Collaborator

Noting that this would be a backwards incompatible change (cf #1013), but easily handled by detecting a list of single-keyed objects to a list of keys.

@tsalo tsalo marked this pull request as ready for review June 8, 2023 19:56
@tsalo tsalo requested a review from erdalkaraca as a code owner June 8, 2023 19:56
@tsalo tsalo requested a review from sappelhoff June 15, 2023 17:20
Copy link
Collaborator

@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.

The Phase/SliceEncodingDirection values are slightly weirdly worded. Would something like this work?

Alternately, we at least should use phase/slice in both lines.

src/schema/objects/enums.yaml Outdated Show resolved Hide resolved
src/schema/objects/enums.yaml Outdated Show resolved Hide resolved
Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

I have reviewed this PR and I approve of it, thanks a lot for this work.

Just one question:

For some items you have added the comment

# TODO: Add definitions for these values.

While other items don't have such a comment, yet they are not converted to the "new form" either, e.g.:

  enum:
    - IODINE
    - GADOLINIUM
    - CARBON DIOXIDE
    - BARIUM
    - XENON

Shouldn't we just add information for all enums (except those that only have "n/a")?

Or is that kind of superfluous? (e.g., for m, cm, mm enums ... meter, centimeter ...)

src/schema/objects/columns.yaml Show resolved Hide resolved
src/schema/objects/entities.yaml Show resolved Hide resolved
@tsalo
Copy link
Member Author

tsalo commented Jun 22, 2023

Thanks for reviewing @sappelhoff!

While other items don't have such a comment, yet they are not converted to the "new form" either

Those could be enums that were added after I started this PR, or they might even be ones I just missed in my original pass-through.

Shouldn't we just add information for all enums (except those that only have "n/a")?

I think some are self-explanatory (e.g., I don't know if I want to write descriptions for all of the allowed values for the handedness column, since they include l, L, left, Left, LEFT, etc.), but I do think most valid values could use a description. I think we can tackle that in future PRs though, since this one adds in the infrastructure we need to make that work.

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

ok, great. I am going to merge this today and then do follow up PRs:

  1. rendering the channel type tables in the modality sections from the schema
  2. creating a new appendix page rendering ALL channel types (and putting links to this appendix below the modality ch type tables)
  3. adding remaining enums (or adding comments saying that we won't add them as of now ... for cases where such comments are not currently there already)

@tsalo
Copy link
Member Author

tsalo commented Jun 23, 2023

Thanks!

@sappelhoff sappelhoff merged commit 6d7eb0f into bids-standard:master Jun 27, 2023
@sappelhoff
Copy link
Member

thanks a lot again @tsalo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
schema Issues related to the YAML schema representation of the specification. Patch version release. schema-structure Changes to the fundamental organization/structure of the YAML schema. Minor version release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support full object definitions for valid values in schema
3 participants