From c09d880b74e81626297538b07283150774e5e2e2 Mon Sep 17 00:00:00 2001 From: roll Date: Wed, 5 Jun 2024 09:47:52 +0100 Subject: [PATCH 1/4] Updated missingValues --- package.json | 3 +- profiles/source/dictionary/schema.yaml | 18 +- profiles/target/2.0/datapackage.json | 480 +++++++++++++++++++++---- profiles/target/2.0/dataresource.json | 480 +++++++++++++++++++++---- profiles/target/2.0/tableschema.json | 480 +++++++++++++++++++++---- 5 files changed, 1265 insertions(+), 196 deletions(-) diff --git a/package.json b/package.json index 3fe4b3b9..7b822b1e 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,13 @@ "npm": "^10.0.0" }, "scripts": { - "build": "astro build && node profiles/build.js", + "build": "astro build && npm run profiles", "clean": "find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' +", "format": "eslint --fix . && prettier --write .", "generate": "astro sync", "lint": "eslint . && prettier --check .", "preview": "astro preview --port 8080", + "profiles": " node profiles/build.js", "start": "astro dev --open --port 8080", "update": "ncu -u", "test": "npm run lint" diff --git a/profiles/source/dictionary/schema.yaml b/profiles/source/dictionary/schema.yaml index 9d5a59ad..912f7fab 100644 --- a/profiles/source/dictionary/schema.yaml +++ b/profiles/source/dictionary/schema.yaml @@ -224,9 +224,21 @@ tableSchemaFalseValues: type: string default: ["false", "False", "FALSE", "0"] tableSchemaMissingValues: - type: array - items: - type: string + anyOf: + - type: array + items: + type: string + - type: array + items: + type: object + required: + - label + - value + properties: + label: + type: string + value: + type: string default: - "" description: Values that when encountered in the source, should be considered diff --git a/profiles/target/2.0/datapackage.json b/profiles/target/2.0/datapackage.json index e43e0bb8..0e56defa 100644 --- a/profiles/target/2.0/datapackage.json +++ b/profiles/target/2.0/datapackage.json @@ -732,10 +732,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -852,10 +874,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1020,10 +1064,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1182,10 +1248,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1293,10 +1381,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1403,10 +1513,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1513,10 +1645,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1665,10 +1819,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1777,10 +1953,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1898,10 +2096,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2021,10 +2241,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2147,10 +2389,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2269,10 +2533,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2393,10 +2679,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2504,10 +2812,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2684,10 +3014,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], diff --git a/profiles/target/2.0/dataresource.json b/profiles/target/2.0/dataresource.json index c8823d47..ee5658d9 100644 --- a/profiles/target/2.0/dataresource.json +++ b/profiles/target/2.0/dataresource.json @@ -496,10 +496,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -616,10 +638,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -784,10 +828,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -946,10 +1012,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1057,10 +1145,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1167,10 +1277,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1277,10 +1409,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1429,10 +1583,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1541,10 +1717,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1662,10 +1860,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1785,10 +2005,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1911,10 +2153,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2033,10 +2297,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2157,10 +2443,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2268,10 +2576,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2448,10 +2778,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], diff --git a/profiles/target/2.0/tableschema.json b/profiles/target/2.0/tableschema.json index 0d784d6c..755d20ab 100644 --- a/profiles/target/2.0/tableschema.json +++ b/profiles/target/2.0/tableschema.json @@ -62,10 +62,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -182,10 +204,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -350,10 +394,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -512,10 +578,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -623,10 +711,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -733,10 +843,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -843,10 +975,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -995,10 +1149,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1107,10 +1283,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1228,10 +1426,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1351,10 +1571,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1477,10 +1719,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1599,10 +1863,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1723,10 +2009,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -1834,10 +2142,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], @@ -2014,10 +2344,32 @@ ] }, "missingValues": { - "type": "array", - "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ], "default": [ "" ], From 6982157dca8ce4c969c654dbc206b06f7d27c559 Mon Sep 17 00:00:00 2001 From: roll Date: Wed, 5 Jun 2024 09:53:55 +0100 Subject: [PATCH 2/4] Added categories/categoriesOrder --- profiles/source/dictionary/schema.yaml | 42 +++++++++++++++++ profiles/target/2.0/datapackage.json | 62 ++++++++++++++++++++++++++ profiles/target/2.0/dataresource.json | 62 ++++++++++++++++++++++++++ profiles/target/2.0/tableschema.json | 62 ++++++++++++++++++++++++++ 4 files changed, 228 insertions(+) diff --git a/profiles/source/dictionary/schema.yaml b/profiles/source/dictionary/schema.yaml index 912f7fab..20fe6c34 100644 --- a/profiles/source/dictionary/schema.yaml +++ b/profiles/source/dictionary/schema.yaml @@ -281,6 +281,10 @@ tableSchemaFieldString: "$ref": "#/definitions/example" missingValues: "$ref": "#/definitions/tableSchemaMissingValues" + categories: + "$ref": "#/definitions/tableSchemaCategoriesString" + categoriesOrder: + "$ref": "#/definitions/tableSchemaCategoriesOrder" type: description: The type keyword, which `MUST` be a value of `string`. enum: @@ -409,6 +413,10 @@ tableSchemaFieldInteger: "$ref": "#/definitions/example" missingValues: "$ref": "#/definitions/tableSchemaMissingValues" + categories: + "$ref": "#/definitions/tableSchemaCategoriesString" + categoriesOrder: + "$ref": "#/definitions/tableSchemaCategoriesOrder" type: description: The type keyword, which `MUST` be a value of `integer`. enum: @@ -1375,3 +1383,37 @@ tableSchemaGroupChar: type: string title: groupChar description: A string whose value is used to group digits within the number. This property does not have a default value. A common value is `,` e.g. '100,000'. +tableSchemaCategoriesString: + anyOf: + - type: array + items: + type: string + - type: array + items: + type: object + required: + - label + - value + properties: + label: + type: string + value: + type: string +tableSchemaCategoriesInteger: + anyOf: + - type: array + items: + type: integer + - type: array + items: + type: object + required: + - label + - value + properties: + label: + type: string + value: + type: integer +tableSchemaCategoriesOrder: + type: boolean diff --git a/profiles/target/2.0/datapackage.json b/profiles/target/2.0/datapackage.json index 0e56defa..4d66d5db 100644 --- a/profiles/target/2.0/datapackage.json +++ b/profiles/target/2.0/datapackage.json @@ -768,6 +768,37 @@ "{\n \"missingValues\": []\n}\n" ] }, + "categories": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ] + }, + "categoriesOrder": { + "type": "boolean" + }, "type": { "description": "The type keyword, which `MUST` be a value of `string`.", "enum": [ @@ -1100,6 +1131,37 @@ "{\n \"missingValues\": []\n}\n" ] }, + "categories": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ] + }, + "categoriesOrder": { + "type": "boolean" + }, "type": { "description": "The type keyword, which `MUST` be a value of `integer`.", "enum": [ diff --git a/profiles/target/2.0/dataresource.json b/profiles/target/2.0/dataresource.json index ee5658d9..d65d7006 100644 --- a/profiles/target/2.0/dataresource.json +++ b/profiles/target/2.0/dataresource.json @@ -532,6 +532,37 @@ "{\n \"missingValues\": []\n}\n" ] }, + "categories": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ] + }, + "categoriesOrder": { + "type": "boolean" + }, "type": { "description": "The type keyword, which `MUST` be a value of `string`.", "enum": [ @@ -864,6 +895,37 @@ "{\n \"missingValues\": []\n}\n" ] }, + "categories": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ] + }, + "categoriesOrder": { + "type": "boolean" + }, "type": { "description": "The type keyword, which `MUST` be a value of `integer`.", "enum": [ diff --git a/profiles/target/2.0/tableschema.json b/profiles/target/2.0/tableschema.json index 755d20ab..8a8a3260 100644 --- a/profiles/target/2.0/tableschema.json +++ b/profiles/target/2.0/tableschema.json @@ -98,6 +98,37 @@ "{\n \"missingValues\": []\n}\n" ] }, + "categories": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ] + }, + "categoriesOrder": { + "type": "boolean" + }, "type": { "description": "The type keyword, which `MUST` be a value of `string`.", "enum": [ @@ -430,6 +461,37 @@ "{\n \"missingValues\": []\n}\n" ] }, + "categories": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + ] + }, + "categoriesOrder": { + "type": "boolean" + }, "type": { "description": "The type keyword, which `MUST` be a value of `integer`.", "enum": [ From ea725e04a57bdfbb8605a53e2e7d408d15d47019 Mon Sep 17 00:00:00 2001 From: roll Date: Wed, 5 Jun 2024 11:09:24 +0100 Subject: [PATCH 3/4] Fixed the implementation --- package.json | 2 +- profiles/source/dictionary/schema.yaml | 27 ++++++++++++-------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 7b822b1e..01a28e16 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "generate": "astro sync", "lint": "eslint . && prettier --check .", "preview": "astro preview --port 8080", - "profiles": " node profiles/build.js", + "profiles": "node profiles/build.js", "start": "astro dev --open --port 8080", "update": "ncu -u", "test": "npm run lint" diff --git a/profiles/source/dictionary/schema.yaml b/profiles/source/dictionary/schema.yaml index 20fe6c34..e25c9663 100644 --- a/profiles/source/dictionary/schema.yaml +++ b/profiles/source/dictionary/schema.yaml @@ -232,13 +232,12 @@ tableSchemaMissingValues: items: type: object required: - - label - value properties: - label: - type: string value: type: string + label: + type: string default: - "" description: Values that when encountered in the source, should be considered @@ -283,8 +282,8 @@ tableSchemaFieldString: "$ref": "#/definitions/tableSchemaMissingValues" categories: "$ref": "#/definitions/tableSchemaCategoriesString" - categoriesOrder: - "$ref": "#/definitions/tableSchemaCategoriesOrder" + categoriesOrdered: + "$ref": "#/definitions/tableSchemaCategoriesOrdered" type: description: The type keyword, which `MUST` be a value of `string`. enum: @@ -414,9 +413,9 @@ tableSchemaFieldInteger: missingValues: "$ref": "#/definitions/tableSchemaMissingValues" categories: - "$ref": "#/definitions/tableSchemaCategoriesString" - categoriesOrder: - "$ref": "#/definitions/tableSchemaCategoriesOrder" + "$ref": "#/definitions/tableSchemaCategoriesInteger" + categoriesOrdered: + "$ref": "#/definitions/tableSchemaCategoriesOrdered" type: description: The type keyword, which `MUST` be a value of `integer`. enum: @@ -1392,13 +1391,12 @@ tableSchemaCategoriesString: items: type: object required: - - label - value properties: - label: - type: string value: type: string + label: + type: string tableSchemaCategoriesInteger: anyOf: - type: array @@ -1408,12 +1406,11 @@ tableSchemaCategoriesInteger: items: type: object required: - - label - value properties: - label: - type: string value: type: integer -tableSchemaCategoriesOrder: + label: + type: string +tableSchemaCategoriesOrdered: type: boolean From 2683e92c406308d73bb620ea13d2a547cddd6ab0 Mon Sep 17 00:00:00 2001 From: roll Date: Wed, 5 Jun 2024 11:10:02 +0100 Subject: [PATCH 4/4] Updated profile targets --- profiles/target/2.0/datapackage.json | 98 +++++++++++---------------- profiles/target/2.0/dataresource.json | 98 +++++++++++---------------- profiles/target/2.0/tableschema.json | 98 +++++++++++---------------- 3 files changed, 120 insertions(+), 174 deletions(-) diff --git a/profiles/target/2.0/datapackage.json b/profiles/target/2.0/datapackage.json index 4d66d5db..6b5c6f61 100644 --- a/profiles/target/2.0/datapackage.json +++ b/profiles/target/2.0/datapackage.json @@ -744,14 +744,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -781,14 +780,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -796,7 +794,7 @@ } ] }, - "categoriesOrder": { + "categoriesOrdered": { "type": "boolean" }, "type": { @@ -917,14 +915,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1107,14 +1104,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1136,7 +1132,7 @@ { "type": "array", "items": { - "type": "string" + "type": "integer" } }, { @@ -1144,14 +1140,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { - "type": "string" - }, "value": { + "type": "integer" + }, + "label": { "type": "string" } } @@ -1159,7 +1154,7 @@ } ] }, - "categoriesOrder": { + "categoriesOrdered": { "type": "boolean" }, "type": { @@ -1322,14 +1317,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1455,14 +1449,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1587,14 +1580,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1719,14 +1711,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1893,14 +1884,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2027,14 +2017,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2170,14 +2159,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2315,14 +2303,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2463,14 +2450,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2607,14 +2593,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2753,14 +2738,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2886,14 +2870,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -3088,14 +3071,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } diff --git a/profiles/target/2.0/dataresource.json b/profiles/target/2.0/dataresource.json index d65d7006..518a1ea9 100644 --- a/profiles/target/2.0/dataresource.json +++ b/profiles/target/2.0/dataresource.json @@ -508,14 +508,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -545,14 +544,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -560,7 +558,7 @@ } ] }, - "categoriesOrder": { + "categoriesOrdered": { "type": "boolean" }, "type": { @@ -681,14 +679,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -871,14 +868,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -900,7 +896,7 @@ { "type": "array", "items": { - "type": "string" + "type": "integer" } }, { @@ -908,14 +904,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { - "type": "string" - }, "value": { + "type": "integer" + }, + "label": { "type": "string" } } @@ -923,7 +918,7 @@ } ] }, - "categoriesOrder": { + "categoriesOrdered": { "type": "boolean" }, "type": { @@ -1086,14 +1081,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1219,14 +1213,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1351,14 +1344,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1483,14 +1475,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1657,14 +1648,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1791,14 +1781,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1934,14 +1923,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2079,14 +2067,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2227,14 +2214,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2371,14 +2357,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2517,14 +2502,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2650,14 +2634,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2852,14 +2835,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } diff --git a/profiles/target/2.0/tableschema.json b/profiles/target/2.0/tableschema.json index 8a8a3260..f3a76baa 100644 --- a/profiles/target/2.0/tableschema.json +++ b/profiles/target/2.0/tableschema.json @@ -74,14 +74,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -111,14 +110,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -126,7 +124,7 @@ } ] }, - "categoriesOrder": { + "categoriesOrdered": { "type": "boolean" }, "type": { @@ -247,14 +245,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -437,14 +434,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -466,7 +462,7 @@ { "type": "array", "items": { - "type": "string" + "type": "integer" } }, { @@ -474,14 +470,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { - "type": "string" - }, "value": { + "type": "integer" + }, + "label": { "type": "string" } } @@ -489,7 +484,7 @@ } ] }, - "categoriesOrder": { + "categoriesOrdered": { "type": "boolean" }, "type": { @@ -652,14 +647,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -785,14 +779,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -917,14 +910,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1049,14 +1041,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1223,14 +1214,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1357,14 +1347,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1500,14 +1489,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1645,14 +1633,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1793,14 +1780,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -1937,14 +1923,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2083,14 +2068,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2216,14 +2200,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } } @@ -2418,14 +2401,13 @@ "items": { "type": "object", "required": [ - "label", "value" ], "properties": { - "label": { + "value": { "type": "string" }, - "value": { + "label": { "type": "string" } }