productPredictionWMS 0.0.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.
- checksums.yaml +7 -0
- data/lib/productPrediction.rb +61 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4a10451cda267744a828f2084e90c9f3fa9289242631bf4b9c3ecce09ce9cbf6
|
|
4
|
+
data.tar.gz: 147e6c285712fe2ec303663bdc50c4d7de57c3b01c84b6cb19222fd654721aff
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8859c2f03733d6131a1b869033439d631b872f56d6d17bfbf58841bc9a544a2ad1f6d97429440e20ff60df2b73ea4ff69a163ebe8083b936707a6a4da0229ef4
|
|
7
|
+
data.tar.gz: ef6ba83605a2c96e3f132523fca47e73aee76fc89ed9d472b5a6faa4d88e3baf1b5cef8c2bf4b7031f7520bf58dddc8cc9519d99af61aac30cc42bcaa374dc42
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
class ProductPrediction
|
|
2
|
+
|
|
3
|
+
def self.getPrediction(product)
|
|
4
|
+
puts "product_city:"+product.to_s
|
|
5
|
+
city = getTopSellingCity(product)
|
|
6
|
+
zipCount = getTopSellingZip(product, city)
|
|
7
|
+
getTopPredictions(city, zipCount)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.getTopSellingCity(product)
|
|
11
|
+
counter = Hash.new
|
|
12
|
+
counter["Dublin"]= 0
|
|
13
|
+
counter["Cork"]= 0
|
|
14
|
+
counter["Galway"]= 0
|
|
15
|
+
counter["Limric"]= 0
|
|
16
|
+
product.each do |city|
|
|
17
|
+
city.each_with_index do |item, index|
|
|
18
|
+
if index ==0 && item == "Dublin"
|
|
19
|
+
counter["Dublin"] += 1
|
|
20
|
+
elsif index ==0 && item == "Cork"
|
|
21
|
+
counter["Cork"] += 1
|
|
22
|
+
elsif index ==0 && item == "Galway"
|
|
23
|
+
counter["Galway"] += 1
|
|
24
|
+
elsif index ==0 && item == "Limric"
|
|
25
|
+
counter["Limric"] += 1
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
city = counter.max_by{|k,v| v}[0]
|
|
30
|
+
return city
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.getTopSellingZip(product, test1)
|
|
34
|
+
counterFinal = Hash.new
|
|
35
|
+
counterFinal["1"]= 0
|
|
36
|
+
counterFinal["2"]= 0
|
|
37
|
+
counterFinal["3"]= 0
|
|
38
|
+
counterFinal["4"]= 0
|
|
39
|
+
counterFinal["5"]= 0
|
|
40
|
+
product.each_with_index do |city, city_index|
|
|
41
|
+
if city[0] == test1 && city[1] == "1"
|
|
42
|
+
counterFinal["1"] += 1
|
|
43
|
+
elsif city[0] == test1 && city[1] == "2"
|
|
44
|
+
counterFinal["2"] += 1
|
|
45
|
+
elsif city[0] == test1 && city[1] == "3"
|
|
46
|
+
counterFinal["3"] += 1
|
|
47
|
+
elsif city[0] == test1 && city[1] == "4"
|
|
48
|
+
counterFinal["4"] += 1
|
|
49
|
+
elsif city[0] == test1 && city[1] == "5"
|
|
50
|
+
counterFinal["5"] += 1
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
return counterFinal
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.getTopPredictions(city, zipCounter)
|
|
57
|
+
output = []
|
|
58
|
+
output.push(city, zipCounter.sort_by { |k, v| v }.reverse[0..2])
|
|
59
|
+
return output
|
|
60
|
+
end
|
|
61
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: productPredictionWMS
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- X17156220
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: prediction system for sale of the product
|
|
14
|
+
email: X17156220@student.ncirl.ie
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/productPrediction.rb
|
|
20
|
+
homepage: http://rubygems.org/gems/productPredictionWMS
|
|
21
|
+
licenses:
|
|
22
|
+
- Nonstandard
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.7.3
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: This predicts the sale of the product
|
|
44
|
+
test_files: []
|