rails-data-explorer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +95 -31
- data/doc/rails-data-explorer-screenshot.png +0 -0
- data/lib/rails-data-explorer/chart/contingency_table.rb +1 -1
- data/rails-data-explorer.gemspec +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c75cb60d7ecddbc2fb8e07eb44d25b959b20ba3
|
4
|
+
data.tar.gz: cfdfa4cfa4e253190a32a7ee35d13538158e1a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c030c17f16b5f3a421015a4efe29c3d314cbc087f9defe62d9460245fd19332051f754af3ccfea9dfcffb781110444bf5e104a183c8021dc7b4ab90cac235ad
|
7
|
+
data.tar.gz: de5468fd6bd0136f96ba11e7a03f7879cffbcad0b78d4c343cc7cca6b9227827623aa461366ebab7868e6e5ec52b076112c1b5d99ed8237874d893827583cc32
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
rails-data-explorer
|
2
|
-
===================
|
1
|
+
# rails-data-explorer
|
3
2
|
|
4
|
-
|
3
|
+
Rails-data-explorer is a Rails Engine plugin that makes it easy to explore the
|
5
4
|
data in your app using charts and statistics.
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
All you have to do is to throw your data in table form at rails-data-explorer.
|
7
|
+
Rails-data-explorer then analyzes your data and automatically renders suitable
|
8
|
+
charts and descriptive statistics for each column. It offers tools for uni-, bi-
|
9
|
+
and multi-variate analysis. It can even find correlations in your categorical data
|
10
|
+
using Pearson's Chi Squared test.
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
This gem is under active development and will see significant changes until it's
|
13
|
-
officially released.
|
12
|
+
See below for a screenshot of what you get.
|
14
13
|
|
15
14
|
### Installation
|
16
15
|
|
@@ -21,38 +20,105 @@ or with bundler in your Gemfile:
|
|
21
20
|
`gem 'rails-data-explorer'`
|
22
21
|
|
23
22
|
|
24
|
-
###
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
23
|
+
### Usage
|
24
|
+
|
25
|
+
Let's say you want to explore your app's `User` signup data. Create a route and action
|
26
|
+
named 'signups' in `app/controllers/users_controller.rb`:
|
27
|
+
|
28
|
+
~~~ ruby
|
29
|
+
def signups
|
30
|
+
user_data = User.all.to_a
|
31
|
+
c_binner = RailsDataExplorer::Utils::DataBinner.new(
|
32
|
+
'0' => 0,
|
33
|
+
'1' => 1,
|
34
|
+
'2' => 2,
|
35
|
+
'3..10' => 10,
|
36
|
+
'11..100' => 100,
|
37
|
+
'101..1,000' => 1000,
|
38
|
+
'1,001..10,000' => 10000
|
39
|
+
)
|
40
|
+
@rails_data_explorer = RailsDataExplorer.new(
|
41
|
+
user_data,
|
42
|
+
[
|
43
|
+
{
|
44
|
+
name: "Session duration [Minutes]",
|
45
|
+
data_method: Proc.new { |row|
|
46
|
+
((row.session_duration_minutes * 100).round)/100.0
|
47
|
+
},
|
48
|
+
},
|
49
|
+
{
|
50
|
+
name: "Country",
|
51
|
+
data_method: Proc.new { |row| row.country },
|
52
|
+
multivariate: ['All'],
|
53
|
+
},
|
54
|
+
{
|
55
|
+
name: "Sign in count",
|
56
|
+
data_method: Proc.new { |row| c_binner.bin(row.sign_in_count) },
|
57
|
+
},
|
58
|
+
{
|
59
|
+
name: "Language",
|
60
|
+
data_method: Proc.new { |row| row.language },
|
61
|
+
multivariate: ['All'],
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: "Plan",
|
65
|
+
data_method: Proc.new { |row| row.plan },
|
66
|
+
multivariate: ['All'],
|
67
|
+
},
|
68
|
+
{
|
69
|
+
name: "Sign up date",
|
70
|
+
data_method: Proc.new { |row| row.created_at },
|
71
|
+
},
|
72
|
+
{
|
73
|
+
name: "Sign up quarter",
|
74
|
+
data_method: Proc.new { |row|
|
75
|
+
year = row.created_at.year
|
76
|
+
quarter = (row.created_at.month / 3.0).ceil
|
77
|
+
"#{ year } / Q#{ quarter }"
|
78
|
+
},
|
79
|
+
},
|
80
|
+
]
|
81
|
+
)
|
82
|
+
end
|
83
|
+
~~~
|
84
|
+
|
85
|
+
Then create a view at `app/views/users/signups.html.erb`:
|
86
|
+
|
87
|
+
~~~erb
|
88
|
+
<div class="rails-data-explorer">
|
89
|
+
<h1>User signup data</h1>
|
90
|
+
<%= @rails_data_explorer.render %>
|
91
|
+
</div>
|
92
|
+
~~~
|
93
|
+
|
94
|
+
With just a few lines of code you get comprehensive statistics and charts for your data:
|
95
|
+
|
96
|
+
***
|
97
|
+
|
98
|
+
![Rails data exploration](https://github.com/jhund/rails-data-explorer/blob/master/doc/rails-data-explorer-screenshot.png)
|
99
|
+
|
100
|
+
***
|
37
101
|
|
38
102
|
|
39
103
|
### Ways to shoot yourself in the foot
|
40
104
|
|
41
|
-
* Loading too many DB rows at once
|
105
|
+
* **Loading too many DB rows at once**: Remember that you are loading ActiveRecord
|
42
106
|
objects, and they can use a lot of ram. It's a cartesian product of number of
|
43
107
|
rows times columns per record. As a rule of thumb, for a medium sized model with
|
44
108
|
30 columns, you can load up to 10,000 rows.
|
45
|
-
* Using expensive operations in the
|
109
|
+
* **Using expensive operations in the `:data_method` option for a given data series**:
|
46
110
|
As a rule of thumb, it should be ok to run simple methods that don't require
|
47
|
-
DB access. Examples: `#.to_s`, `if` and `case`, and math operations
|
48
|
-
|
111
|
+
DB access. Examples: `#.to_s`, `if` and `case`, and math operations should all
|
112
|
+
be fine.
|
113
|
+
* **Declaring too many charts**: The charts rendered are the sum of the following:
|
49
114
|
* univariate: one or more charts for each data series
|
50
115
|
* bivariate: the cartesian product of all data series in a bivariate group
|
51
116
|
* multivariate: one or more charts for each multivariate group
|
52
117
|
I have tested it with 70 charts on a single page. More are probably ok, I
|
53
118
|
just haven't tested it.
|
54
|
-
* Drowning in detail
|
55
|
-
Make sure you don't miss the important data in the noise.
|
119
|
+
* **Drowning in detail**: rails-data-explorer makes it easy to generate a large
|
120
|
+
number of charts. Make sure you don't miss the important data in the noise.
|
121
|
+
|
56
122
|
|
57
123
|
### Dependencies
|
58
124
|
|
@@ -63,8 +129,6 @@ or with bundler in your Gemfile:
|
|
63
129
|
|
64
130
|
### Resources
|
65
131
|
|
66
|
-
* [Documentation](http://rails-data-explorer.clearcove.ca)
|
67
|
-
* [Live demo](http://rails-data-explorer-demo.herokuapp.com)
|
68
132
|
* [Changelog](https://github.com/jhund/rails-data-explorer/blob/master/CHANGELOG.md)
|
69
133
|
* [Source code (github)](https://github.com/jhund/rails-data-explorer)
|
70
134
|
* [Issues](https://github.com/jhund/rails-data-explorer/issues)
|
@@ -78,4 +142,4 @@ or with bundler in your Gemfile:
|
|
78
142
|
|
79
143
|
### Copyright
|
80
144
|
|
81
|
-
Copyright (c)
|
145
|
+
Copyright (c) 2015 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/rails-data-explorer/blob/master/MIT-LICENSE) for details.
|
Binary file
|
@@ -182,7 +182,7 @@ class RailsDataExplorer
|
|
182
182
|
delta = @observed_vals[x_val][y_val] - @expected_vals[x_val][y_val]
|
183
183
|
delta_factor = delta / @expected_vals[x_val][y_val].to_f
|
184
184
|
@delta_attrs[x_val][y_val] = {
|
185
|
-
:
|
185
|
+
expected: @expected_vals[x_val][y_val],
|
186
186
|
color: color_scale.compute(delta_factor),
|
187
187
|
delta: delta,
|
188
188
|
delta_factor: delta_factor,
|
data/rails-data-explorer.gemspec
CHANGED
@@ -3,12 +3,12 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = 'rails-data-explorer'
|
6
|
-
gem.version = '0.2.
|
6
|
+
gem.version = '0.2.1'
|
7
7
|
gem.platform = Gem::Platform::RUBY
|
8
8
|
|
9
9
|
gem.authors = ['Jo Hund']
|
10
10
|
gem.email = 'jhund@clearcove.ca'
|
11
|
-
gem.homepage = '
|
11
|
+
gem.homepage = 'https://github.com/jhund/rails-data-explorer'
|
12
12
|
gem.licenses = ['MIT']
|
13
13
|
gem.summary = 'A Rails engine plugin for exploring data in your app with charts and statistics.'
|
14
14
|
gem.description = %(rails-data-explorer is a Rails Engine plugin that makes it easy to explore the data in your app using charts and statistics.)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-data-explorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jo Hund
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- Rakefile
|
166
166
|
- doc/how_to/release.md
|
167
167
|
- doc/how_to/trouble_when_packaging_assets.md
|
168
|
+
- doc/rails-data-explorer-screenshot.png
|
168
169
|
- lib/rails-data-explorer-no-rails.rb
|
169
170
|
- lib/rails-data-explorer.rb
|
170
171
|
- lib/rails-data-explorer/action_view_extension.rb
|
@@ -233,7 +234,7 @@ files:
|
|
233
234
|
- vendor/assets/stylesheets/sources/d3.parsets.css
|
234
235
|
- vendor/assets/stylesheets/sources/nv.d3.css
|
235
236
|
- vendor/assets/stylesheets/sources/rde-default-style.css
|
236
|
-
homepage:
|
237
|
+
homepage: https://github.com/jhund/rails-data-explorer
|
237
238
|
licenses:
|
238
239
|
- MIT
|
239
240
|
metadata: {}
|