spout 0.8.0.beta7 → 0.8.0.beta8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +3 -16
- data/lib/spout/actions.rb +3 -8
- data/lib/spout/tasks/engine.rake +6 -18
- data/lib/spout/version.rb +1 -1
- data/lib/spout/views/index.html.erb +1 -1
- data/lib/spout/views/outliers.html.erb +1 -1
- 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: 77f00d45a191d59e327952d4af5a2f57c2f65f3b
|
4
|
+
data.tar.gz: 2848258e7bad286df21eee2bb622e3fda54094a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58f411b0735343c82c575897d10b6c02b4521c91dbba3693d204933a295aa6bdf3418e077256eabdabf51172182a652ac436b084346a1ae88748456a4f29dab9
|
7
|
+
data.tar.gz: abf5ec903b9321e5e9f270ac57df9724daef73dcba9a5e25a5400e081bc09556b4ddfccfb5a67463e0e07d89079f7660039f3e787ee6272ad025a2246e599bd0
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
- The `spout pngs` command now renders the histogram form for each variable
|
9
9
|
- The `spout coverage` command now lists variables that are defined in the data dictionary and that do not exist in any CSV dataset
|
10
10
|
- Added `spout outliers` command that returns a list of integer or numeric variables that contain major and minor outliers
|
11
|
+
- Removed the deprecated `spout hybrid` command
|
11
12
|
- **Gem Changes**
|
12
13
|
- Updated to colorize 0.7.2
|
13
14
|
- Use of Ruby 2.1.2 is now recommended
|
data/README.md
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
Turn your CSV data dictionary into a JSON repository. Collaborate with others to update the data dictionary in JSON format. Generate new Data Dictionary from the JSON repository. Test and validate your data dictionary using built-in tests, or add your own tests and validations.
|
8
8
|
|
9
|
+
Spout has been used extensively to curate and clean datasets available on the [National Sleep Research Resource](https://sleepdata.org).
|
10
|
+
|
9
11
|
## Installation
|
10
12
|
|
11
13
|
Add this line to your application's Gemfile:
|
@@ -217,25 +219,10 @@ spout g ahi bmi
|
|
217
219
|
You can also specify a limit to the amount of rows to read in from the CSV files by specifying the `-rows` flag
|
218
220
|
|
219
221
|
```
|
220
|
-
spout -rows=10 ahi
|
222
|
+
spout g -rows=10 ahi
|
221
223
|
```
|
222
224
|
|
223
225
|
This will generate a graph for ahi for the first 10 rows of each dataset CSV.
|
224
226
|
|
225
227
|
|
226
228
|
This will generate charts and tables for each variable in the dataset plotted against the variables listed under `charts`.
|
227
|
-
|
228
|
-
|
229
|
-
### Export to the Hybrid Data Dictionary format from your JSON repository
|
230
|
-
|
231
|
-
Exporting to a format compatible with [Hybrid](https://github.com/sleepepi/hybrid) is also available.
|
232
|
-
|
233
|
-
```
|
234
|
-
spout hybrid
|
235
|
-
```
|
236
|
-
|
237
|
-
You can optionally provide a version string
|
238
|
-
|
239
|
-
```
|
240
|
-
spout hybrid [1.0.0]
|
241
|
-
```
|
data/lib/spout/actions.rb
CHANGED
@@ -17,8 +17,6 @@ module Spout
|
|
17
17
|
import_from_csv(argv, 'domains')
|
18
18
|
when 'export', 'e', 'ex', 'exp', '--export', '-e', '-ex', '-exp'
|
19
19
|
new_data_dictionary_export(argv)
|
20
|
-
when 'hybrid', '-hybrid', '--hybrid', 'y', 'hy', '-y', '-hy'
|
21
|
-
new_data_dictionary_export(argv, 'hybrid')
|
22
20
|
when 'coverage', '-coverage', '--coverage', 'c', '-c'
|
23
21
|
coverage_report(argv)
|
24
22
|
when 'pngs', '-pngs', '--pngs', 'p', '-p'
|
@@ -67,9 +65,7 @@ The most common spout commands are:
|
|
67
65
|
[tv] Run the tests and show passing and failing
|
68
66
|
tests
|
69
67
|
[i]mport Import a CSV file into the JSON dictionary
|
70
|
-
[e]xport [1.0.0] Export the JSON dictionary to
|
71
|
-
h[y]brid [1.0.0] Export the JSON dictionary in the Hybrid
|
72
|
-
dictionary format
|
68
|
+
[e]xport [1.0.0] Export the JSON dictionary to CSV format
|
73
69
|
[c]overage Coverage report, requires dataset CSVs
|
74
70
|
in `<project_name>/csvs/<version>`
|
75
71
|
[o]utliers Outlier report, requires dataset CSVs
|
@@ -89,11 +85,10 @@ EOT
|
|
89
85
|
puts help_message
|
90
86
|
end
|
91
87
|
|
92
|
-
def new_data_dictionary_export(argv
|
88
|
+
def new_data_dictionary_export(argv)
|
93
89
|
version = argv[1].to_s.gsub(/[^a-zA-Z0-9\.-]/, '_').strip
|
94
90
|
version_string = (version == '' ? "" : "VERSION=#{version}")
|
95
|
-
|
96
|
-
system "bundle exec rake spout:create #{version_string} #{type_string}"
|
91
|
+
system "bundle exec rake spout:create #{version_string}"
|
97
92
|
end
|
98
93
|
|
99
94
|
def new_template_dictionary(argv)
|
data/lib/spout/tasks/engine.rake
CHANGED
@@ -23,15 +23,7 @@ namespace :spout do
|
|
23
23
|
puts " create".colorize( :green ) + " #{folder}"
|
24
24
|
FileUtils.mkpath folder
|
25
25
|
|
26
|
-
|
27
|
-
additional_keys = []
|
28
|
-
|
29
|
-
if ENV['TYPE'] == 'hybrid'
|
30
|
-
export_name = 'hybrid'
|
31
|
-
additional_keys = [['hybrid', 'design_name'], ['hybrid', 'design_file'], ['hybrid', 'sensitivity'], ['hybrid', 'commonly_used']]
|
32
|
-
end
|
33
|
-
|
34
|
-
expanded_export(folder, export_name, additional_keys)
|
26
|
+
expanded_export(folder)
|
35
27
|
end
|
36
28
|
|
37
29
|
desc 'Initialize JSON repository from a CSV file: CSV=datadictionary.csv'
|
@@ -84,20 +76,20 @@ def standard_version
|
|
84
76
|
version == '' ? '1.0.0' : version
|
85
77
|
end
|
86
78
|
|
87
|
-
def expanded_export(folder
|
88
|
-
variables_export_file = "
|
79
|
+
def expanded_export(folder)
|
80
|
+
variables_export_file = "variables.csv"
|
89
81
|
puts " export".colorize( :blue ) + " #{folder}/#{variables_export_file}"
|
90
82
|
CSV.open("#{folder}/#{variables_export_file}", "wb") do |csv|
|
91
83
|
keys = %w(id display_name description type units domain labels calculation)
|
92
|
-
csv << ['folder'] + keys
|
84
|
+
csv << ['folder'] + keys
|
93
85
|
Dir.glob("variables/**/*.json").each do |file|
|
94
86
|
if json = JSON.parse(File.read(file)) rescue false
|
95
87
|
variable_folder = variable_folder_path(file)
|
96
|
-
csv << [variable_folder] + keys.collect{|key| json[key].kind_of?(Array) ? json[key].join(';') : json[key].to_s}
|
88
|
+
csv << [variable_folder] + keys.collect{|key| json[key].kind_of?(Array) ? json[key].join(';') : json[key].to_s}
|
97
89
|
end
|
98
90
|
end
|
99
91
|
end
|
100
|
-
domains_export_file = "
|
92
|
+
domains_export_file = "domains.csv"
|
101
93
|
puts " export".colorize( :blue ) + " #{folder}/#{domains_export_file}"
|
102
94
|
CSV.open("#{folder}/#{domains_export_file}", "wb") do |csv|
|
103
95
|
keys = %w(value display_name description)
|
@@ -126,10 +118,6 @@ def variable_folder_path(file)
|
|
126
118
|
file.gsub(/variables\//, '').split('/')[0..-2].join('/')
|
127
119
|
end
|
128
120
|
|
129
|
-
def other_property(parent, json, property)
|
130
|
-
json[parent] ? json[parent][property] : ''
|
131
|
-
end
|
132
|
-
|
133
121
|
def import_variables
|
134
122
|
CSV.parse( File.open(ENV['CSV'].to_s, 'r:iso-8859-1:utf-8'){|f| f.read}, headers: true ) do |line|
|
135
123
|
row = line.to_hash
|
data/lib/spout/version.rb
CHANGED
@@ -187,7 +187,7 @@ tfoot td {
|
|
187
187
|
<tr>
|
188
188
|
<td>
|
189
189
|
<% csv_files.each do |csv_file| %>
|
190
|
-
<code class="<%= 'success' if scr.number_of_errors == 0 %>"><%= csv_file
|
190
|
+
<code class="<%= 'success' if scr.number_of_errors == 0 %>"><%= csv_file %></code><br />
|
191
191
|
<% end %>
|
192
192
|
</td>
|
193
193
|
<td><%= column %></td>
|
@@ -116,7 +116,7 @@ tfoot td {
|
|
116
116
|
<tr>
|
117
117
|
<td>
|
118
118
|
<% outlier_result.csv_files.each do |csv_file| %>
|
119
|
-
<code class="<%= 'success' if outlier_result.outliers.size == 0 %>"><%= csv_file
|
119
|
+
<code class="<%= 'success' if outlier_result.outliers.size == 0 %>"><%= csv_file %></code><br />
|
120
120
|
<% end %></td>
|
121
121
|
<td><%= outlier_result.method %></td>
|
122
122
|
<td>
|