NeurodataWithoutBorders / pynwb

A Python API for working with Neurodata stored in the NWB Format
https://pynwb.readthedocs.io
Other
178 stars 84 forks source link

ability to specify conditions under which certain datasets/attributes are present #22

Closed ajtritt closed 1 week ago

ajtritt commented 7 years ago

Originally reported by: Andrew Tritt (Bitbucket: ajtritt, GitHub: ajtritt)


Examples


ajtritt commented 7 years ago

Original comment by Oliver Ruebel (Bitbucket: oruebel, GitHub: oruebel):


In the previous version of the NWB specification language this was implemented by the _required.

oruebel commented 6 years ago

CC @nclack since this issue came up during discussion of MatNWB.

It might make sense to describe these conditions that relate to the quantity of datasets/groups directly as part of the quantity flag. Currently the quantity flag is just a single value, but it could potentially be a list, where each value has a condition. For example, for the example of TimeSeries mentioned above, TimeSeries.timestamps could have a quantity key that could look something like:

quantity:
  - value: 0
    condition: starting_time
  - value : 1
    condition: None 

The quantity flag in this way would essentially describe a if elif elif else statement. @ajtritt what do you think?

I think we want to avoid using regular expressions as part conditions, so we may need to have some keys like: exists: starting_time etc. to describe the conditions explicitly.

rly commented 1 week ago

This is a schema language and schema issue. I added https://github.com/hdmf-dev/hdmf-schema-language/issues/40 to document that if/when we migrate to a different schema language.