Skip to content

Support scalar enumerated type attributesΒ #47

@rly

Description

@rly

A schema writer may want to specify that a particular field can have values from only fixed set of values written in the schema. For example, in NWB, TimeSeries/data has an attribute continuity that allows only values "continuous", "instantaneous", or "step". This restriction should be formalized in the schema language.

This enum type is supported to a degree when validating constructor args using docval in HDMF, e.g., https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/src/pynwb/base.py#L191.

Here is the implementation in HDMF:
https://github.com/hdmf-dev/hdmf/blob/edfab9e0f2f4cda610a44f7d15a775eaa3a2db78/src/hdmf/utils.py#L519-L533

I propose we add support for enumerated types in HDMF. To start, I propose we limit it to scalar attributes with dtypes: int, uint, float, string (bool is not useful).

If there is a strong use case, we can add support for arrays of enumerated types, but that is similar to data that is governed by a controlled vocabulary, for which systems like HERD and restrictions in the API (e.g., HDMF TermSets) could be a solution.

Metadata

Metadata

Assignees

Labels

category: proposaldiscussion of proposed enhancements or new featurespriority: lowalternative solution already working and/or relevant to only specific user(s)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions