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

How to manage constraint and represent mutilple values in the same field #12

Open
demeringo opened this issue Apr 16, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@demeringo
Copy link
Contributor

demeringo commented Apr 16, 2024

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.

@demeringo
Copy link
Contributor Author

demeringo commented May 22, 2024

The answer depends on the context !

When validating the data:

  1. The field has to be modeled as a String.
  2. We decide to use a custom separator (e.g. + or |char) between values
  3. We use a custom validation pattern (regexp) to validate the content

See

When displaying / editing the data in the widget:

  1. We declare the field (and its allowed values) as a string with an enum constraint in the table-schema .
  2. We define the type of the field as tags (⚠ plural form) instead of tag (singular) in the widget config (custom field properties)
  3. We explicit the choosen separator in the widget config (custom field properties) We define the type of the field as tags (⚠ plural form) instead of tag (singular) in the widget config (custom field properties)

@demeringo
Copy link
Contributor Author

demeringo commented May 22, 2024

💡 Close this issue only after our choices of implementation are fully reported into the documentation.

@demeringo demeringo added the documentation Improvements or additions to documentation label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant