openc_bot 0.0.16 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/.gitmodules +3 -0
  2. data/.travis.yml +2 -1
  3. data/examples/basic/lib/basic.rb +3 -2
  4. data/lib/openc_bot/helpers/register_methods.rb +2 -1
  5. data/lib/openc_bot/templates/lib/simple_bot.rb +3 -2
  6. data/lib/openc_bot/version.rb +1 -1
  7. data/lib/simple_openc_bot.rb +2 -2
  8. data/openc_bot.gemspec +13 -0
  9. data/publish.sh +12 -0
  10. data/schemas/.gitignore +13 -0
  11. data/schemas/.travis.yml +5 -0
  12. data/schemas/Gemfile +9 -0
  13. data/schemas/Gemfile.lock +34 -0
  14. data/schemas/README.md +2 -0
  15. data/schemas/Rakefile +46 -0
  16. data/schemas/lib/base-statement.json +22 -0
  17. data/schemas/lib/snippets/financial-payment-base.json +4 -0
  18. data/schemas/lib/snippets/licence-base.json +4 -0
  19. data/schemas/{company-schema.json → schemas/company-schema.json} +0 -0
  20. data/schemas/schemas/financial-payment-schema.json +27 -0
  21. data/schemas/{includes → schemas/includes}/address.json +0 -0
  22. data/schemas/{includes → schemas/includes}/alternative_name.json +1 -1
  23. data/schemas/{includes → schemas/includes}/company.json +2 -0
  24. data/schemas/{includes → schemas/includes}/filing.json +0 -0
  25. data/schemas/schemas/includes/financial-payment-data-object.json +60 -0
  26. data/schemas/{includes → schemas/includes}/industry_code.json +0 -0
  27. data/schemas/{includes/license-data.json → schemas/includes/licence-data-object.json} +13 -4
  28. data/schemas/{includes → schemas/includes}/officer.json +0 -0
  29. data/schemas/{includes → schemas/includes}/previous_name.json +0 -0
  30. data/schemas/{includes → schemas/includes}/share-parcel-data.json +0 -0
  31. data/schemas/{includes → schemas/includes}/share-parcel.json +0 -0
  32. data/schemas/{includes → schemas/includes}/subsidiary-relationship-data.json +4 -9
  33. data/schemas/{includes → schemas/includes}/total-shares.json +0 -0
  34. data/schemas/schemas/licence-schema.json +27 -0
  35. data/schemas/schemas/primary-data-schema.json +17 -0
  36. data/schemas/{share-parcel-schema.json → schemas/share-parcel-schema.json} +0 -0
  37. data/schemas/schemas/simple-financial-payment-schema.json +85 -0
  38. data/schemas/schemas/simple-licence-schema.json +54 -0
  39. data/schemas/schemas/simple-subsidiary-schema.json +62 -0
  40. data/schemas/schemas/subsidiary-relationship-schema.json +27 -0
  41. data/schemas/spec/sample-data/invalid/company-01.json +4 -0
  42. data/schemas/spec/sample-data/invalid/company-02.json +5 -0
  43. data/schemas/spec/sample-data/invalid/company-03.json +5 -0
  44. data/schemas/spec/sample-data/invalid/company-04.json +5 -0
  45. data/schemas/spec/sample-data/invalid/company-05.json +5 -0
  46. data/schemas/spec/sample-data/invalid/company-06.json +6 -0
  47. data/schemas/spec/sample-data/invalid/company-07.json +8 -0
  48. data/schemas/spec/sample-data/invalid/company-08.json +7 -0
  49. data/schemas/spec/sample-data/invalid/company-09.json +9 -0
  50. data/schemas/spec/sample-data/invalid/company-10.json +7 -0
  51. data/schemas/spec/sample-data/invalid/company-11.json +9 -0
  52. data/schemas/spec/sample-data/invalid/company-12.json +11 -0
  53. data/schemas/spec/sample-data/invalid/company-13.json +11 -0
  54. data/schemas/spec/sample-data/invalid/company-14.json +7 -0
  55. data/schemas/spec/sample-data/invalid/company-15.json +7 -0
  56. data/schemas/spec/sample-data/invalid/company-16.json +7 -0
  57. data/schemas/spec/sample-data/invalid/company-17.json +9 -0
  58. data/schemas/spec/sample-data/invalid/company-18.json +9 -0
  59. data/schemas/spec/sample-data/invalid/company-19.json +9 -0
  60. data/schemas/spec/sample-data/invalid/company-20.json +9 -0
  61. data/schemas/spec/sample-data/invalid/company-21.json +11 -0
  62. data/schemas/spec/sample-data/invalid/company-22.json +11 -0
  63. data/schemas/spec/sample-data/invalid/company-23.json +7 -0
  64. data/schemas/spec/sample-data/invalid/company-24.json +12 -0
  65. data/schemas/spec/sample-data/invalid/company-25.json +9 -0
  66. data/schemas/spec/sample-data/invalid/company-26.json +11 -0
  67. data/schemas/spec/sample-data/invalid/company-27.json +7 -0
  68. data/schemas/spec/sample-data/invalid/company-28.json +9 -0
  69. data/schemas/spec/sample-data/invalid/company-29.json +12 -0
  70. data/schemas/spec/sample-data/invalid/company-30.json +16 -0
  71. data/schemas/spec/sample-data/invalid/company-31.json +14 -0
  72. data/schemas/spec/sample-data/invalid/company-32.json +11 -0
  73. data/schemas/spec/sample-data/invalid/company-33.json +7 -0
  74. data/schemas/spec/sample-data/invalid/company-34.json +9 -0
  75. data/schemas/spec/sample-data/invalid/company-35.json +9 -0
  76. data/schemas/spec/sample-data/invalid/company-36.json +10 -0
  77. data/schemas/spec/sample-data/invalid/company-37.json +7 -0
  78. data/schemas/spec/sample-data/invalid/company-38.json +9 -0
  79. data/schemas/spec/sample-data/invalid/company-39.json +11 -0
  80. data/schemas/spec/sample-data/invalid/company-40.json +12 -0
  81. data/schemas/spec/sample-data/invalid/company-41.json +12 -0
  82. data/schemas/spec/sample-data/invalid/company-42.json +7 -0
  83. data/schemas/spec/sample-data/invalid/company-43.json +9 -0
  84. data/schemas/spec/sample-data/invalid/company-44.json +11 -0
  85. data/schemas/spec/sample-data/invalid/company-45.json +11 -0
  86. data/schemas/spec/sample-data/invalid/company-46.json +7 -0
  87. data/schemas/spec/sample-data/invalid/company-47.json +9 -0
  88. data/schemas/spec/sample-data/invalid/company-48.json +9 -0
  89. data/schemas/spec/sample-data/invalid/company-49.json +9 -0
  90. data/schemas/spec/sample-data/invalid/company-50.json +9 -0
  91. data/schemas/spec/sample-data/invalid/company-51.json +9 -0
  92. data/schemas/spec/sample-data/invalid/company-52.json +9 -0
  93. data/schemas/spec/sample-data/invalid/company-53.json +10 -0
  94. data/schemas/spec/sample-data/invalid/company-54.json +9 -0
  95. data/schemas/spec/sample-data/invalid/company-55.json +9 -0
  96. data/schemas/spec/sample-data/invalid/financial-payment-01.json +24 -0
  97. data/schemas/spec/sample-data/invalid/licence-01.json +18 -0
  98. data/schemas/spec/sample-data/invalid/licence-02.json +18 -0
  99. data/schemas/spec/sample-data/invalid/licence-03.json +12 -0
  100. data/schemas/spec/sample-data/invalid/licence-04.json +18 -0
  101. data/schemas/spec/sample-data/invalid/licence-05.json +18 -0
  102. data/schemas/spec/sample-data/invalid/licence-06.json +18 -0
  103. data/schemas/spec/sample-data/invalid/licence-07.json +20 -0
  104. data/schemas/spec/sample-data/invalid/licence-08.json +21 -0
  105. data/schemas/spec/sample-data/invalid/primary-data-01.json +4 -0
  106. data/schemas/spec/sample-data/invalid/primary-data-02.json +4 -0
  107. data/schemas/spec/sample-data/invalid/simple-licence-01.json +9 -0
  108. data/schemas/spec/sample-data/invalid/simple-licence-02.json +8 -0
  109. data/schemas/spec/sample-data/invalid/simple-licence-03.json +9 -0
  110. data/schemas/spec/sample-data/invalid/simple-subsidiary-01.json +13 -0
  111. data/schemas/{licence-schema.json → spec/sample-data/licence-schema.json.old} +1 -1
  112. data/schemas/spec/sample-data/valid/company-01.json +6 -0
  113. data/schemas/spec/sample-data/valid/company-02.json +7 -0
  114. data/schemas/spec/sample-data/valid/company-03.json +8 -0
  115. data/schemas/spec/sample-data/valid/company-04.json +7 -0
  116. data/schemas/spec/sample-data/valid/company-05.json +7 -0
  117. data/schemas/spec/sample-data/valid/company-06.json +12 -0
  118. data/schemas/spec/sample-data/valid/company-07.json +9 -0
  119. data/schemas/spec/sample-data/valid/company-08.json +9 -0
  120. data/schemas/spec/sample-data/valid/company-09.json +20 -0
  121. data/schemas/spec/sample-data/valid/company-10.json +9 -0
  122. data/schemas/spec/sample-data/valid/company-11.json +7 -0
  123. data/schemas/spec/sample-data/valid/company-12.json +7 -0
  124. data/schemas/spec/sample-data/valid/company-13.json +7 -0
  125. data/schemas/spec/sample-data/valid/company-14.json +15 -0
  126. data/schemas/spec/sample-data/valid/company-15.json +8 -0
  127. data/schemas/spec/sample-data/valid/company-16.json +9 -0
  128. data/schemas/spec/sample-data/valid/company-17.json +9 -0
  129. data/schemas/spec/sample-data/valid/company-18.json +9 -0
  130. data/schemas/spec/sample-data/valid/company-19.json +26 -0
  131. data/schemas/spec/sample-data/valid/company-20.json +9 -0
  132. data/schemas/spec/sample-data/valid/company-21.json +26 -0
  133. data/schemas/spec/sample-data/valid/company-22.json +20 -0
  134. data/schemas/spec/sample-data/valid/company-23.json +9 -0
  135. data/schemas/spec/sample-data/valid/company-24.json +12 -0
  136. data/schemas/spec/sample-data/valid/company-25.json +12 -0
  137. data/schemas/spec/sample-data/valid/company-26.json +12 -0
  138. data/schemas/spec/sample-data/valid/company-27.json +28 -0
  139. data/schemas/spec/sample-data/valid/company-28.json +9 -0
  140. data/schemas/spec/sample-data/valid/company-29.json +10 -0
  141. data/schemas/spec/sample-data/valid/company-30.json +9 -0
  142. data/schemas/spec/sample-data/valid/company-31.json +17 -0
  143. data/schemas/spec/sample-data/valid/company-32.json +9 -0
  144. data/schemas/spec/sample-data/valid/company-33.json +24 -0
  145. data/schemas/spec/sample-data/valid/company-34.json +9 -0
  146. data/schemas/spec/sample-data/valid/company-35.json +9 -0
  147. data/schemas/spec/sample-data/valid/company-36.json +9 -0
  148. data/schemas/spec/sample-data/valid/company-37.json +9 -0
  149. data/schemas/spec/sample-data/valid/company-38.json +9 -0
  150. data/schemas/spec/sample-data/valid/company-39.json +9 -0
  151. data/schemas/spec/sample-data/valid/company-40.json +9 -0
  152. data/schemas/spec/sample-data/valid/company-41.json +9 -0
  153. data/schemas/spec/sample-data/valid/company-42.json +10 -0
  154. data/schemas/spec/sample-data/valid/financial-payment-01.json +25 -0
  155. data/schemas/spec/sample-data/valid/financial-payment-02.json +29 -0
  156. data/schemas/spec/sample-data/valid/licence-01.json +19 -0
  157. data/schemas/spec/sample-data/valid/licence-02.json +21 -0
  158. data/schemas/spec/sample-data/valid/licence-03.json +21 -0
  159. data/schemas/spec/sample-data/valid/licence-04.json +26 -0
  160. data/schemas/spec/sample-data/valid/primary-data-01.json +4 -0
  161. data/schemas/spec/sample-data/valid/primary-data-02.json +5 -0
  162. data/schemas/spec/sample-data/valid/simple-licence-01.json +10 -0
  163. data/schemas/spec/sample-data/valid/simple-licence-02.json +10 -0
  164. data/schemas/spec/sample-data/valid/simple-licence-03.json +12 -0
  165. data/schemas/spec/sample-data/valid/simple-subsidiary-01.json +13 -0
  166. data/schemas/spec/sample-data/valid/simple-subsidiary-02.json +13 -0
  167. data/schemas/spec/sample-data/valid/subsidiary-relationship-01.json +23 -0
  168. data/schemas/spec/spec_helper.rb +78 -0
  169. data/schemas/spec/validation_spec.rb +39 -0
  170. data/spec/lib/helpers/register_methods_spec.rb +1 -1
  171. data/spec/schemas/company-schema_spec.rb +4 -3
  172. data/spec/simple_openc_bot_spec.rb +9 -8
  173. metadata +164 -19
  174. data/schemas/includes/base-statement.json +0 -27
  175. data/schemas/subsidiary-relationship-schema.json +0 -19
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "schemas"]
2
+ path = schemas
3
+ url = git://github.com/openc/openc-schema.git
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.2"
3
+ # - "1.9.2"
4
4
  - "1.9.3"
5
+ - "2.0.0"
5
6
  - "2.1.0"
6
7
  # - jruby-18mode # JRuby in 1.8 mode
7
8
  # - jruby-19mode # JRuby in 1.9 mode
@@ -41,13 +41,14 @@ class BasicRecord < SimpleOpencBot::BaseLicenceRecord
41
41
  # `doc/SCHEMA.md` for documentation.
42
42
  def to_pipeline
43
43
  {
44
- sample_date: last_updated_at,
45
44
  company: {
46
45
  name: name,
47
46
  jurisdiction: JURISDICTION,
48
47
  },
49
- source_url: URL,
50
48
  data: [{
49
+ source_url: URL,
50
+ sample_date: last_updated_at,
51
+ confidence: "MEDIUM",
51
52
  data_type: :licence,
52
53
  properties: {
53
54
  jurisdiction_code: JURISDICTION,
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  require 'json-schema'
3
+ require 'active_support'
3
4
  require 'active_support/core_ext'
4
5
 
5
6
  module OpencBot
@@ -142,7 +143,7 @@ module OpencBot
142
143
  end
143
144
 
144
145
  def validate_datum(record)
145
- schema = File.expand_path("../../../../schemas/#{schema_name}.json", __FILE__)
146
+ schema = File.expand_path("../../../../schemas/schemas/#{schema_name}.json", __FILE__)
146
147
  errors = JSON::Validator.fully_validate(
147
148
  schema,
148
149
  record.to_json,
@@ -32,14 +32,15 @@ class MyLicenceRecord < SimpleOpencBot::BaseLicenceRecord
32
32
  # `doc/SCHEMA.md` for documentation.
33
33
  def to_pipeline
34
34
  {
35
- sample_date: last_updated_at,
36
35
  company: {
37
36
  name: name,
38
37
  jurisdiction: "xx",
39
38
  },
40
- source_url: "xx",
41
39
  data: [{
42
40
  data_type: :licence,
41
+ source_url: "xx",
42
+ sample_date: last_updated_at,
43
+ confidence: "MEDIUM",
43
44
  properties: {
44
45
  jurisdiction_code: "xx",
45
46
  category: 'Financial',
@@ -1,3 +1,3 @@
1
1
  module OpencBot
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -224,7 +224,7 @@ class SimpleOpencBot
224
224
 
225
225
  def self.schema(schema)
226
226
  hyphenated_name = schema.to_s.gsub("_", "-")
227
- self._schema = File.expand_path("../../schemas/#{hyphenated_name}-schema.json", __FILE__)
227
+ self._schema = File.expand_path("../../schemas/schemas/#{hyphenated_name}-schema.json", __FILE__)
228
228
  end
229
229
 
230
230
  def initialize(attrs={})
@@ -274,7 +274,7 @@ class SimpleOpencBot
274
274
  if data
275
275
  if !self._schema
276
276
  # backwards compatibility
277
- self._schema = File.expand_path("../../schemas/licence-schema.json", __FILE__)
277
+ self._schema = File.expand_path("../../schemas/schemas/licence-schema.json", __FILE__)
278
278
  end
279
279
  errors = JSON::Validator.fully_validate(
280
280
  self._schema,
data/openc_bot.gemspec CHANGED
@@ -14,6 +14,19 @@ Gem::Specification.new do |gem|
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
 
17
+ # get an array of submodule dirs by executing 'pwd' inside each submodule
18
+ gem_dir = File.expand_path(File.dirname(__FILE__)) + "/"
19
+ `git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
20
+ Dir.chdir(submodule_path) do
21
+ submodule_relative_path = submodule_path.sub gem_dir, ""
22
+ # issue git ls-files in submodule's directory and
23
+ # prepend the submodule path to create absolute file paths
24
+ `git ls-files`.split($\).each do |filename|
25
+ gem.files << "#{submodule_relative_path}/#{filename}"
26
+ end
27
+ end
28
+ end
29
+
17
30
  gem.executables = ['openc_bot']
18
31
 
19
32
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
data/publish.sh ADDED
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ UNPUSHED=$(git log origin/master..HEAD)
4
+ if [ "x$UNPUSHED" == "x" ]; then
5
+ gem build openc_bot.gemspec
6
+ gem push $(ls *gem|tail -1)
7
+ fi
8
+
9
+ function clean {
10
+ rm -f *gem
11
+ }
12
+ trap clean EXIT
@@ -0,0 +1,13 @@
1
+ /.bundle
2
+ /.rvmrc
3
+ /coverage
4
+ /pkg
5
+ /rdoc
6
+ /tags
7
+ /vendor
8
+ /.rbenv-version
9
+ .rspec
10
+ .DS_Store
11
+ *~
12
+ .#*
13
+ #*#
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ - "2.1.0"
data/schemas/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ group :test do
5
+ gem "rspec"
6
+ gem 'json-schema'
7
+ gem 'debugger'
8
+ gem 'rake'
9
+ end
@@ -0,0 +1,34 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ columnize (0.8.9)
5
+ debugger (1.6.8)
6
+ columnize (>= 0.3.1)
7
+ debugger-linecache (~> 1.2.0)
8
+ debugger-ruby_core_source (~> 1.3.5)
9
+ debugger-linecache (1.2.0)
10
+ debugger-ruby_core_source (1.3.5)
11
+ diff-lcs (1.2.5)
12
+ json-schema (2.2.2)
13
+ rake (10.3.2)
14
+ rspec (3.0.0)
15
+ rspec-core (~> 3.0.0)
16
+ rspec-expectations (~> 3.0.0)
17
+ rspec-mocks (~> 3.0.0)
18
+ rspec-core (3.0.2)
19
+ rspec-support (~> 3.0.0)
20
+ rspec-expectations (3.0.2)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.0.0)
23
+ rspec-mocks (3.0.2)
24
+ rspec-support (~> 3.0.0)
25
+ rspec-support (3.0.2)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ debugger
32
+ json-schema
33
+ rake
34
+ rspec
data/schemas/README.md ADDED
@@ -0,0 +1,2 @@
1
+ These are JSON schemas for validating data before it is sent to
2
+ OpenCorporates.
data/schemas/Rakefile ADDED
@@ -0,0 +1,46 @@
1
+ require "rubygems"
2
+
3
+ PROJECT_ROOT = File.expand_path("..", __FILE__)
4
+
5
+ require "rspec/core/rake_task"
6
+ # require 'debugger'
7
+
8
+ desc "Run all specs"
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ t.verbose = true
11
+ end
12
+
13
+ task :default => :spec
14
+
15
+ ## dist
16
+
17
+ require "json"
18
+
19
+ desc "Regenerate schema files from snippets and reference files"
20
+ task :regenerate_data_object_schemas do
21
+ spacers = '='*20
22
+ puts "Regenerating OpenCorporates DataObject schemas"
23
+ puts spacers
24
+ base_object = JSON.parse(File.new(File.join(PROJECT_ROOT,'lib','base-statement.json')).read)
25
+ snippets = Dir.glob(File.join(PROJECT_ROOT,'lib','snippets','*base.json'))
26
+ snippets.each do |snippet|
27
+ object_name = snippet[/\/([^\/]+)-base.json/,1]
28
+ snippet_data = JSON.parse(File.new(snippet).read)
29
+ combined_data = {}.merge(snippet_data).merge(base_object)
30
+ combined_data['properties']['data']['items'] = {
31
+ "$ref" => "includes/#{object_name}-data-object.json"
32
+ }
33
+ File.open(File.join(PROJECT_ROOT,'schemas',"#{object_name}-schema.json"),'w') { |file| file.puts JSON.pretty_generate(combined_data) }
34
+ puts "Generated schema: '#{object_name}-schema.json'"
35
+ end
36
+ puts spacers
37
+ puts "Finished regenerating schemas.\nNow running validation specs"
38
+ puts spacers
39
+ Rake::Task['run_validation_specs'].invoke
40
+ end
41
+
42
+ task :run_validation_specs do
43
+ Rake::Task['default'].invoke
44
+ end
45
+
46
+
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "source_jurisdiction": {
6
+ "description": "Jurisdiction of the source of the data",
7
+ "type": "string"
8
+ },
9
+ "company": {
10
+ "$ref" : "includes/company.json"
11
+ },
12
+ "data": {
13
+ "type": "array",
14
+ "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",
15
+ "items": {
16
+ "$ref": "includes/financial-payment-data-object.json"
17
+ },
18
+ "additionalItems": false
19
+ }
20
+ },
21
+ "required": ["company", "data"]
22
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "Financial-Payment",
3
+ "description": "A Financial-Payment is a payment from government to a recipient"
4
+ }
@@ -0,0 +1,4 @@
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
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "title": "Financial-Payment",
3
+ "description": "A Financial-Payment is a payment from government to a recipient",
4
+ "$schema": "http://json-schema.org/draft-04/schema#",
5
+ "type": "object",
6
+ "properties": {
7
+ "source_jurisdiction": {
8
+ "description": "Jurisdiction of the source of the data",
9
+ "type": "string"
10
+ },
11
+ "company": {
12
+ "$ref": "includes/company.json"
13
+ },
14
+ "data": {
15
+ "type": "array",
16
+ "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",
17
+ "items": {
18
+ "$ref": "includes/financial-payment-data-object.json"
19
+ },
20
+ "additionalItems": false
21
+ }
22
+ },
23
+ "required": [
24
+ "company",
25
+ "data"
26
+ ]
27
+ }
File without changes
@@ -8,6 +8,6 @@
8
8
  "language": { "type": "string", "minLength": 2, "maxLength": 2 },
9
9
  "type": { "type": "string", "enum": ["trading", "abbreviation", "legal"] }
10
10
  },
11
- "required": [ "company_name" ]
11
+ "required": [ "company_name", "type" ]
12
12
  }
13
13
 
@@ -5,8 +5,10 @@
5
5
  "properties": {
6
6
  "name": { "type": "string" },
7
7
  "jurisdiction": { "type": "string" },
8
+ "company_number": { "type": "string" },
8
9
  "identifier": {
9
10
  "type": "string",
11
+ "description": "An official identifier paired with a code for the issuer of the identifier, e.g sec/12345",
10
12
  "pattern": "^[^/]+/[^/]+$"
11
13
  }
12
14
  },
File without changes
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "Financial Payment Datum",
3
+ "type": "object",
4
+ "properties": {
5
+ "data_type": { "enum": [ "financial_payment" ] },
6
+ "source_url": {
7
+ "type": "string"},
8
+ "confidence": {
9
+ "type": "string"},
10
+ "properties": {
11
+ "type": "object",
12
+ "properties": {
13
+ "value": {
14
+ "description": "The amount transacted (e.g. 19.95)",
15
+ "type": "string"},
16
+ "payee_name": {
17
+ "description": "The name of the payee (the entity that received the money)",
18
+ "type": "string"},
19
+ "currency": {
20
+ "description": "The currency of the payment (three letter symbol, e.g. USD, GBP, EUR)",
21
+ "type": "string"},
22
+ "date": {
23
+ "description": "The date on which the payment was made",
24
+ "type": "date"},
25
+ "transaction_number": {
26
+ "description": "The unique identifier for the transaction, scoped to this bot",
27
+ "type": "string"},
28
+ "jurisdiction": {
29
+ "description": "The jurisdiction of the body that made the payment, eg. UK, France, Delaware, Manchester",
30
+ "type": "string"},
31
+ "more_details_url": {
32
+ "description": "A url from which more details can be seen (may be the same as the source_url)",
33
+ "type": ["string",null]},
34
+ "description": {
35
+ "description": "The description of the transaction as given in the raw data",
36
+ "type": ["string",null]},
37
+ "expense_type": {
38
+ "description": "The type of expense -- can be either capital, revenue (i.e. current expenditure) or null",
39
+ "enum": ["capital","revenue",null]},
40
+ "expense_area": {
41
+ "description": "category (in words) of the expenditure",
42
+ "type": ["string",null]},
43
+ "entity_name": {
44
+ "description": "The name of the government entity that made the payment, e.g. Environment Agency",
45
+ "type": "string"},
46
+ "entity_uri": {
47
+ "description": "A unique URL (ideally a dereferencable URI) for the government entity",
48
+ "type": ["string",null]},
49
+ "department_name": {
50
+ "description": "The name of the government department which the entity belongs to (if relevant), e.g. Department of Health",
51
+ "type": ["string",null]},
52
+ "csv_line_number": {
53
+ "description": "If the source for the data is a CSV file, you can optionally include the line number of the CSV from which this data was retrieved",
54
+ "type": ["string",null]}
55
+ },
56
+ "required": [ "value", "payee_name", "date","currency" ]
57
+ }
58
+ },
59
+ "required": [ "data_type", "properties","source_url","confidence" ]
60
+ }
@@ -1,27 +1,36 @@
1
1
  {
2
- "name": "License Data",
2
+ "name": "Licence Data",
3
3
  "type": "object",
4
4
  "properties": {
5
5
  "data_type": { "enum": [ "licence" ] },
6
+ "source_url": {
7
+ "type": "string"},
8
+ "confidence": {
9
+ "type": "string"},
6
10
  "properties": {
7
11
  "type": "object",
8
12
  "properties": {
9
13
  "regulator": {
10
14
  "description": "The regulating body that issued the licence",
11
15
  "type": "string"},
16
+ "category": {
17
+ "description": "The category of licence. Current possible values are: 'Financial','Business'",
18
+ "enum": [ "Financial", "Business" ]},
12
19
  "jurisdiction_code": {
13
20
  "description": "The jurisdiction for which licence was issued",
14
21
  "type": "string"},
15
22
  "licence_number": {
16
- "type": "string"},
23
+ "description": "Licence number or code (can be null)",
24
+ "type": ["string",null]},
17
25
  "jurisdiction_classification": {
18
26
  "type": "array",
27
+ "description": "The local classification given by the regulator",
19
28
  "minItems": 1},
20
29
  "oc_classification": {
21
30
  "type": "array"}
22
31
  },
23
- "required": [ "jurisdiction_code", "jurisdiction_classification" ]
32
+ "required": [ "jurisdiction_code", "jurisdiction_classification", "category" ]
24
33
  }
25
34
  },
26
- "required": [ "data_type", "properties" ]
35
+ "required": [ "data_type", "properties","source_url","confidence" ]
27
36
  }
File without changes
@@ -11,6 +11,9 @@
11
11
  "direct": {
12
12
  "description": "If the control is direct (if via an intermediary, this value should be false; if unknown, left blank)",
13
13
  "type": "boolean"},
14
+ "percentage_controlled": {
15
+ "description": "Percentage controlled, either directly or indirectly",
16
+ "type": "string"},
14
17
  "significant": {
15
18
  "description": "Does the source define the control as somehow significant?",
16
19
  "type": "boolean"},
@@ -33,15 +36,7 @@
33
36
  "type": "string"
34
37
  },
35
38
  "identifier": {
36
- "description": "Unique identifier of person",
37
- "type": "string"
38
- },
39
- "address": {
40
- "description": "Address given for owner of parcel",
41
- "type": "string"
42
- },
43
- "address_country": {
44
- "description": "Country part of owner's address",
39
+ "description": "Unique identifier of company",
45
40
  "type": "string"
46
41
  }
47
42
  }
@@ -0,0 +1,27 @@
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
+ "$schema": "http://json-schema.org/draft-04/schema#",
5
+ "type": "object",
6
+ "properties": {
7
+ "source_jurisdiction": {
8
+ "description": "Jurisdiction of the source of the data",
9
+ "type": "string"
10
+ },
11
+ "company": {
12
+ "$ref": "includes/company.json"
13
+ },
14
+ "data": {
15
+ "type": "array",
16
+ "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",
17
+ "items": {
18
+ "$ref": "includes/licence-data-object.json"
19
+ },
20
+ "additionalItems": false
21
+ }
22
+ },
23
+ "required": [
24
+ "company",
25
+ "data"
26
+ ]
27
+ }
@@ -0,0 +1,17 @@
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
+ }
14
+ },
15
+ "required": ["source_url", "sample_date"],
16
+ "additionalProperties": true
17
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "title": "Simple Financial Payment",
4
+ "description": "A Financial Payment is a payment from government to a recipient",
5
+ "type": "object",
6
+ "properties": {
7
+ "source_url": {
8
+ "description": "Place where this fact can be verified",
9
+ "type": "string"
10
+ },
11
+ "sample_date": {
12
+ "description": "Date on which this fact was known to be true",
13
+ "type": "string"
14
+ },
15
+ "confidence": {
16
+ "description": "Confidence in accuracy of data",
17
+ "type": "string",
18
+ "enum": ["HIGH", "MEDIUM", "LOW"]
19
+ },
20
+ "company_name": {
21
+ "description": "Name of the company that received the money",
22
+ "type": "string"
23
+ },
24
+ "company_jurisdiction": {
25
+ "description": "Jurisdiction where company is based",
26
+ "type": "string"
27
+ },
28
+ "value": {
29
+ "description": "The amount transacted (e.g. 19.95)",
30
+ "type": "string"
31
+ },
32
+ "payee_name": {
33
+ "description": "The name of the payee (the entity that received the money)",
34
+ "type": "string"
35
+ },
36
+ "currency": {
37
+ "description": "The currency of the payment (three letter symbol, e.g. USD, GBP, EUR)",
38
+ "type": "string"
39
+ },
40
+ "date": {
41
+ "description": "The date on which the payment was made",
42
+ "type": "date"
43
+ },
44
+ "transaction_number": {
45
+ "description": "The unique identifier for the transaction, scoped to this bot",
46
+ "type": "string"
47
+ },
48
+ "jurisdiction": {
49
+ "description": "The jurisdiction of the body that made the payment, eg. UK, France, Delaware, Manchester",
50
+ "type": "string"
51
+ },
52
+ "more_details_url": {
53
+ "description": "A url from which more details can be seen (may be the same as the source_url)",
54
+ "type": ["string",null]
55
+ },
56
+ "description": {
57
+ "description": "The description of the transaction as given in the raw data",
58
+ "type": ["string",null]
59
+ },
60
+ "expense_type": {
61
+ "description": "The type of expense -- can be either capital, revenue (i.e. current expenditure) or null",
62
+ "enum": ["capital","revenue",null]
63
+ },
64
+ "expense_area": {
65
+ "description": "category (in words) of the expenditure",
66
+ "type": ["string",null]
67
+ },
68
+ "entity_name": {
69
+ "description": "The name of the government entity that made the payment, e.g. Environment Agency",
70
+ "type": "string"
71
+ },
72
+ "entity_uri": {
73
+ "description": "A unique URL (ideally a dereferencable URI) for the government entity",
74
+ "type": ["string",null]
75
+ },
76
+ "department_name": {
77
+ "description": "The name of the government department which the entity belongs to (if relevant), e.g. Department of Health",
78
+ "type": ["string",null]
79
+ },
80
+ "csv_line_number": {
81
+ "description": "If the source for the data is a CSV file, you can optionally include the line number of the CSV from which this data was retrieved",
82
+ "type": ["string",null]}
83
+ },
84
+ "required": ["source_url", "sample_date", "company_name", "company_jurisdiction", "value", "payee_name", "date", "currency"]
85
+ }