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 +4 -4
- data/lib/spout/commands/coverage.rb +9 -11
- data/lib/spout/helpers/subject_loader.rb +4 -0
- data/lib/spout/models/coverage_result.rb +1 -1
- data/lib/spout/version.rb +1 -1
- data/lib/spout/views/index.html.erb +11 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fabf087222afb447331381a2c617801f2436abde
|
4
|
+
data.tar.gz: 11dac0012791e1105212d1611c49f5d575721ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
@
|
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(
|
8
|
+
def initialize(column, csv_values)
|
9
9
|
load_json(column)
|
10
10
|
load_valid_values
|
11
11
|
|
data/lib/spout/version.rb
CHANGED
@@ -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{|
|
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{|
|
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{|
|
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{|
|
150
|
-
<% total_count = @matching_results.count{|
|
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 |
|
169
|
+
<% @matching_results.each do |csv_files, column, scr| %>
|
170
170
|
<tr>
|
171
|
-
<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 %>
|