How to manage constraint and represent mutilple values in the same field
demeringo opened this issue · 3 comments
Some fields may allow multiple values (e.g. the environmental_indicators
column may need to accept several environmental indicators).
We need to understand how to represent this in the frictionless table schema. https://specs.frictionlessdata.io/table-schema/
We can already apply constraint the values of unitary fileds by using enums in the schema. But we may need to find a different way to model fields that have multiple values (i.e. collection / arrays)
💡 If this is too complex to model, edit or validate, an alternative would be to add more columns, one for each indicator and use it a a boolean (true/false) colum.
The answer depends on the context !
When validating the data:
- The field has to be modeled as a String.
- We decide to use a custom separator (e.g.
+
or|
char) between values - We use a custom validation pattern (regexp) to validate the content
See
When displaying / editing the data in the widget:
- We declare the field (and its allowed values) as a string with an enum constraint in the table-schema .
- We define the type of the field as
tags
(⚠ plural form) instead oftag
(singular) in the widget config (custom field properties) - We explicit the choosen separator in the widget config (custom field properties) We define the type of the field as
tags
(⚠ plural form) instead oftag
(singular) in the widget config (custom field properties)
Close this issue after this is reported to the documentation.