log_analysis 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3c9b681df09452e7ea3b95bb5e1743fe830d8ff77e98e13773f3a37619365ae
4
- data.tar.gz: 9777f2caae80ad629032042eda15c6affc72e422bc5375ff18e7b3a2922073cf
3
+ metadata.gz: f63a6053850f8364bfa54b513bb100c2d12352772ec59c7f7031752b54105856
4
+ data.tar.gz: aab9770c4db131b7edbc876d23d25fea5b5f60d5fb5c3ccec5e326c476ae5a49
5
5
  SHA512:
6
- metadata.gz: 9a770ae6e3c711ef6350e99471b5780b66ccf540fbb16eeab3e4e235683ffa4a9171996d375793d34c53e870367866a2a06aa184c065ade96991d93485e37e40
7
- data.tar.gz: cfc8741425589c3d41dc7dffcdd4ee880467dffe2425f6e4ad0358a5f12dfac7ef924b62e4828d4e8056e4b5176e9b03a8b1258350a15fb1d04772739eb2adf1
6
+ metadata.gz: ca85c721af6999332ce3cf2adbab6d48ad89c54733a97881851e023ba254aedbcfe8a2d7cb2f246a599b7db6a0cfbabd056f200a27468d3b764d563065ee9d39
7
+ data.tar.gz: baa3db4cb9b51ad88edf7a85577b4cb709e0d363b609be22d3b947efffed98b5f263f0c98ff8ef32f555349e95c7b134cd94bb0d2be335c839c32c3b4cea920e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_analysis (0.1.5)
4
+ log_analysis (0.1.6)
5
5
  activesupport (~> 6.0.3.1)
6
6
  useragent (~> 0.16.10)
7
7
 
@@ -26,23 +26,29 @@ class LogAnalysis
26
26
  end
27
27
 
28
28
  def preprocessing_data
29
- filter = selecting_data.select { |record| record.status_200? && record.method_get? && record.uri_without_data && !record.robot? }
29
+ data = selecting_data
30
+ return if data.nil? || data.empty?
31
+
32
+ filter = data.select { |record| record.status_200? && record.method_get? && record.uri_without_data && !record.robot? }
30
33
  user = UserIdentification.execute(filter)
31
34
  session = SessionIdentification.execute(user)
32
35
  session
33
36
  end
34
37
 
35
38
  def transformation
36
- Transformation.execute(preprocessing_data)
39
+ data = preprocessing_data
40
+ Transformation.execute(data) unless data.nil? || data.empty?
37
41
  end
38
42
 
39
43
  def data_mining
44
+ data = transformation
40
45
  @conf ||= 0.5
41
46
  @sup ||= 60
42
- DataMining.execute(transformation, @conf, @sup)
47
+ DataMining.execute(data, @conf, @sup) unless data.nil? || data.empty?
43
48
  end
44
49
 
45
50
  def intepretation
46
- Intepretation.execute(data_mining)
51
+ data = data_mining
52
+ Intepretation.execute(data) unless data.nil? || data.empty?
47
53
  end
48
54
  end
@@ -9,8 +9,8 @@ module SessionIdentification
9
9
 
10
10
  def self.execute(identified_user)
11
11
  identified_user.each_with_object([]) do |user, arr|
12
+ isession = arr.rindex { |s| s.user == user }
12
13
  user.records.each do |record|
13
- isession = arr.rindex { |s| s.user == user }
14
14
  isession.present? && validate_time_session(arr[isession].records.last.time, record.time) ? arr[isession].records << record : arr << SessionIdentity.new(session_identity_params(record))
15
15
  end
16
16
  end
@@ -7,7 +7,7 @@ module Transformation
7
7
  # Your code goes here...
8
8
 
9
9
  def self.execute(identified_session)
10
- map_uri = []
10
+ map_uri = ['-']
11
11
  transform = identified_session.each_with_object({}) do |v, hash|
12
12
  uries = v.records.map(&:uri)
13
13
  uries.each { |i| map_uri.push(i) unless map_uri.include?(i) }
@@ -1,5 +1,5 @@
1
1
  class LogAnalysis
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  TRANSFORM_DATA_PATH = "transform_data_#{Time.now.strftime('%Y%m%d')}.txt".freeze
4
4
  RULE_FILE_PATH = "output_#{Time.now.strftime('%Y%m%d')}.txt".freeze
5
5
  MAP_URI_FILE_PATH = "map_uri_#{Time.now.strftime('%Y%m%d')}.txt".freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_analysis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Tran
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-18 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: useragent