From 244b21bb286fa926636f79c352e85e1d164421cd Mon Sep 17 00:00:00 2001 From: Matt Marshall Date: Fri, 13 Feb 2026 14:24:48 +0000 Subject: [PATCH] schema: add enums for closed codelists Fixes #433 by replacing old codelist declarations with new ones. Closed codelists should be declared with the `enum` keyword alongside a sibling `codelist` keyword. Open codelists omit the `enum`, but no open codelists exist within 360Giving at present. --- schema/360-giving-schema.json | 158 +++++++++++++++++++++++----------- 1 file changed, 109 insertions(+), 49 deletions(-) diff --git a/schema/360-giving-schema.json b/schema/360-giving-schema.json index f8ae721f..37a4f738 100644 --- a/schema/360-giving-schema.json +++ b/schema/360-giving-schema.json @@ -327,7 +327,7 @@ "format": "date-time" }, { - "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" + "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" } ], "type": "string", @@ -454,7 +454,7 @@ ], "description": "A name for this location.", "title": "Name" - }, + }, "countryCode": { "type": [ "string", @@ -854,19 +854,19 @@ "type": "object", "required": [ "id", - "name" + "name" ], "properties": { "id": { - "type": "string", - "description": "A unique identifier which identifies the person in the dataset", - "title": "Identifier" - }, - "name": { - "type": "string", - "description": "The Person's full name or a generic name such as \"Individual Recipient\" ", - "title": "Name" - } + "type": "string", + "description": "A unique identifier which identifies the person in the dataset", + "title": "Identifier" + }, + "name": { + "type": "string", + "description": "The Person's full name or a generic name such as \"Individual Recipient\" ", + "title": "Name" + } } }, "Organization": { @@ -997,7 +997,7 @@ "format": "date-time" }, { - "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" + "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" }, { "pattern": "^[0-9]{4}(-(0[1-9]|1[012]))?$" @@ -1013,7 +1013,7 @@ "format": "date-time" }, { - "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" + "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" }, { "pattern": "^[0-9]{4}(-(0[1-9]|1[012]))?$" @@ -1049,7 +1049,7 @@ "id", "title", "description", - "currency", + "currency", "amountAwarded", "awardDate", "recipientOrganization", @@ -1090,17 +1090,17 @@ }, "amountAppliedFor": { "type": "number", - "description": "Total amount applied for in numbers (do not include commas or currency symbols such as \u00a3). If you have provided detailed transaction information on a separate table, this should equal the sum of all the application transactions for this grant.", + "description": "Total amount applied for in numbers (do not include commas or currency symbols such as £). If you have provided detailed transaction information on a separate table, this should equal the sum of all the application transactions for this grant.", "title": "Amount Applied For" }, "amountAwarded": { "type": "number", - "description": "Total amount awarded in numbers (do not include commas or currency symbols such as \u00a3). If you have provided detailed transaction information on a separate table, this should equal the sum of all the award transactions for this grant.", + "description": "Total amount awarded in numbers (do not include commas or currency symbols such as £). If you have provided detailed transaction information on a separate table, this should equal the sum of all the award transactions for this grant.", "title": "Amount Awarded" }, "amountDisbursed": { "type": "number", - "description": "Total amount disbursed (paid) to this grantee when this record was last updated (in numbers: do not include commas or currency symbols such as \u00a3)). If you have provided detailed transaction information on a separate table, this should equal the sum of all the disbursement transactions for this grant.", + "description": "Total amount disbursed (paid) to this grantee when this record was last updated (in numbers: do not include commas or currency symbols such as £)). If you have provided detailed transaction information on a separate table, this should equal the sum of all the disbursement transactions for this grant.", "title": "Amount Disbursed" }, "awardDate": { @@ -1109,7 +1109,7 @@ "format": "date-time" }, { - "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" + "pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$" } ], "type": "string", @@ -1153,29 +1153,73 @@ "title": "To Individuals Details", "properties": { "primaryGrantReason": { - "type": "string", - "title": "Primary Grant Reason", - "description": "A code referring to the reason(s) for a grant to an individual. The value for this field should be drawn from the Grant to Individuals Reason codelist", - "codelist": "grantToIndividualsReason.csv", - "openCodelist": false - }, - "secondaryGrantReason": { - "type": "string", - "title": "Secondary Grant Reason", - "description": "A code referring to the reason(s) for a grant to an individual. The value for this field should be drawn from the Grant to Individuals Reason codelist", - "codelist": "grantToIndividualsReason.csv", - "openCodelist": false - }, - "grantPurpose": { - "type": "array", - "title": "Grant Purpose", - "description": "A code referring to the purpose(s) for a grant to an individual. The value(s) for this field should be drawn from the Grant to Individuals Purpose codelist", - "items": { - "type": "string", - "codelist": "grantToIndividualsPurpose.csv", - "openCodelist": false - } - } + "type": "string", + "title": "Primary Grant Reason", + "description": "A code referring to the reason(s) for a grant to an individual. The value for this field should be drawn from the Grant to Individuals Reason codelist", + "enum": [ + "GTIR010", + "GTIR020", + "GTIR030", + "GTIR040", + "GTIR050", + "GTIR060", + "GTIR070", + "GTIR080", + "GTIR090", + "GTIR100", + "GTIR110", + "GTIR120" + ], + "codelist": "grantToIndividualsReason.csv" + }, + "secondaryGrantReason": { + "type": "string", + "title": "Secondary Grant Reason", + "description": "A code referring to the reason(s) for a grant to an individual. The value for this field should be drawn from the Grant to Individuals Reason codelist", + "enum": [ + "GTIR010", + "GTIR020", + "GTIR030", + "GTIR040", + "GTIR050", + "GTIR060", + "GTIR070", + "GTIR080", + "GTIR090", + "GTIR100", + "GTIR110", + "GTIR120" + ], + "codelist": "grantToIndividualsReason.csv" + }, + "grantPurpose": { + "type": "array", + "title": "Grant Purpose", + "description": "A code referring to the purpose(s) for a grant to an individual. The value(s) for this field should be drawn from the Grant to Individuals Purpose codelist", + "items": { + "type": "string", + "enum": [ + "GTIP010", + "GTIP020", + "GTIP030", + "GTIP040", + "GTIP050", + "GTIP060", + "GTIP070", + "GTIP080", + "GTIP090", + "GTIP100", + "GTIP110", + "GTIP120", + "GTIP130", + "GTIP140", + "GTIP150", + "GTIP160", + "GTIP170" + ], + "codelist": "grantToIndividualsPurpose.csv" + } + } } }, "recipientOrganization": { @@ -1324,15 +1368,31 @@ "title": "For Regrant Type", "description": "A code referring to the type of regranting process that this grant represents. The value for this field should be drawn from the Regrant Type codelist", "type": "string", - "codelist": "regrantType.csv", - "openCodelist": false + "enum": [ + "FRG010", + "FRG020", + "FRG030", + "FRG040", + "FRG050", + "FRG060", + "FRG070" + ], + "codelist": "regrantType.csv" }, "locationScope": { - "type": "string", - "title": "Location Scope", - "description": "A code referring to the location scope applicable to this grant. The value for this field should be drawn from the Location Scope codelist.", - "codelist": "locationScope.csv", - "openCodelist": false + "type": "string", + "title": "Location Scope", + "description": "A code referring to the location scope applicable to this grant. The value for this field should be drawn from the Location Scope codelist.", + "enum": [ + "GLS010", + "GLS020", + "GLS030", + "GLS040", + "GLS050", + "GLS060", + "GLS099" + ], + "codelist": "locationScope.csv" } } }