Skip to content

Commit 244b21b

Browse files
committed
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.
1 parent d9af947 commit 244b21b

1 file changed

Lines changed: 109 additions & 49 deletions

File tree

schema/360-giving-schema.json

Lines changed: 109 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
"format": "date-time"
328328
},
329329
{
330-
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
330+
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
331331
}
332332
],
333333
"type": "string",
@@ -454,7 +454,7 @@
454454
],
455455
"description": "A name for this location.",
456456
"title": "Name"
457-
},
457+
},
458458
"countryCode": {
459459
"type": [
460460
"string",
@@ -854,19 +854,19 @@
854854
"type": "object",
855855
"required": [
856856
"id",
857-
"name"
857+
"name"
858858
],
859859
"properties": {
860860
"id": {
861-
"type": "string",
862-
"description": "A unique identifier which identifies the person in the dataset",
863-
"title": "Identifier"
864-
},
865-
"name": {
866-
"type": "string",
867-
"description": "The Person's full name or a generic name such as \"Individual Recipient\" ",
868-
"title": "Name"
869-
}
861+
"type": "string",
862+
"description": "A unique identifier which identifies the person in the dataset",
863+
"title": "Identifier"
864+
},
865+
"name": {
866+
"type": "string",
867+
"description": "The Person's full name or a generic name such as \"Individual Recipient\" ",
868+
"title": "Name"
869+
}
870870
}
871871
},
872872
"Organization": {
@@ -997,7 +997,7 @@
997997
"format": "date-time"
998998
},
999999
{
1000-
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
1000+
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
10011001
},
10021002
{
10031003
"pattern": "^[0-9]{4}(-(0[1-9]|1[012]))?$"
@@ -1013,7 +1013,7 @@
10131013
"format": "date-time"
10141014
},
10151015
{
1016-
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
1016+
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
10171017
},
10181018
{
10191019
"pattern": "^[0-9]{4}(-(0[1-9]|1[012]))?$"
@@ -1049,7 +1049,7 @@
10491049
"id",
10501050
"title",
10511051
"description",
1052-
"currency",
1052+
"currency",
10531053
"amountAwarded",
10541054
"awardDate",
10551055
"recipientOrganization",
@@ -1090,17 +1090,17 @@
10901090
},
10911091
"amountAppliedFor": {
10921092
"type": "number",
1093-
"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.",
1093+
"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.",
10941094
"title": "Amount Applied For"
10951095
},
10961096
"amountAwarded": {
10971097
"type": "number",
1098-
"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.",
1098+
"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.",
10991099
"title": "Amount Awarded"
11001100
},
11011101
"amountDisbursed": {
11021102
"type": "number",
1103-
"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.",
1103+
"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.",
11041104
"title": "Amount Disbursed"
11051105
},
11061106
"awardDate": {
@@ -1109,7 +1109,7 @@
11091109
"format": "date-time"
11101110
},
11111111
{
1112-
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
1112+
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
11131113
}
11141114
],
11151115
"type": "string",
@@ -1153,29 +1153,73 @@
11531153
"title": "To Individuals Details",
11541154
"properties": {
11551155
"primaryGrantReason": {
1156-
"type": "string",
1157-
"title": "Primary Grant Reason",
1158-
"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",
1159-
"codelist": "grantToIndividualsReason.csv",
1160-
"openCodelist": false
1161-
},
1162-
"secondaryGrantReason": {
1163-
"type": "string",
1164-
"title": "Secondary Grant Reason",
1165-
"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",
1166-
"codelist": "grantToIndividualsReason.csv",
1167-
"openCodelist": false
1168-
},
1169-
"grantPurpose": {
1170-
"type": "array",
1171-
"title": "Grant Purpose",
1172-
"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",
1173-
"items": {
1174-
"type": "string",
1175-
"codelist": "grantToIndividualsPurpose.csv",
1176-
"openCodelist": false
1177-
}
1178-
}
1156+
"type": "string",
1157+
"title": "Primary Grant Reason",
1158+
"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",
1159+
"enum": [
1160+
"GTIR010",
1161+
"GTIR020",
1162+
"GTIR030",
1163+
"GTIR040",
1164+
"GTIR050",
1165+
"GTIR060",
1166+
"GTIR070",
1167+
"GTIR080",
1168+
"GTIR090",
1169+
"GTIR100",
1170+
"GTIR110",
1171+
"GTIR120"
1172+
],
1173+
"codelist": "grantToIndividualsReason.csv"
1174+
},
1175+
"secondaryGrantReason": {
1176+
"type": "string",
1177+
"title": "Secondary Grant Reason",
1178+
"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",
1179+
"enum": [
1180+
"GTIR010",
1181+
"GTIR020",
1182+
"GTIR030",
1183+
"GTIR040",
1184+
"GTIR050",
1185+
"GTIR060",
1186+
"GTIR070",
1187+
"GTIR080",
1188+
"GTIR090",
1189+
"GTIR100",
1190+
"GTIR110",
1191+
"GTIR120"
1192+
],
1193+
"codelist": "grantToIndividualsReason.csv"
1194+
},
1195+
"grantPurpose": {
1196+
"type": "array",
1197+
"title": "Grant Purpose",
1198+
"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",
1199+
"items": {
1200+
"type": "string",
1201+
"enum": [
1202+
"GTIP010",
1203+
"GTIP020",
1204+
"GTIP030",
1205+
"GTIP040",
1206+
"GTIP050",
1207+
"GTIP060",
1208+
"GTIP070",
1209+
"GTIP080",
1210+
"GTIP090",
1211+
"GTIP100",
1212+
"GTIP110",
1213+
"GTIP120",
1214+
"GTIP130",
1215+
"GTIP140",
1216+
"GTIP150",
1217+
"GTIP160",
1218+
"GTIP170"
1219+
],
1220+
"codelist": "grantToIndividualsPurpose.csv"
1221+
}
1222+
}
11791223
}
11801224
},
11811225
"recipientOrganization": {
@@ -1324,15 +1368,31 @@
13241368
"title": "For Regrant Type",
13251369
"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",
13261370
"type": "string",
1327-
"codelist": "regrantType.csv",
1328-
"openCodelist": false
1371+
"enum": [
1372+
"FRG010",
1373+
"FRG020",
1374+
"FRG030",
1375+
"FRG040",
1376+
"FRG050",
1377+
"FRG060",
1378+
"FRG070"
1379+
],
1380+
"codelist": "regrantType.csv"
13291381
},
13301382
"locationScope": {
1331-
"type": "string",
1332-
"title": "Location Scope",
1333-
"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.",
1334-
"codelist": "locationScope.csv",
1335-
"openCodelist": false
1383+
"type": "string",
1384+
"title": "Location Scope",
1385+
"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.",
1386+
"enum": [
1387+
"GLS010",
1388+
"GLS020",
1389+
"GLS030",
1390+
"GLS040",
1391+
"GLS050",
1392+
"GLS060",
1393+
"GLS099"
1394+
],
1395+
"codelist": "locationScope.csv"
13361396
}
13371397
}
13381398
}

0 commit comments

Comments
 (0)