geoptima 0.1.0 → 0.1.1
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.
- data/README.rdoc +84 -16
- data/bin/csv_chart +4 -4
- data/bin/show_geoptima +2 -5
- data/examples/csv_chart.rb +4 -4
- data/examples/show_geoptima.rb +2 -5
- data/lib/geoptima/version.rb +1 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -9,33 +9,105 @@ For more information on Geoptima refer to:
|
|
9
9
|
|
10
10
|
=== Documentation
|
11
11
|
|
12
|
-
The current version includes the core geoptima.rb library as well as a few command-line apps for using the library.
|
12
|
+
The current version includes the core geoptima.rb library as well as a few command-line apps for using the library. We have not yet documented the library, but some of the command-line scripts are described below.
|
13
13
|
|
14
|
-
== show_geoptima
|
14
|
+
== show_geoptima
|
15
15
|
|
16
|
-
This script
|
16
|
+
This script imports the JSON files on the command-line and then:
|
17
17
|
* Prints out basic information about each file (subscriber information, start date and number of events)
|
18
18
|
* Optionally prints out all events on the console for visual inspection (using the -p option)
|
19
19
|
* Optionally prints out all events to files in CSV format with merging of event types and fields into a single header for further processing with Excel or OpenOffice (using the -x option)
|
20
|
+
* The CSV export mode has many further options for exporting to multiple files (-s), merging IMEI's into single dataset (-a), long headers with repeated information (-l), etc.
|
20
21
|
|
21
22
|
Which event types to include and various other options are available using the command-line. Run it with the -h option to get a full list of options. The current version should support:
|
22
23
|
|
23
|
-
Usage:
|
24
|
+
Usage: show_geoptima <-dpvxomlsah> <-L limit> <-E types> <-T min,max> file <files>
|
24
25
|
-d debug mode (output more context during processing) (false)
|
25
26
|
-p print mode (print out final results to console)
|
26
27
|
-v verbose mode (output extra information to console)
|
27
28
|
-x export IMEI specific CSV files for further processing
|
29
|
+
-o export field statistis
|
30
|
+
-m map headers to classic NetView compatible version
|
31
|
+
-l longer header list (phone and operator fields)
|
28
32
|
-s seperate the export files by event type
|
33
|
+
-a combine all IMEI's into a single dataset
|
29
34
|
-h show this help
|
30
|
-
-L limit verbose output to specific number of lines (10000)
|
31
35
|
-E comma-seperated list of event types to show and export (default: all; current: )
|
32
36
|
-T time range to limit results to (default: all; current: )
|
37
|
+
-L limit verbose output to specific number of lines (10000)
|
38
|
+
|
39
|
+
Currently the script also locates events that are close enough in time to GPS events. We hope to improve this with interpolation in the near future to be more compatible with the results from the commercial solutions. This time-window is also used for some of the extended header information, like LAC and CI, and effectively duplicates those fields from their own events to others. Take this into account when doing statistics on the results. It is better to use the original values, not the duplicates, if you want reliable statistics.
|
40
|
+
|
41
|
+
== csv_stats
|
42
|
+
|
43
|
+
This script reads any CSV file and outputs histograms of the values for each column. These can be manually imported into a spreadsheet or charting program for further analysis or charting.
|
44
|
+
|
45
|
+
== csv_charts
|
46
|
+
|
47
|
+
This script also performs statistics on CSV files but is much more powerful, including automatic output of charts based on columns of data, as well as a configurable system for adding new columns by modifying or merging other columns, as designing specific charts for output.
|
48
|
+
|
49
|
+
Usage: csv_chart <-dhamt> <-S specfile> <-N name> <-D dir> <-T range> <-P diversity> files...
|
50
|
+
-d debug mode
|
51
|
+
-h print this help (true)
|
52
|
+
-a automatically create charts for all properties (true)
|
53
|
+
-m merge all files into single stats
|
54
|
+
-t merge and split by time (days)
|
55
|
+
-N use specified name for merged dataset:
|
56
|
+
-D export charts to specified directory: .
|
57
|
+
-S use chart specification in specified file:
|
58
|
+
-P diversity threshold in percentage for automatic reports: 40.0
|
59
|
+
-T set time-range filter:
|
60
|
+
|
61
|
+
The -S option is especially interesting, since you can control both custom columns and chart output. Consider the following examples:
|
62
|
+
|
63
|
+
# Signal strength in 10dBm category ranges bar chart
|
64
|
+
stats 'Signal Strength', 'RSSI', :div => 10
|
65
|
+
histogram_chart 'Signal.Strength'
|
66
|
+
|
67
|
+
# Multi-column chart for different event types over days of the week
|
68
|
+
stats 'Call Status', 'call.status', :group => :days
|
69
|
+
stats 'Data Status', 'data.status', :group => :days
|
70
|
+
stats 'Events', 'Event', :group => :days
|
71
|
+
category_chart 'Data Status'
|
72
|
+
category_chart 'Events'
|
73
|
+
category_chart 'Call Status'
|
74
|
+
|
75
|
+
# The same stats as before but in line charts
|
76
|
+
line_chart 'Data Status'
|
77
|
+
line_chart 'Events'
|
78
|
+
line_chart 'Call Status'
|
79
|
+
|
80
|
+
# Top-10 charts for very diverse values like LAC-CI
|
81
|
+
stats('URL', 'browser.URL') {|v| v && v.gsub(/%(\w{2})/){|m| $1.to_i(16).chr}[0..50]}
|
82
|
+
stats('Apps', 'runningApps.appName', 'runningApps.state') {|name,state| (state=='STARTED') ? name : nil}
|
83
|
+
histogram_chart 'LAC-CI', :top => 10, :side => true
|
84
|
+
histogram_chart 'Event', :top => 10, :side => true
|
85
|
+
histogram_chart 'URL', :top => 10, :side => true
|
86
|
+
histogram_chart 'Apps', :top => 10, :side => true
|
87
|
+
|
88
|
+
One thing to be careful above with the stats command is that if you do not provide a block, the part of the line in {}, then you also do not need brackets. However, if you provide the block, then you must also use brackets. See the examples above for both cases.
|
89
|
+
|
90
|
+
The contents of the brackets are the options to the command, and the block in {} is a piece of code to be run when converting the input columns to the output columns. If you pass three arguments to the stats command, the first is the new column name, the next two are the columns to use, and these two will be passed as two parameters to the block. Let's look at three examples:
|
33
91
|
|
34
|
-
|
92
|
+
stats 'Data Status', 'data.status'
|
35
93
|
|
36
|
-
|
94
|
+
This simply creates a copy of the column 'data.status' with the new name 'Data Status', so that resulting charts have a nicer title. No block is given, and the identity operator is assumed. This is the same as passing the block {|v| v}.
|
37
95
|
|
38
|
-
|
96
|
+
stats 'Data Status', 'data.status', :group => :days
|
97
|
+
|
98
|
+
The extra option to group results in several columns being made, one for each day for which data was found. This allows for the data to be charted as multiple dataset on the same chart. The default grouping behaviour here is to have each day on the x-axis, and each value as a new dataset.
|
99
|
+
|
100
|
+
stats 'Signal Strength', 'signal.strength', :div => 10
|
101
|
+
|
102
|
+
The div option will cause values within a range of 10 to be merged into a new value with the name of the range. In this case a value like -53 will become -60..-50. This is useful for making bar charts with fewer bars.
|
103
|
+
|
104
|
+
stats('URL', 'browser.URL') {|v| v && v.gsub(/%(\w{2})/){|m| $1.to_i(16).chr}[0..50]}
|
105
|
+
|
106
|
+
This example uses some fancy Ruby code to replace cryptic HTTP URL codes with normal ASCII, so the URL's look better.
|
107
|
+
|
108
|
+
stats('Apps', 'runningApps.appName', 'runningApps.state') {|name,state| (state=='STARTED') ? name : nil}
|
109
|
+
|
110
|
+
This one copies the 'runningApp.appName' column to the 'Apps' column, but only if the 'runningApps.state' column is set to 'STARTED'.
|
39
111
|
|
40
112
|
=== Installation
|
41
113
|
|
@@ -43,14 +115,7 @@ Two options:
|
|
43
115
|
* As a RubyGem: jruby -S gem install geoptima
|
44
116
|
* From source: git clone git@github.com:craigtaverner/geoptima.rb.git
|
45
117
|
|
46
|
-
|
47
|
-
|
48
|
-
.. to be done ..
|
49
|
-
(or see the code in the command-line utilities described below for examples)
|
50
|
-
|
51
|
-
=== Command-line utilities
|
52
|
-
|
53
|
-
The examples directory includes a few sample Ruby scripts for various import/export tasks, as well as some sample Geoptima data to test on. Consider the following run:
|
118
|
+
When installing the ruby gem you get the commands like 'show_geoptima' and 'csv_charts' in the path. However, if you install from source, you instead get them as examples/show_geoptima.rb.
|
54
119
|
|
55
120
|
git clone git@github.com:craigtaverner/geoptima.rb.git
|
56
121
|
cd geoptima.rb/examples
|
@@ -58,6 +123,8 @@ The examples directory includes a few sample Ruby scripts for various import/exp
|
|
58
123
|
|
59
124
|
This should produce a file called 357841036600753.csv containing a CSV version of the Geoptima events for importing into Excel or OpenOffice.Calc for further processing. The number is the IMEI of the phone used, and if you process many JSON files in one go, you will get as many output files as there are phones represented by the data.
|
60
125
|
|
126
|
+
The examples directory also contains a number of sample *.spec files for the csv_chart command.
|
127
|
+
|
61
128
|
=== Contributing
|
62
129
|
|
63
130
|
Have you found a bug, need help or have a patch ?
|
@@ -66,3 +133,4 @@ Just clone geoptima.rb and send me a pull request or email me.
|
|
66
133
|
=== License
|
67
134
|
|
68
135
|
MIT, see the LICENSE file http://github.com/craigtaverner/geoptima.rb/tree/master/LICENSE.
|
136
|
+
|
data/bin/csv_chart
CHANGED
@@ -10,7 +10,7 @@ require 'geoptima/options'
|
|
10
10
|
require 'fileutils'
|
11
11
|
require 'geoptima/daterange'
|
12
12
|
|
13
|
-
Geoptima::assert_version("0.1.
|
13
|
+
Geoptima::assert_version("0.1.1")
|
14
14
|
Geoptima::Chart.available? || puts("No charting libraries available") || exit(-1)
|
15
15
|
|
16
16
|
$export_dir = '.'
|
@@ -38,7 +38,7 @@ $merge_all = true if($time_split)
|
|
38
38
|
$help = true unless($files.length>0)
|
39
39
|
if $help
|
40
40
|
puts <<EOHELP
|
41
|
-
Usage: csv_chart <-
|
41
|
+
Usage: csv_chart <-dhamt> <-S specfile> <-N name> <-D dir> <-T range> <-P diversity> files...
|
42
42
|
-d debug mode #{cw $debug}
|
43
43
|
-h print this help #{cw $help}
|
44
44
|
-a automatically create charts for all properties #{cw $create_all}
|
@@ -208,7 +208,7 @@ module Geoptima
|
|
208
208
|
vals.map!{|v| mk_range(v)}
|
209
209
|
end
|
210
210
|
puts "StatSpec[#{self}]: #{vals.inspect}" if($debug)
|
211
|
-
val = proc.call(*vals)
|
211
|
+
val = proc && proc.call(*vals) || vals[0]
|
212
212
|
puts "StatSpec[#{self}]: #{vals.inspect} --> #{val.inspect}" if($debug)
|
213
213
|
val
|
214
214
|
end
|
@@ -304,7 +304,7 @@ module Geoptima
|
|
304
304
|
chart(header, options.merge(:chart_type => :category))
|
305
305
|
end
|
306
306
|
def histogram_chart(header,options={})
|
307
|
-
chart(header, options.merge(:chart_type => :
|
307
|
+
chart(header, options.merge(:chart_type => :histogram))
|
308
308
|
end
|
309
309
|
def line_chart(header,options={})
|
310
310
|
chart(header, options.merge(:chart_type => :line))
|
data/bin/show_geoptima
CHANGED
@@ -7,7 +7,7 @@ $: << '../lib'
|
|
7
7
|
require 'date'
|
8
8
|
require 'geoptima'
|
9
9
|
|
10
|
-
Geoptima::assert_version("0.1.
|
10
|
+
Geoptima::assert_version("0.1.1")
|
11
11
|
|
12
12
|
$debug=false
|
13
13
|
|
@@ -39,8 +39,6 @@ while arg=ARGV.shift do
|
|
39
39
|
$combine_all=true
|
40
40
|
when 'l'
|
41
41
|
$more_headers=true
|
42
|
-
when 'C'
|
43
|
-
$chart_spec = ARGV.shift
|
44
42
|
when 'E'
|
45
43
|
$event_names += ARGV.shift.split(/[\,\;\:\.]+/)
|
46
44
|
when 'T'
|
@@ -66,7 +64,7 @@ end
|
|
66
64
|
$help = true if($files.length < 1)
|
67
65
|
if $help
|
68
66
|
puts <<EOHELP
|
69
|
-
Usage:
|
67
|
+
Usage: show_geoptima <-dpvxomlsah> <-L limit> <-E types> <-T min,max> file <files>
|
70
68
|
-d debug mode (output more context during processing) #{cw $debug}
|
71
69
|
-p print mode (print out final results to console) #{cw $print}
|
72
70
|
-v verbose mode (output extra information to console) #{cw $verbose}
|
@@ -77,7 +75,6 @@ Usage: ./showGeoptimaEvents.rb <-dvxEh> <-L limit> <-E types> <-T min,max> file
|
|
77
75
|
-s seperate the export files by event type #{cw $seperate}
|
78
76
|
-a combine all IMEI's into a single dataset #{cw $combine_all}
|
79
77
|
-h show this help
|
80
|
-
-C use specified chart specification file for stats and charts: #{$chart_spec}
|
81
78
|
-E comma-seperated list of event types to show and export (default: all; current: #{$event_names.join(',')})
|
82
79
|
-T time range to limit results to (default: all; current: #{$time_range})
|
83
80
|
-L limit verbose output to specific number of lines #{cw $print_limit}
|
data/examples/csv_chart.rb
CHANGED
@@ -10,7 +10,7 @@ require 'geoptima/options'
|
|
10
10
|
require 'fileutils'
|
11
11
|
require 'geoptima/daterange'
|
12
12
|
|
13
|
-
Geoptima::assert_version("0.1.
|
13
|
+
Geoptima::assert_version("0.1.1")
|
14
14
|
Geoptima::Chart.available? || puts("No charting libraries available") || exit(-1)
|
15
15
|
|
16
16
|
$export_dir = '.'
|
@@ -38,7 +38,7 @@ $merge_all = true if($time_split)
|
|
38
38
|
$help = true unless($files.length>0)
|
39
39
|
if $help
|
40
40
|
puts <<EOHELP
|
41
|
-
Usage: csv_chart <-
|
41
|
+
Usage: csv_chart <-dhamt> <-S specfile> <-N name> <-D dir> <-T range> <-P diversity> files...
|
42
42
|
-d debug mode #{cw $debug}
|
43
43
|
-h print this help #{cw $help}
|
44
44
|
-a automatically create charts for all properties #{cw $create_all}
|
@@ -208,7 +208,7 @@ module Geoptima
|
|
208
208
|
vals.map!{|v| mk_range(v)}
|
209
209
|
end
|
210
210
|
puts "StatSpec[#{self}]: #{vals.inspect}" if($debug)
|
211
|
-
val = proc.call(*vals)
|
211
|
+
val = proc && proc.call(*vals) || vals[0]
|
212
212
|
puts "StatSpec[#{self}]: #{vals.inspect} --> #{val.inspect}" if($debug)
|
213
213
|
val
|
214
214
|
end
|
@@ -304,7 +304,7 @@ module Geoptima
|
|
304
304
|
chart(header, options.merge(:chart_type => :category))
|
305
305
|
end
|
306
306
|
def histogram_chart(header,options={})
|
307
|
-
chart(header, options.merge(:chart_type => :
|
307
|
+
chart(header, options.merge(:chart_type => :histogram))
|
308
308
|
end
|
309
309
|
def line_chart(header,options={})
|
310
310
|
chart(header, options.merge(:chart_type => :line))
|
data/examples/show_geoptima.rb
CHANGED
@@ -7,7 +7,7 @@ $: << '../lib'
|
|
7
7
|
require 'date'
|
8
8
|
require 'geoptima'
|
9
9
|
|
10
|
-
Geoptima::assert_version("0.1.
|
10
|
+
Geoptima::assert_version("0.1.1")
|
11
11
|
|
12
12
|
$debug=false
|
13
13
|
|
@@ -39,8 +39,6 @@ while arg=ARGV.shift do
|
|
39
39
|
$combine_all=true
|
40
40
|
when 'l'
|
41
41
|
$more_headers=true
|
42
|
-
when 'C'
|
43
|
-
$chart_spec = ARGV.shift
|
44
42
|
when 'E'
|
45
43
|
$event_names += ARGV.shift.split(/[\,\;\:\.]+/)
|
46
44
|
when 'T'
|
@@ -66,7 +64,7 @@ end
|
|
66
64
|
$help = true if($files.length < 1)
|
67
65
|
if $help
|
68
66
|
puts <<EOHELP
|
69
|
-
Usage:
|
67
|
+
Usage: show_geoptima <-dpvxomlsah> <-L limit> <-E types> <-T min,max> file <files>
|
70
68
|
-d debug mode (output more context during processing) #{cw $debug}
|
71
69
|
-p print mode (print out final results to console) #{cw $print}
|
72
70
|
-v verbose mode (output extra information to console) #{cw $verbose}
|
@@ -77,7 +75,6 @@ Usage: ./showGeoptimaEvents.rb <-dvxEh> <-L limit> <-E types> <-T min,max> file
|
|
77
75
|
-s seperate the export files by event type #{cw $seperate}
|
78
76
|
-a combine all IMEI's into a single dataset #{cw $combine_all}
|
79
77
|
-h show this help
|
80
|
-
-C use specified chart specification file for stats and charts: #{$chart_spec}
|
81
78
|
-E comma-seperated list of event types to show and export (default: all; current: #{$event_names.join(',')})
|
82
79
|
-T time range to limit results to (default: all; current: #{$time_range})
|
83
80
|
-L limit verbose output to specific number of lines #{cw $print_limit}
|
data/lib/geoptima/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoptima
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Craig Taverner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: multi_json
|