spout 0.8.0.beta2 → 0.8.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e4150e7322cba034877fabe6e4a6cec8bdcd444
4
- data.tar.gz: 25d7aba466f6667316378a3582f6625c1f541bf7
3
+ metadata.gz: fabf087222afb447331381a2c617801f2436abde
4
+ data.tar.gz: 11dac0012791e1105212d1611c49f5d575721ef4
5
5
  SHA512:
6
- metadata.gz: 04137f2579d7da8bf3bcc5ad4105d7ccfe78799656015bbdc0b3e0b34a2503522eb90312919969dad7ec0fbaa6f60231aec7f90bda1e8bbfd8817b28e06e6aea
7
- data.tar.gz: 98fae07b2e79ee985c0ef849b6e0e2706c824d0f7d5c767ca2c97b24523fefd92da973b4ccb762273c814a2843f365dadbca5535a1d7f3f388aa1d5f9ead8336
6
+ metadata.gz: 086fa95b651d175267b289362df2712b4490ef08477a94187647bede45831276fe491eed07f12369f3bed0c0b146cb9907338b4a394c0daa9260e93e7bd55cab
7
+ data.tar.gz: 68c4eb9a2d958eb10f68972a8ce5c764372c2b92e2a6aa99b3a840a7b0b6fca2b3259927af783de5a2b04e33843f00a1130330b59d83ba868bbd0ae724064a05
@@ -11,7 +11,7 @@ module Spout
11
11
 
12
12
  @variable_files = []
13
13
  @valid_ids = []
14
- @number_of_rows = 100
14
+ @number_of_rows = nil
15
15
 
16
16
  spout_config = YAML.load_file('.spout.yml')
17
17
  @visit = (spout_config.kind_of?(Hash) ? spout_config['visit'].to_s.strip : '')
@@ -33,13 +33,10 @@ module Spout
33
33
  end
34
34
 
35
35
  @matching_results = []
36
- csv_names = ['tmp_csv_file.csv']
37
36
 
38
- all_column_headers = @subjects.size > 0 ? @subjects.first.class.instance_methods(false).select{|k| k != :_visit}.reject{|k| k.to_s[-1] == '='} : []
39
- all_column_headers.each do |column|
40
- csv = 'tmp_csv_file.csv'
41
- scr = Spout::Models::CoverageResult.new(csv, column.to_s, @subjects.collect(&column))
42
- @matching_results << [ csv, column, scr ]
37
+ @subject_loader.all_methods.each do |method, csv_files|
38
+ scr = Spout::Models::CoverageResult.new(method, @subjects.collect(&method.to_sym).uniq)
39
+ @matching_results << [ csv_files, method, scr ]
43
40
  end
44
41
 
45
42
 
@@ -47,10 +44,11 @@ module Spout
47
44
 
48
45
  @coverage_results = []
49
46
 
50
- csv_names.each do |csv_name|
51
- total_column_count = @matching_results.select{|mr| mr[0] == csv_name}.count
52
- mapped_column_count = @matching_results.select{|mr| mr[0] == csv_name and mr[2].number_of_errors == 0}.count
53
- @coverage_results << [ csv_name, total_column_count, mapped_column_count ]
47
+ @csv_files = Dir.glob("csvs/#{@standard_version}/*.csv")
48
+ @csv_files.each do |csv_file|
49
+ total_column_count = @matching_results.select{|mr| mr[0].include?(csv_file)}.count
50
+ mapped_column_count = @matching_results.select{|mr| mr[0].include?(csv_file) and mr[2].number_of_errors == 0}.count
51
+ @coverage_results << [ csv_file, total_column_count, mapped_column_count ]
54
52
  end
55
53
 
56
54
  coverage_folder = File.join(Dir.pwd, 'coverage')
@@ -5,6 +5,7 @@ module Spout
5
5
  module Helpers
6
6
  class SubjectLoader
7
7
  attr_accessor :subjects
8
+ attr_reader :all_methods
8
9
 
9
10
  def initialize(variable_files, valid_ids, standard_version, number_of_rows, visit)
10
11
  @subjects = []
@@ -13,6 +14,7 @@ module Spout
13
14
  @standard_version = standard_version
14
15
  @number_of_rows = number_of_rows
15
16
  @visit = visit
17
+ @all_methods = {}
16
18
  end
17
19
 
18
20
  def load_subjects_from_csvs!
@@ -39,6 +41,8 @@ module Spout
39
41
  unless t.respond_to?(key)
40
42
  t.class.send(:define_method, "#{key}") { instance_variable_get("@#{key}") }
41
43
  t.class.send(:define_method, "#{key}=") { |value| instance_variable_set("@#{key}", value) }
44
+ all_methods[key] ||= []
45
+ all_methods[key] << csv_file
42
46
  end
43
47
 
44
48
  unless value == nil
@@ -5,7 +5,7 @@ module Spout
5
5
  class CoverageResult
6
6
  attr_accessor :error, :error_message, :file_name_test, :json_id_test, :values_test, :valid_values, :csv_values, :variable_type_test, :json, :domain_test
7
7
 
8
- def initialize(csv, column, csv_values)
8
+ def initialize(column, csv_values)
9
9
  load_json(column)
10
10
  load_valid_values
11
11
 
data/lib/spout/version.rb CHANGED
@@ -3,7 +3,7 @@ module Spout
3
3
  MAJOR = 0
4
4
  MINOR = 8
5
5
  TINY = 0
6
- BUILD = "beta2" # nil, "pre", "rc", "rc2"
6
+ BUILD = "beta3" # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
@@ -116,7 +116,7 @@ tfoot td {
116
116
  <td style="text-align:middle"><p class="lead">Coverage</p></td>
117
117
  <td style="text-align:middle"><p class="lead"><%= total_count = @matching_results.count %></p></td>
118
118
  <td style="text-align:center">
119
- <% matched = @matching_results.count{|csv, column, scr| scr.file_name_test} %>
119
+ <% matched = @matching_results.count{|csv_files, column, scr| scr.file_name_test} %>
120
120
  <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
121
121
  <% missing_percent = 100 - matched_percent %>
122
122
  <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
@@ -126,7 +126,7 @@ tfoot td {
126
126
  </div>
127
127
  </td>
128
128
  <td style="text-align:center">
129
- <% matched = @matching_results.count{|csv, column, scr| scr.json_id_test} %>
129
+ <% matched = @matching_results.count{|csv_files, column, scr| scr.json_id_test} %>
130
130
  <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
131
131
  <% missing_percent = 100 - matched_percent %>
132
132
  <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
@@ -136,7 +136,7 @@ tfoot td {
136
136
  </div>
137
137
  </td>
138
138
  <td style="text-align:center">
139
- <% matched = @matching_results.count{|csv, column, scr| scr.variable_type_test} %>
139
+ <% matched = @matching_results.count{|csv_files, column, scr| scr.variable_type_test} %>
140
140
  <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
141
141
  <% missing_percent = 100 - matched_percent %>
142
142
  <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
@@ -146,8 +146,8 @@ tfoot td {
146
146
  </div>
147
147
  </td>
148
148
  <td style="text-align:center">
149
- <% matched = @matching_results.count{|csv, column, scr| scr.json['type'] == 'choices' and scr.domain_test} %>
150
- <% total_count = @matching_results.count{|csv, column, scr| scr.json['type'] == 'choices'} %>
149
+ <% matched = @matching_results.count{|csv_files, column, scr| scr.json['type'] == 'choices' and scr.domain_test} %>
150
+ <% total_count = @matching_results.count{|csv_files, column, scr| scr.json['type'] == 'choices'} %>
151
151
  <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
152
152
  <% missing_percent = 100 - matched_percent %>
153
153
  <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
@@ -166,9 +166,13 @@ tfoot td {
166
166
  </tr>
167
167
  </tfoot>
168
168
  <tbody>
169
- <% @matching_results.each do |csv, column, scr| %>
169
+ <% @matching_results.each do |csv_files, column, scr| %>
170
170
  <tr>
171
- <td><code class="<%= 'success' if scr.number_of_errors == 0 %>"><%= csv %></code></td>
171
+ <td>
172
+ <% csv_files.each do |csv_file| %>
173
+ <code class="<%= 'success' if scr.number_of_errors == 0 %>"><%= csv_file %><code><br />
174
+ <% end %>
175
+ </td>
172
176
  <td><%= column %></td>
173
177
  <td>
174
178
  <% if scr.file_name_test %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.beta2
4
+ version: 0.8.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller