Class: LogAnalysis

Inherits:
Object
  • Object
show all
Defined in:
lib/log_analysis.rb,
lib/log_analysis/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
'0.1.5'.freeze
TRANSFORM_DATA_PATH =
"transform_data_#{Time.now.strftime('%Y%m%d')}.txt".freeze
RULE_FILE_PATH =
"output_#{Time.now.strftime('%Y%m%d')}.txt".freeze
MAP_URI_FILE_PATH =
"map_uri_#{Time.now.strftime('%Y%m%d')}.txt".freeze
JAR_FILE_PATH =
File.join(File.dirname(__FILE__), './files/spmf.jar')
DATA_PATH =
File.expand_path('data/log_analysis', '~')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, type = nil) ⇒ LogAnalysis

Returns a new instance of LogAnalysis.



16
17
18
19
20
# File 'lib/log_analysis.rb', line 16

def initialize(path, type = nil)
  @path         = path
  @type         = type
  @origin_data  = LoadingData.input(path, type)
end

Instance Attribute Details

#confObject

Your code goes here…



14
15
16
# File 'lib/log_analysis.rb', line 14

def conf
  @conf
end

#match_uriObject

Your code goes here…



14
15
16
# File 'lib/log_analysis.rb', line 14

def match_uri
  @match_uri
end

#origin_dataObject

Your code goes here…



14
15
16
# File 'lib/log_analysis.rb', line 14

def origin_data
  @origin_data
end

#pathObject

Your code goes here…



14
15
16
# File 'lib/log_analysis.rb', line 14

def path
  @path
end

#supObject

Your code goes here…



14
15
16
# File 'lib/log_analysis.rb', line 14

def sup
  @sup
end

#typeObject

Your code goes here…



14
15
16
# File 'lib/log_analysis.rb', line 14

def type
  @type
end

Instance Method Details

#data_miningObject



39
40
41
42
43
# File 'lib/log_analysis.rb', line 39

def data_mining
  @conf ||= 0.5
  @sup  ||= 60
  DataMining.execute(transformation, @conf, @sup)
end

#intepretationObject



45
46
47
# File 'lib/log_analysis.rb', line 45

def intepretation
  Intepretation.execute(data_mining)
end

#preprocessing_dataObject



28
29
30
31
32
33
# File 'lib/log_analysis.rb', line 28

def preprocessing_data
  filter  = selecting_data.select { |record| record.status_200? && record.method_get? && record.uri_without_data && !record.robot? }
  user    = UserIdentification.execute(filter)
  session = SessionIdentification.execute(user)
  session
end

#selecting_dataObject



22
23
24
25
26
# File 'lib/log_analysis.rb', line 22

def selecting_data
  return @origin_data if @match_uri.nil?

  @origin_data.select { |record| record.uri.match?(@match_uri) }
end

#transformationObject



35
36
37
# File 'lib/log_analysis.rb', line 35

def transformation
  Transformation.execute(preprocessing_data)
end