turbot-runner 0.1.23 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +8 -8
  2. data/lib/turbot_runner.rb +0 -2
  3. data/lib/turbot_runner/processor.rb +7 -70
  4. data/lib/turbot_runner/version.rb +1 -1
  5. data/schema/schemas/company-schema.json +69 -22
  6. data/schema/schemas/financial-payment-schema.json +12 -5
  7. data/schema/schemas/includes/address.json +36 -13
  8. data/schema/schemas/includes/alternative_name.json +32 -9
  9. data/schema/schemas/includes/company-for-nesting.json +70 -23
  10. data/schema/schemas/includes/company.json +15 -6
  11. data/schema/schemas/includes/filing.json +48 -16
  12. data/schema/schemas/includes/financial-payment-data-object.json +73 -21
  13. data/schema/schemas/includes/identifier.json +14 -8
  14. data/schema/schemas/includes/industry_code.json +25 -12
  15. data/schema/schemas/includes/licence-data-object.json +40 -13
  16. data/schema/schemas/includes/officer.json +66 -46
  17. data/schema/schemas/includes/organisation.json +6 -5
  18. data/schema/schemas/includes/permission.json +36 -17
  19. data/schema/schemas/includes/person.json +14 -13
  20. data/schema/schemas/includes/person_name.json +36 -12
  21. data/schema/schemas/includes/previous_name.json +19 -9
  22. data/schema/schemas/includes/share-parcel-data.json +55 -40
  23. data/schema/schemas/includes/share-parcel.json +71 -56
  24. data/schema/schemas/includes/subsidiary-relationship-data.json +19 -8
  25. data/schema/schemas/includes/total-shares.json +13 -6
  26. data/schema/schemas/includes/unknown_entity_type.json +6 -5
  27. data/schema/schemas/licence-schema.json +157 -17
  28. data/schema/schemas/primary-data-schema.json +18 -16
  29. data/schema/schemas/share-parcel-schema.json +8 -7
  30. data/schema/schemas/simple-financial-payment-schema.json +47 -11
  31. data/schema/schemas/simple-licence-schema.json +21 -6
  32. data/schema/schemas/simple-subsidiary-schema.json +15 -4
  33. data/schema/schemas/subsidiary-relationship-schema.json +26 -7
  34. data/spec/lib/processor_spec.rb +3 -75
  35. metadata +5 -10
  36. data/lib/turbot_runner/validator.rb +0 -77
  37. data/lib/turbot_runner/validators.rb +0 -12
  38. data/schema/schemas/rich-licence-schema.json +0 -103
  39. data/spec/lib/validator_spec.rb +0 -235
  40. data/spec/lib/validators_spec.rb +0 -48
@@ -1,63 +1,78 @@
1
1
  {
2
- "name": "Share Parcel",
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
3
  "type": "object",
4
4
  "description": "A parcel of shares in a company",
5
- "required": ["shareholders"],
6
- "properties": {
7
- "number_of_shares": {
8
- "description": "Number of shares, if known",
9
- "type": "integer"},
10
- "percentage_of_shares": {
11
- "description": "Percentage of shares, if known",
12
- "type": "number",
13
- "maximum": 100,
14
- "minimum": 0
15
- },
16
- "start_date": {"type":"string","format": "date"},
17
- "end_date": {"type":"string","format": "date"},
18
- "sample_date": {"type":"string","format": "date"},
19
- "shareholders": {
20
- "description": "Legal persons who own this share parcel",
21
- "type": "array",
22
- "minItems": 1,
23
- "items": {
24
- "type": "object",
25
- "name": "shareholder",
26
- "required": ["name"],
27
- "properties": {
28
- "name": {
29
- "description": "Name of natural person or company",
30
- "type": "string",
31
- "minLength": 1
32
- },
33
- "jurisdiction": {
34
- "description": "Jurisdiction of registration, if company",
35
- "type": "string"
36
- },
37
- "company_number": {
38
- "description": "Company number, if company and known",
39
- "type": "string"
40
- },
41
- "identifier": {
42
- "description": "Unique identifier of person",
43
- "type": "string"
44
- },
45
- "type": {
46
- "description": "Type of person if known (company or natural person)",
47
- "enum" : ["Company", "Person"]
48
- },
49
- "address": {
50
- "description": "Address given for owner of parcel",
51
- "type": "string"
52
- },
53
- "address_country": {
54
- "description": "Country part of owner's address",
55
- "type": "string"
56
- }
5
+ "required": [
57
6
 
7
+ ],
8
+ "properties": {
9
+ "number_of_shares": {
10
+ "description": "Number of shares, if known",
11
+ "type": "integer"
12
+ },
13
+ "percentage_of_shares": {
14
+ "description": "Percentage of shares, if known",
15
+ "type": "number",
16
+ "maximum": 100,
17
+ "minimum": 0
18
+ },
19
+ "start_date": {
20
+ "type": "string",
21
+ "format": "date"
22
+ },
23
+ "end_date": {
24
+ "type": "string",
25
+ "format": "date"
26
+ },
27
+ "sample_date": {
28
+ "type": "string",
29
+ "format": "date"
30
+ },
31
+ "shareholders": {
32
+ "description": "Legal persons who own this share parcel",
33
+ "type": "array",
34
+ "minItems": 1,
35
+ "items": {
36
+ "type": "object",
37
+ "name": "shareholder",
38
+ "required": [
39
+ "name"
40
+ ],
41
+ "properties": {
42
+ "name": {
43
+ "description": "Name of natural person or company",
44
+ "type": "string",
45
+ "minLength": 1
46
+ },
47
+ "jurisdiction": {
48
+ "description": "Jurisdiction of registration, if company",
49
+ "type": "string"
50
+ },
51
+ "company_number": {
52
+ "description": "Company number, if company and known",
53
+ "type": "string"
54
+ },
55
+ "identifier": {
56
+ "description": "Unique identifier of person",
57
+ "type": "string"
58
+ },
59
+ "type": {
60
+ "description": "Type of person if known (company or natural person)",
61
+ "enum": [
62
+ "Company",
63
+ "Person"
64
+ ]
65
+ },
66
+ "address": {
67
+ "description": "Address given for owner of parcel",
68
+ "type": "string"
69
+ },
70
+ "address_country": {
71
+ "description": "Country part of owner's address",
72
+ "type": "string"
58
73
  }
59
74
  }
75
+ }
60
76
  }
61
- },
62
- "required": [ ]
63
- }
77
+ }
78
+ }
@@ -1,26 +1,37 @@
1
1
  {
2
- "name": "Share Parcel Data",
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
3
  "type": "object",
4
4
  "properties": {
5
- "data_type": { "enum": [ "subsidiary_relationship" ] },
5
+ "data_type": {
6
+ "enum": [
7
+ "subsidiary_relationship"
8
+ ]
9
+ },
6
10
  "properties": {
7
11
  "type": "object",
8
- "required": ["subsidiary"],
12
+ "required": [
13
+ "subsidiary"
14
+ ],
9
15
  "additionalProperties": false,
10
16
  "properties": {
11
17
  "direct": {
12
18
  "description": "If the control is direct (if via an intermediary, this value should be false; if unknown, left blank)",
13
- "type": "boolean"},
19
+ "type": "boolean"
20
+ },
14
21
  "percentage_controlled": {
15
22
  "description": "Percentage controlled, either directly or indirectly",
16
- "type": "string"},
23
+ "type": "string"
24
+ },
17
25
  "significant": {
18
26
  "description": "Does the source define the control as somehow significant?",
19
- "type": "boolean"},
27
+ "type": "boolean"
28
+ },
20
29
  "subsidiary": {
21
30
  "description": "Company that is controlled",
22
31
  "type": "object",
23
- "required": ["name"],
32
+ "required": [
33
+ "name"
34
+ ],
24
35
  "additionalProperties": false,
25
36
  "properties": {
26
37
  "name": {
@@ -44,4 +55,4 @@
44
55
  }
45
56
  }
46
57
  }
47
- }
58
+ }
@@ -1,10 +1,17 @@
1
1
  {
2
- "name": "TotalShares",
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
3
  "description": "The total number of shares a company has issued",
4
4
  "type": "object",
5
- "properties": { "number": { "type": "integer" },
6
- "share_class": { "type": "string", "minLength": 1 }
5
+ "properties": {
6
+ "number": {
7
+ "type": "integer"
8
+ },
9
+ "share_class": {
10
+ "type": "string",
11
+ "minLength": 1
12
+ }
7
13
  },
8
- "required": [ "number" ]
9
- }
10
-
14
+ "required": [
15
+ "number"
16
+ ]
17
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
- "title": "UnknownEntityType",
3
- "type": "object",
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
4
3
  "description": "An entity of unknown type - potentially a company, a person, government entity, or some unincorporated organisation",
4
+ "type": "object",
5
5
  "properties": {
6
6
  "name": {
7
7
  "type": "string",
@@ -52,6 +52,7 @@
52
52
  }
53
53
  }
54
54
  },
55
- "required": ["name"]
56
- }
57
-
55
+ "required": [
56
+ "name"
57
+ ]
58
+ }
@@ -1,27 +1,167 @@
1
1
  {
2
- "title": "Licence Schema",
3
- "description": "A Licence is a permission for an entity to do something that would otherwise not be permitted. An example is a 'Financial' licence to operate as a bank, or an financial advisor, for example, or a 'Business' Licence to sell alcohol, or operate an amusement arcade. Future licence types (extractives, pollution) will be added later",
4
2
  "$schema": "http://json-schema.org/draft-04/schema#",
5
- "type": "object",
3
+ "description": "A Licence is a permission for an entity to do something that would otherwise not be permitted. Note that such permissions are recorded in multiple different ways and to different granularity. In addition categories cross over, for example a pawnborker may be regulated as a retail establishment by a city, but also as a financial institution by a national or regional financial regulator. Sometimes the licence is a simple statement – the government of Rwanda has given a banking licence to a certain bank -- other times it is fine-grained and highly complex (e.g. an extractives licence or the UK FCA licencing scheme). This schema tries to make it easy to submit the former, while not losing granularity of the latter. The object has the name of Rich Licence to distinguish it from Simple Licence, which it is expected to ultimately replace.",
6
4
  "properties": {
7
- "sample_date": {"type": "string", "format": "date"},
8
- "start_date": {"type": "string", "format": "date"},
9
- "end_date": {"type": "string", "format": "date"},
10
- "source_jurisdiction": {
11
- "description": "Jurisdiction of the source of the data",
5
+ "licence_holder": {
6
+ "properties": {
7
+ "entity": {
8
+ "oneOf": [
9
+ {
10
+ "properties": {
11
+ "entity_type": {
12
+ "enum": [
13
+ "company"
14
+ ]
15
+ },
16
+ "entity_properties": {
17
+ "$ref": "includes/company-for-nesting.json"
18
+ }
19
+ }
20
+ },
21
+ {
22
+ "properties": {
23
+ "entity_type": {
24
+ "enum": [
25
+ "person"
26
+ ]
27
+ },
28
+ "entity_properties": {
29
+ "$ref": "includes/person.json"
30
+ }
31
+ }
32
+ },
33
+ {
34
+ "properties": {
35
+ "entity_type": {
36
+ "enum": [
37
+ "organisation"
38
+ ]
39
+ },
40
+ "entity_properties": {
41
+ "$ref": "includes/organisation.json"
42
+ }
43
+ }
44
+ },
45
+ {
46
+ "properties": {
47
+ "entity_type": {
48
+ "enum": [
49
+ "unknown"
50
+ ]
51
+ },
52
+ "entity_properties": {
53
+ "$ref": "includes/unknown_entity_type.json"
54
+ }
55
+ }
56
+ }
57
+ ]
58
+ },
59
+ "entity_type": {
60
+ "enum": [
61
+ "company",
62
+ "person",
63
+ "organisation",
64
+ "unknown_entity_type",
65
+ null
66
+ ]
67
+ }
68
+ }
69
+ },
70
+ "licence_issuer": {
71
+ "oneOf": [
72
+ {
73
+ "type": [
74
+ "string",
75
+ "null"
76
+ ],
77
+ "minLength": 2
78
+ },
79
+ {
80
+ "$ref": "includes/organisation.json"
81
+ }
82
+ ]
83
+ },
84
+ "licenced_location": {
85
+ "$ref": "includes/address.json"
86
+ },
87
+ "licence_number": {
12
88
  "type": "string"
13
89
  },
14
- "company": {
15
- "$ref": "includes/company.json"
90
+ "start_date": {
91
+ "description": "The issue date of the licence",
92
+ "type": "string",
93
+ "format": "date"
94
+ },
95
+ "end_date": {
96
+ "description": "The expiry date of the licence",
97
+ "type": "string",
98
+ "format": "date"
99
+ },
100
+ "source_url": {
101
+ "description": "Place where this fact can be verified",
102
+ "type": "string",
103
+ "minLength": 1
104
+ },
105
+ "confidence": {
106
+ "description": "Confidence in accuracy of data",
107
+ "type": "string",
108
+ "enum": [
109
+ "HIGH",
110
+ "MEDIUM",
111
+ "LOW"
112
+ ]
113
+ },
114
+ "renewal_date": {
115
+ "type": "string",
116
+ "format": "date"
117
+ },
118
+ "sample_date": {
119
+ "description": "Date on which we know this to be true (usually date this information was retrieved from the source)",
120
+ "type": "string",
121
+ "format": "date"
16
122
  },
17
- "data": {
123
+ "licence_url": {
124
+ "type": "string",
125
+ "description": "A public URL for the licence"
126
+ },
127
+ "jurisdiction_of_licence": {
128
+ "type": "string",
129
+ "description": "The area in which this licence is valid"
130
+ },
131
+ "status": {
132
+ "type": "string",
133
+ "description": "The status of the licence. If the licence is made up of a number of permissions, each of which has a status, store the status in the permissions field instead/as well"
134
+ },
135
+ "category": {
136
+ "description": "Category of licence",
18
137
  "type": "array",
19
- "description": "This is an array of data objects, that is the objects which actually contain the data about the datum. Generally there will only be one element in this, although in for some types of data_types there may naturally be several releated to the same company, e.g. shareholders",
20
138
  "items": {
21
- "$ref": "includes/licence-data-object.json"
22
- },
23
- "additionalItems": false
139
+ "type": "string",
140
+ "enum": [
141
+ "Financial",
142
+ "Business",
143
+ "Extractive"
144
+ ]
145
+ }
146
+ },
147
+ "permissions": {
148
+ "type": "array",
149
+ "items": {
150
+ "$ref": "includes/permission.json"
151
+ }
152
+ },
153
+ "other_attributes": {
154
+ "description": "Use for other licence attributes for which we don't yet have curated schema attributes",
155
+ "type": "object"
24
156
  }
25
157
  },
26
- "required": ["company", "data", "sample_date"]
27
- }
158
+ "additionalProperties": false,
159
+ "required": [
160
+ "source_url",
161
+ "sample_date",
162
+ "licence_holder",
163
+ "permissions",
164
+ "licence_issuer",
165
+ "jurisdiction_of_licence"
166
+ ]
167
+ }
@@ -1,18 +1,20 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "title": "Primary Data Schema",
4
- "type": "object",
5
- "properties": {
6
- "source_url": {
7
- "description": "Place where this fact can be verified",
8
- "type": "string"
9
- },
10
- "sample_date": {
11
- "description": "Date on which this fact was known to be true",
12
- "type": "string",
13
- "format": "date"
14
- }
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "source_url": {
6
+ "description": "Place where this fact can be verified",
7
+ "type": "string"
15
8
  },
16
- "required": ["source_url", "sample_date"],
17
- "additionalProperties": true
18
- }
9
+ "sample_date": {
10
+ "description": "Date on which this fact was known to be true",
11
+ "type": "string",
12
+ "format": "date"
13
+ }
14
+ },
15
+ "required": [
16
+ "source_url",
17
+ "sample_date"
18
+ ],
19
+ "additionalProperties": true
20
+ }