embulk-input-lkqd 0.1.0 → 0.2.0
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 +4 -4
- data/embulk-input-lkqd.gemspec +1 -1
- data/lib/embulk/input/lkqd.rb +103 -82
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01f73feb965f432aad6c52c7fa9ee749c272853f
|
4
|
+
data.tar.gz: a41458a6593cdc5c9b773bc913c45c17382fed00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312dbc836979c4fcabf9966826fcb63032ae4a14689ce93e9ad9847ccb21210a0d12ee0d719c369a6796c91e1a97833b3cf23d388fcd555b788cb901777d8765
|
7
|
+
data.tar.gz: 4dcdda5ef3bfe6464d3c46fcbd85a0831d9ecc58b357bf34178bbc8a7eb76e8d55d4db66209bfea5f5e9e44139a1713cda54fc075bd865ebc97e69f00a1f9eab
|
data/embulk-input-lkqd.gemspec
CHANGED
data/lib/embulk/input/lkqd.rb
CHANGED
@@ -53,19 +53,40 @@ module Embulk
|
|
53
53
|
column_name.gsub!(/^\W/, '')
|
54
54
|
column_option = DEFAULT_COLUMNS[column_name]
|
55
55
|
if column_option
|
56
|
-
return {type: column_option['
|
56
|
+
return {type: column_option['type'].to_sym, name: column_name, format: column_option['format']}
|
57
57
|
else
|
58
58
|
return {type: :string, name: column_name}
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
def self.try_convert(row)
|
63
|
+
return row.map do |field|
|
64
|
+
name, value = field
|
65
|
+
column_name = name.gsub(/^\W/, '')
|
66
|
+
column_option = DEFAULT_COLUMNS[column_name]
|
67
|
+
if column_option.nil?
|
68
|
+
next value
|
69
|
+
elsif column_option['type'] == 'timestamp'
|
70
|
+
next Time.strptime(value, column_option['format']).to_i
|
71
|
+
elsif column_option['type'] == 'long'
|
72
|
+
next value.gsub(',','').to_i
|
73
|
+
elsif column_option['type'] == 'double' && value.match(/%$/)
|
74
|
+
next value.gsub(',','').to_f / 100.0
|
75
|
+
elsif column_option['type'] == 'double'
|
76
|
+
next value.gsub(',','').to_f
|
77
|
+
else
|
78
|
+
next value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
62
83
|
def init
|
63
84
|
@task = task
|
64
85
|
end
|
65
86
|
|
66
87
|
def run
|
67
88
|
CSV.foreach(@task['tempfile_path'], {headers: true}).each do |row|
|
68
|
-
page_builder.add(row)
|
89
|
+
page_builder.add(Lkqd.try_convert(row))
|
69
90
|
end
|
70
91
|
page_builder.finish
|
71
92
|
|
@@ -75,89 +96,89 @@ module Embulk
|
|
75
96
|
|
76
97
|
DEFAULT_COLUMNS = {
|
77
98
|
# dimensions' columns
|
78
|
-
'Time'=> { '
|
79
|
-
'Account'=> { '
|
80
|
-
'Supply Source ID'=> { '
|
81
|
-
'Supply Source'=> { '
|
82
|
-
'Supply Partner'=> { '
|
83
|
-
'Environment'=> { '
|
84
|
-
'Domain'=> { '
|
85
|
-
'App Name'=> { '
|
86
|
-
'Bundle ID'=> { '
|
87
|
-
'Supply Tag Type'=> { '
|
88
|
-
'Demand Partner'=> { '
|
89
|
-
'Demand Deal ID' => { '
|
90
|
-
'Demand Deal'=> { '
|
91
|
-
'Demand Tag'=> { '
|
92
|
-
'Format'=> { '
|
93
|
-
'Country'=> { '
|
94
|
-
'Device Type'=> { '
|
95
|
-
'OS'=> { '
|
96
|
-
'Width X Height'=> { '
|
99
|
+
'Time'=> { 'type' => 'timestamp', 'format' => "%Y-%m-%dT%H" },
|
100
|
+
'Account'=> { 'type' => 'string' },
|
101
|
+
'Supply Source ID'=> { 'type' => 'string' },
|
102
|
+
'Supply Source'=> { 'type' => 'string' },
|
103
|
+
'Supply Partner'=> { 'type' => 'string' },
|
104
|
+
'Environment'=> { 'type' => 'string' },
|
105
|
+
'Domain'=> { 'type' => 'string' },
|
106
|
+
'App Name'=> { 'type' => 'string' },
|
107
|
+
'Bundle ID'=> { 'type' => 'string' },
|
108
|
+
'Supply Tag Type'=> { 'type' => 'string' },
|
109
|
+
'Demand Partner'=> { 'type' => 'string' },
|
110
|
+
'Demand Deal ID' => { 'type' => 'string' },
|
111
|
+
'Demand Deal'=> { 'type' => 'string' },
|
112
|
+
'Demand Tag'=> { 'type' => 'string' },
|
113
|
+
'Format'=> { 'type' => 'string' },
|
114
|
+
'Country'=> { 'type' => 'string' },
|
115
|
+
'Device Type'=> { 'type' => 'string' },
|
116
|
+
'OS'=> { 'type' => 'string' },
|
117
|
+
'Width X Height'=> { 'type' => 'string' },
|
97
118
|
# "Opportunity report" columns
|
98
|
-
'Tag Loads' => { '
|
99
|
-
'Opportunities' => { '
|
100
|
-
'Format Loads' => { '
|
101
|
-
'Format Fill Rate' => { '
|
102
|
-
'Ineligible Ops: Demand' => { '
|
103
|
-
'Ineligible Ops: Restrictions' => { '
|
104
|
-
'Impressions' => { '
|
105
|
-
'Fill Rate' => { '
|
106
|
-
'Efficiency Rate' => { '
|
107
|
-
'CPM' => { '
|
108
|
-
'Revenue' => { '
|
109
|
-
'Cost' => { '
|
110
|
-
'Profit' => { '
|
111
|
-
'Profit Margin' => { '
|
112
|
-
'Clicks' => { '
|
113
|
-
'CTR' => { '
|
114
|
-
'25% Views' => { '
|
115
|
-
'50% Views' => { '
|
116
|
-
'75% Views' => { '
|
117
|
-
'100% Views' => { '
|
118
|
-
'25% View Rate' => { '
|
119
|
-
'50% View Rate' => { '
|
120
|
-
'75% View Rate' => { '
|
121
|
-
'100% View Rate' => { '
|
122
|
-
'Viewability Measured Rate' => { '
|
123
|
-
'Viewability Rate' => { '
|
119
|
+
'Tag Loads' => { 'type' => 'long' },
|
120
|
+
'Opportunities' => { 'type' => 'long' },
|
121
|
+
'Format Loads' => { 'type' => 'long' },
|
122
|
+
'Format Fill Rate' => { 'type' => 'double' },
|
123
|
+
'Ineligible Ops: Demand' => { 'type' => 'long' },
|
124
|
+
'Ineligible Ops: Restrictions' => { 'type' => 'long' },
|
125
|
+
'Impressions' => { 'type' => 'long' },
|
126
|
+
'Fill Rate' => { 'type' => 'double' },
|
127
|
+
'Efficiency Rate' => { 'type' => 'double' },
|
128
|
+
'CPM' => { 'type' => 'double' },
|
129
|
+
'Revenue' => { 'type' => 'double' },
|
130
|
+
'Cost' => { 'type' => 'double' },
|
131
|
+
'Profit' => { 'type' => 'double' },
|
132
|
+
'Profit Margin' => { 'type' => 'double' },
|
133
|
+
'Clicks' => { 'type' => 'long' },
|
134
|
+
'CTR' => { 'type' => 'double' },
|
135
|
+
'25% Views' => { 'type' => 'long' },
|
136
|
+
'50% Views' => { 'type' => 'long' },
|
137
|
+
'75% Views' => { 'type' => 'long' },
|
138
|
+
'100% Views' => { 'type' => 'long' },
|
139
|
+
'25% View Rate' => { 'type' => 'double' },
|
140
|
+
'50% View Rate' => { 'type' => 'double' },
|
141
|
+
'75% View Rate' => { 'type' => 'double' },
|
142
|
+
'100% View Rate' => { 'type' => 'double' },
|
143
|
+
'Viewability Measured Rate' => { 'type' => 'double' },
|
144
|
+
'Viewability Rate' => { 'type' => 'double' },
|
124
145
|
# "Request report" columns
|
125
|
-
'Tag Requests' => { '
|
126
|
-
'Ads' => { '
|
127
|
-
'VAST Ads' => { '
|
128
|
-
'VPAID Ads' => { '
|
129
|
-
'Wins' => { '
|
130
|
-
'Ad Rate' => { '
|
131
|
-
'VAST Ad Rate' => { '
|
132
|
-
'VPAID Ad Rate' => { '
|
133
|
-
'Win Rate' => { '
|
134
|
-
'VPAID Responses' => { '
|
135
|
-
'VPAID Attempts' => { '
|
136
|
-
'VPAID Successes' => { '
|
137
|
-
'VPAID Opt Outs' => { '
|
138
|
-
'VPAID Timeouts' => { '
|
139
|
-
'VPAID Errors' => { '
|
140
|
-
'VPAID Success Rate' => { '
|
141
|
-
'VPAID Opt Out Rate' => { '
|
142
|
-
'VPAID Timeout Rate' => { '
|
143
|
-
'VPAID Error Rate' => { '
|
144
|
-
'Tag Timeouts' => { '
|
145
|
-
'Tag Timeout Rate' => { '
|
146
|
-
'Tag Errors' => { '
|
147
|
-
'Tag Error Rate' => { '
|
148
|
-
'Playback Errors' => { '
|
149
|
-
'Playback Error Rate' => { '
|
146
|
+
'Tag Requests' => { 'type' => 'long' },
|
147
|
+
'Ads' => { 'type' => 'long' },
|
148
|
+
'VAST Ads' => { 'type' => 'long' },
|
149
|
+
'VPAID Ads' => { 'type' => 'long' },
|
150
|
+
'Wins' => { 'type' => 'long' },
|
151
|
+
'Ad Rate' => { 'type' => 'double' },
|
152
|
+
'VAST Ad Rate' => { 'type' => 'double' },
|
153
|
+
'VPAID Ad Rate' => { 'type' => 'double' },
|
154
|
+
'Win Rate' => { 'type' => 'double' },
|
155
|
+
'VPAID Responses' => { 'type' => 'long' },
|
156
|
+
'VPAID Attempts' => { 'type' => 'long' },
|
157
|
+
'VPAID Successes' => { 'type' => 'long' },
|
158
|
+
'VPAID Opt Outs' => { 'type' => 'long' },
|
159
|
+
'VPAID Timeouts' => { 'type' => 'long' },
|
160
|
+
'VPAID Errors' => { 'type' => 'long' },
|
161
|
+
'VPAID Success Rate' => { 'type' => 'double' },
|
162
|
+
'VPAID Opt Out Rate' => { 'type' => 'double' },
|
163
|
+
'VPAID Timeout Rate' => { 'type' => 'double' },
|
164
|
+
'VPAID Error Rate' => { 'type' => 'double' },
|
165
|
+
'Tag Timeouts' => { 'type' => 'long' },
|
166
|
+
'Tag Timeout Rate' => { 'type' => 'double' },
|
167
|
+
'Tag Errors' => { 'type' => 'long' },
|
168
|
+
'Tag Error Rate' => { 'type' => 'long' },
|
169
|
+
'Playback Errors' => { 'type' => 'long' },
|
170
|
+
'Playback Error Rate' => { 'type' => 'double' },
|
150
171
|
# custom data columns
|
151
|
-
'Custom 1'=> { '
|
152
|
-
'Custom 2'=> { '
|
153
|
-
'Custom 3'=> { '
|
154
|
-
'Custom 4'=> { '
|
155
|
-
'Custom 5'=> { '
|
156
|
-
'Custom 6'=> { '
|
157
|
-
'Custom 7'=> { '
|
158
|
-
'Custom 8'=> { '
|
159
|
-
'Custom 9'=> { '
|
160
|
-
'Custom 10'=> { '
|
172
|
+
'Custom 1'=> { 'type' => 'string' },
|
173
|
+
'Custom 2'=> { 'type' => 'string' },
|
174
|
+
'Custom 3'=> { 'type' => 'string' },
|
175
|
+
'Custom 4'=> { 'type' => 'string' },
|
176
|
+
'Custom 5'=> { 'type' => 'string' },
|
177
|
+
'Custom 6'=> { 'type' => 'string' },
|
178
|
+
'Custom 7'=> { 'type' => 'string' },
|
179
|
+
'Custom 8'=> { 'type' => 'string' },
|
180
|
+
'Custom 9'=> { 'type' => 'string' },
|
181
|
+
'Custom 10'=> { 'type' => 'string' },
|
161
182
|
}.freeze
|
162
183
|
end
|
163
184
|
|
metadata
CHANGED
@@ -1,66 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-lkqd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ming Liu
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: 2.2.2
|
19
|
-
name: http
|
20
|
-
prerelease: false
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.2.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: embulk
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - '='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 0.8.28
|
33
|
-
name: embulk
|
34
|
-
prerelease: false
|
35
34
|
type: :development
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.28
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: 1.10.6
|
47
|
-
name: bundler
|
48
|
-
prerelease: false
|
49
48
|
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.10.6
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '10.0'
|
61
|
-
name: rake
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
@@ -85,7 +85,7 @@ homepage: https://github.com/liuming/embulk-input-lkqd
|
|
85
85
|
licenses:
|
86
86
|
- MIT
|
87
87
|
metadata: {}
|
88
|
-
post_install_message:
|
88
|
+
post_install_message:
|
89
89
|
rdoc_options: []
|
90
90
|
require_paths:
|
91
91
|
- lib
|
@@ -100,9 +100,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubyforge_project:
|
103
|
+
rubyforge_project:
|
104
104
|
rubygems_version: 2.6.8
|
105
|
-
signing_key:
|
105
|
+
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: LKQD input plugin for Embulk
|
108
108
|
test_files: []
|