Replies: 2 comments
-
This sounds like a good application of the Category Tables recipe, which will be available in the v2.1 version of the spec: #1081 We have not extended this functionality to lists of categorical values, but this is an easy logical next step, and would be also useful for multiselect survey items: #1039 |
Beta Was this translation helpful? Give feedback.
-
(@afeld if adding Category Tables capabilities to list types matches your use case here, let me know and we can talk about putting together a proposal to add to the spec) (PS Here's a link to a more easily readable version of the category tables recipe: https://github.com/frictionlessdata/datapackage/blob/next/content/docs/recipes/category-tables.md) Here's how it might look for list of fruits referencing a list of possible values in another package. (e.g. {
"name": "fruit",
"type": "list",
"itemType": "string",
"categories": {
"package": "http://example.com/package.json",
"resource": "fruit-codes",
"encodedAs": "label"
}
} And then in {
"name": "fruit-codes",
"type": "table",
"categoryFieldMap": {
"value": "code",
"label": "name",
"ordered": false
},
"schema": {
"fields": [
{ "name": "code", "type": "string" },
{ "name": "name", "type": "string" }
]
},
"data": [
{ "code": "A", "name": "Apple" },
{ "code": "B", "name": "Banana" },
{ "code": "C", "name": "Cherry" }
]
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on the
datapackage.json
for the data underpinning dataportals.org. There are a few columns that areenum
s, for which there are long lists of values that come from other sources.country
language
*license_id
*This field can have multiple values, though that isn't supported in frictionless-py yet: frictionlessdata/frictionless-py#1741
I could copy-and-paste all those values into the
enum
array, but:I tried:
rdfType
s, exactly like the exampleenum
values, to at least avoid the copying-and-pasting: validate license values okfn/dataportals.org#389Is this a use case that the spec considers? If not, would it be in scope?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions