transaction_faker 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 022b535552c112c5fe4e4a3f7677f61834d76b88
4
+ data.tar.gz: f610307a0a379e831947eb98577b172576e36a71
5
+ SHA512:
6
+ metadata.gz: a8221e65a7232a1ba1a47204a3d83d75db765cfab5cd3926dd119f8be1c3e75a1ce8f99d9466a8372e353ed4ddb1991fa9a7a2c03a6f4bbece52773abc48e436
7
+ data.tar.gz: 26e52557d4c3fa6faa09e25cadb1715e56438148288b77abf597be71f363fd0e22e289602ddbc4c148e4d92781d752959c5a4040d4219501c548c0c9da137dda
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in transaction_faker.gemspec
4
+ gemspec
@@ -0,0 +1,167 @@
1
+ # TransactionFaker
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'transaction_faker'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install transaction_faker
18
+
19
+ ## Usage
20
+
21
+ We created categories that can model a person’s spending patterns, and they are populated with a few of Plaid’s categories to create the transactions. Here are our categories:
22
+
23
+
24
+
25
+ <b>NIGHTLIFE</b>
26
+ Food and Drink > Bar
27
+ Food and Drink > Nightlife > Night Clubs
28
+ Shops > Food and Beverage Store > Beer, Wine and Spirits
29
+
30
+ <b>EAT_OUT</b>
31
+ Food and Drink > Restaurants > Steakhouses
32
+ Food and Drink > Restaurants > Mexican
33
+ Food and Drink > Restaurants > Japanese
34
+ Food and Drink > Restaurants > Latin American
35
+ Food and Drink > Restaurants > Coffee Shop
36
+
37
+ <b>ENTERTAINMENT</b>
38
+ Recreation > Arts and Entertainment > Movie Theatres
39
+ Recreation > Arts and Entertainment > Sports Venues
40
+ Recreation > Arts and Entertainment > Entertainment
41
+
42
+ <b>RECREATION</b>
43
+ Recreation > Gyms and Fitness Centers
44
+ Recreation > Hunting and Fishing
45
+ Recreation > Batting Cages
46
+
47
+ <b>UTILITIES</b>
48
+ Service > Cable
49
+ Service > Telecommunication Services
50
+ Service > Internet Services
51
+ Service > Utilities > Water
52
+ Service > Utilities > Heating, Ventilating, and Air Conditioning
53
+ Service > Utilities > Gas
54
+ Service > Utilities > Electric
55
+
56
+ <b>HOUSE_SERVICES</b>
57
+ Service > Home Improvement > Plumbing
58
+ Service > Cleaning
59
+ Service > Real Estate > Apartments, Condos and Houses
60
+
61
+ <b>RENT</b>
62
+ Payment > Rent
63
+
64
+ <b>DEFAULT_EXPENSES</b>
65
+ Service > Financial > Taxes
66
+ Service > Financial > ATMs
67
+ Bank Fees > ATM
68
+
69
+ <b>PERSONAL_CARE</b>
70
+ Service > Personal Care > Hair Salons and Barbers
71
+ Healthcare > Healthcare Services > Dentists
72
+ Shops > Pharmacies
73
+
74
+ <b>GROCERIES</b>
75
+ Shops > Food and Beverage Store > Health Food
76
+ Shops > Food and Beverage Store > Farmers Markets
77
+
78
+ <b>SHOPPING</b>
79
+ Shops > Outlet > Women's Store
80
+
81
+ <b>RIDE_SHARING</b>
82
+ Travel > Car Service > Ride Share
83
+
84
+ <b>DAILY_COMMUTE</b>
85
+ Travel > Public Transportation Services
86
+
87
+ <b>INCOME</b>
88
+ Tax > Refund
89
+ Transfer > Deposit
90
+
91
+ <b>PAYROLL</b>
92
+ Transfer > Payroll
93
+
94
+
95
+
96
+ Create a hash where keys are the categories you want to include, and the values are a hash containing the mean, standard deviation, and monthly frequency of the transaction you want to create. Choose an "available balance" and a "current balance" for the fake user, and then initialize it by passing in these two numbers and the transaction hash to its initializer. Example:
97
+
98
+ transaction_hash = {
99
+ "NIGHTLIFE" => {
100
+ mean: 23, std_dev: 5, monthly_freq: 7
101
+ },
102
+ "EAT_OUT" => {
103
+ mean: 16, std_dev: 8, monthly_freq: 13
104
+ },
105
+ "ENTERTAINMENT" => {
106
+ mean: 40, std_dev: 25, monthly_freq: 2
107
+ },
108
+ "RECREATION" => {
109
+ mean: 40, std_dev: 5, monthly_freq: 2
110
+ },
111
+ "UTILITIES" => {
112
+ mean: 60, std_dev: 10, monthly_freq: 6
113
+ },
114
+ "HOUSE_SERVICES" => {
115
+ mean: 50, std_dev: 10, monthly_freq: 2
116
+ },
117
+ "RENT" => {
118
+ mean: 2000, std_dev: 0, monthly_freq: 1
119
+ },
120
+ "DEFAULT_EXPENSES" => {
121
+ mean: 180, std_dev: 30, monthly_freq: 2
122
+ },
123
+ "PERSONAL_CARE" => {
124
+ mean: 40, std_dev: 10, monthly_freq: 2
125
+ },
126
+ "GROCERIES" => {
127
+ mean: 40, std_dev: 15, monthly_freq: 4
128
+ },
129
+ "SHOPPING" => {
130
+ mean: 60, std_dev: 30, monthly_freq: 3
131
+ },
132
+ "RIDE_SHARING" => {
133
+ mean: 8, std_dev: 3, monthly_freq: 8
134
+ }
135
+ "PUBLIC_TRANSPORT" => {
136
+ mean: 130, std_dev: 0, monthly_freq: 1
137
+ },
138
+ "INCOME" => {
139
+ mean: -500, std_dev: 100, monthly_freq: 1
140
+ },
141
+ "PAYROLL" => {
142
+ mean: -2000, std_dev: 0, monthly_freq: 2
143
+ }
144
+ }
145
+
146
+
147
+ user = User.new(1100, 1200, transaction_hash)
148
+
149
+ Once you have the user object created, you can call the "to_json" method to return the user’s account and transactions in JSON form.
150
+
151
+ json_format = user.to_json
152
+
153
+ If you need to recreate the same user and transactions from a previous iteration, pass in the seed number as a 4th argument to the user's initializer, so that 'srand()' will be called with the provided seed.
154
+
155
+ user = User.new(1100, 1200, transaction_hash, 1234)
156
+
157
+ ## Development
158
+
159
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
160
+
161
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
162
+
163
+ ## Contributing
164
+
165
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/transaction_faker.
166
+
167
+ # transaction-faker
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "transaction_faker"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,12 @@
1
+ require "transaction_faker/version"
2
+ require "transaction_faker/transaction_helper"
3
+ require "transaction_faker/models/user"
4
+ require "transaction_faker/models/account"
5
+ require "faker"
6
+ require "rubystats"
7
+ require "descriptive_statistics"
8
+
9
+
10
+ module TransactionFaker
11
+ # Your code goes here...
12
+ end
@@ -0,0 +1,682 @@
1
+ module TransactionFaker
2
+
3
+ class Categories
4
+
5
+ #Categories that are more oriented towards describing a spending pattern than Plaid's
6
+ SUBCATEGORIES = {
7
+ #How much money did you spend going out?
8
+ "NIGHTLIFE" => [13001000, 13004002, 19025004],
9
+
10
+ #How many times did you eat out this past month? How expensive was it?
11
+ "EAT_OUT" => [13005007, 13005015, 13005020, 13005017, 13005043],
12
+
13
+ #How much spent in entertainment (movies, sports, concerts) ?
14
+ "ENTERTAINMENT" => [17001009, 17001003, 17001011],
15
+
16
+ #How much spent in recreation (gym, outdoors)?
17
+ "RECREATION" => [17018000, 17022000, 17005000],
18
+
19
+ #Water, gas, electricity, ventilation, internet, cable expenditures?
20
+ "UTILITIES" => [18009000, 18063000, 18031000, 18068001, 18068003],
21
+
22
+ #reparations per month?
23
+ "HOUSE_SERVICES" => [18024007, 18011000, 18050009],
24
+
25
+ "RENT" => [16002000],
26
+
27
+ #How much gone in taxes? How much taken out of ATMS?
28
+ "DEFAULT_EXPENSES" => [18020001, 18020013, 10002000],
29
+
30
+ #Barbershop, dentist, doctor, etc.
31
+ "PERSONAL_CARE" => [18045009, 14001012, 19043000],
32
+
33
+ #Weekly expenditures in groceries
34
+ "GROCERIES" => [19025002, 19025003],
35
+
36
+ #How many clothing apparels does this person buy per month? How expensive?
37
+ "SHOPPING" => [19012001],
38
+
39
+ #Uber, Lyft, weekend trips etc.
40
+ "RIDE_SHARING" => [22006001],
41
+
42
+ #Weekday commute as if it was all paid once at the start of the month
43
+ "DAILY_COMMUTE" => [22014000],
44
+
45
+ #income received every month. Not necessarily salary, but it could be?
46
+ "INCOME" => [20001000, 21007000],
47
+
48
+ #Exclusively payroll. Might be empty if salary is delivered through direct deposit.
49
+ "PAYROLL" => [21009000]
50
+ }
51
+
52
+ def self.get_transaction_type(transaction_id, type = "digital")
53
+ types = {
54
+ "digital" => [19019000],
55
+ "special" => [10, 11, 15, 16, 18009, 18050010, 18068000, 18068001,
56
+ 18068002, 18068003, 18068004, 18068005, 20, 21, 22001,
57
+ 22006001, 22008000, 22016000, 22017000]
58
+ }
59
+
60
+ types[type].each do |id|
61
+ length = id.to_s.length
62
+ if id.to_s[0...length] == transaction_id.to_s[0...length]
63
+ return type
64
+ elsif type == "special"
65
+ return "place"
66
+ else
67
+ return get_transaction_type(transaction_id, "special")
68
+ end
69
+ end
70
+ end
71
+
72
+ FIRST_DIV = {
73
+ 10000000 => 'Bank Fees',
74
+ 11000000 => 'Cash Advance',
75
+ 12000000 => 'Community',
76
+ 13000000 => 'Food and Drink',
77
+ 14000000 => 'Healthcare',
78
+ 15000000 => 'Interest',
79
+ 16000000 => 'Payment',
80
+ 17000000 => 'Recreation',
81
+ 18000000 => 'Service',
82
+ 19000000 => 'Shops',
83
+ 20000000 => 'Tax',
84
+ 21000000 => 'Transfer',
85
+ 22000000 => 'Travel',
86
+ }
87
+
88
+ SECOND_DIV = {
89
+ 10001000 => 'Overdraft',
90
+ 10002000 => 'ATM',
91
+ 10003000 => 'Late Payment',
92
+ 10004000 => 'Fraud Dispute',
93
+ 10005000 => 'Foreign Transaction',
94
+ 10006000 => 'Wire Transfer',
95
+ 10007000 => 'Insufficient Funds',
96
+ 10008000 => 'Cash Advance',
97
+ 10009000 => 'Excess Activity',
98
+ 12001000 => 'Animal Shelter',
99
+ 12002000 => 'Assisted Living Services',
100
+ 12003000 => 'Cemetery',
101
+ 12004000 => 'Courts',
102
+ 12005000 => 'Day Care and Preschools',
103
+ 12006000 => 'Disabled Persons Services',
104
+ 12007000 => 'Drug and Alcohol Services',
105
+ 12008000 => 'Education',
106
+ 12009000 => 'Government Departments and Agencies',
107
+ 12010000 => 'Government Lobbyists',
108
+ 12011000 => 'Housing Assistance and Shelters',
109
+ 12012000 => 'Law Enforcement',
110
+ 12013000 => 'Libraries',
111
+ 12014000 => 'Military',
112
+ 12015000 => 'Organizations and Associations',
113
+ 12016000 => 'Post Offices',
114
+ 12017000 => 'Public and Social Services',
115
+ 12018000 => 'Religious',
116
+ 12019000 => 'Senior Citizen Services',
117
+ 13001000 => 'Bar',
118
+ 13002000 => 'Breweries',
119
+ 13003000 => 'Internet Cafes',
120
+ 13004000 => 'Nightlife',
121
+ 13005000 => 'Restaurants',
122
+ 14001000 => 'Healthcare Services',
123
+ 14002000 => 'Physicians',
124
+ 15001000 => 'Interest Earned',
125
+ 15002000 => 'Interest Charged',
126
+ 16001000 => 'Credit Card',
127
+ 16002000 => 'Rent',
128
+ 16003000 => 'Loan',
129
+ 17001000 => 'Arts and Entertainment',
130
+ 17002000 => 'Athletic Fields',
131
+ 17003000 => 'Baseball',
132
+ 17004000 => 'Basketball',
133
+ 17005000 => 'Batting Cages',
134
+ 17006000 => 'Boating',
135
+ 17007000 => 'Campgrounds and RV Parks',
136
+ 17008000 => 'Canoes and Kayaks',
137
+ 17009000 => 'Combat Sports',
138
+ 17010000 => 'Cycling',
139
+ 17011000 => 'Dance',
140
+ 17012000 => 'Equestrian',
141
+ 17013000 => 'Football',
142
+ 17014000 => 'Go Carts',
143
+ 17015000 => 'Golf',
144
+ 17016000 => 'Gun Ranges',
145
+ 17017000 => 'Gymnastics',
146
+ 17018000 => 'Gyms and Fitness Centers',
147
+ 17019000 => 'Hiking',
148
+ 17020000 => 'Hockey',
149
+ 17021000 => 'Hot Air Balloons',
150
+ 17022000 => 'Hunting and Fishing',
151
+ 17023000 => 'Landmarks',
152
+ 17024000 => 'Miniature Golf',
153
+ 17025000 => 'Outdoors',
154
+ 17026000 => 'Paintball',
155
+ 17027000 => 'Parks',
156
+ 17028000 => 'Personal Trainers',
157
+ 17029000 => 'Race Tracks',
158
+ 17030000 => 'Racquet Sports',
159
+ 17031000 => 'Racquetball',
160
+ 17032000 => 'Rafting',
161
+ 17033000 => 'Recreation Centers',
162
+ 17034000 => 'Rock Climbing',
163
+ 17035000 => 'Running',
164
+ 17036000 => 'Scuba Diving',
165
+ 17037000 => 'Skating',
166
+ 17038000 => 'Skydiving',
167
+ 17039000 => 'Snow Sports',
168
+ 17040000 => 'Soccer',
169
+ 17041000 => 'Sports and Recreation Camps',
170
+ 17042000 => 'Sports Clubs',
171
+ 17043000 => 'Stadiums and Arenas',
172
+ 17044000 => 'Swimming',
173
+ 17045000 => 'Tennis',
174
+ 17046000 => 'Water Sports',
175
+ 17047000 => 'Yoga and Pilates',
176
+ 17048000 => 'Zoo',
177
+ 18001000 => 'Advertising and Marketing',
178
+ 18003000 => 'Art Restoration',
179
+ 18004000 => 'Audiovisual',
180
+ 18005000 => 'Automation and Control Systems',
181
+ 18006000 => 'Automotive',
182
+ 18007000 => 'Business and Strategy Consulting',
183
+ 18008000 => 'Business Services',
184
+ 18009000 => 'Cable',
185
+ 18010000 => 'Chemicals and Gasses',
186
+ 18011000 => 'Cleaning',
187
+ 18012000 => 'Computers',
188
+ 18013000 => 'Construction',
189
+ 18014000 => 'Credit Counseling and Bankruptcy Services',
190
+ 18015000 => 'Dating and Escort',
191
+ 18016000 => 'Employment Agencies',
192
+ 18017000 => 'Engineering',
193
+ 18018000 => 'Entertainment',
194
+ 18019000 => 'Events and Event Planning',
195
+ 18020000 => 'Financial',
196
+ 18021000 => 'Food and Beverage',
197
+ 18022000 => 'Funeral Services',
198
+ 18023000 => 'Geological',
199
+ 18024000 => 'Home Improvement',
200
+ 18025000 => 'Household',
201
+ 18026000 => 'Human Resources',
202
+ 18027000 => 'Immigration',
203
+ 18028000 => 'Import and Export',
204
+ 18029000 => 'Industrial Machinery and Vehicles',
205
+ 18030000 => 'Insurance',
206
+ 18031000 => 'Internet Services',
207
+ 18032000 => 'Leather',
208
+ 18033000 => 'Legal',
209
+ 18034000 => 'Logging and Sawmills',
210
+ 18035000 => 'Machine Shops',
211
+ 18036000 => 'Management',
212
+ 18037000 => 'Manufacturing',
213
+ 18038000 => 'Media Production',
214
+ 18039000 => 'Metals',
215
+ 18040000 => 'Mining',
216
+ 18041000 => 'News Reporting',
217
+ 18042000 => 'Oil and Gas',
218
+ 18043000 => 'Packaging',
219
+ 18044000 => 'Paper',
220
+ 18045000 => 'Personal Care',
221
+ 18046000 => 'Petroleum',
222
+ 18047000 => 'Photography',
223
+ 18048000 => 'Plastics',
224
+ 18049000 => 'Rail',
225
+ 18050000 => 'Real Estate',
226
+ 18051000 => 'Refrigeration and Ice',
227
+ 18052000 => 'Renewable Energy',
228
+ 18053000 => 'Repair Services',
229
+ 18054000 => 'Research',
230
+ 18055000 => 'Rubber',
231
+ 18056000 => 'Scientific',
232
+ 18057000 => 'Security and Safety',
233
+ 18058000 => 'Shipping and Freight',
234
+ 18059000 => 'Software Development',
235
+ 18060000 => 'Storage',
236
+ 18061000 => 'Subscription',
237
+ 18062000 => 'Tailors',
238
+ 18063000 => 'Telecommunication Services',
239
+ 18064000 => 'Textiles',
240
+ 18065000 => 'Tourist Information and Services',
241
+ 18066000 => 'Transportation',
242
+ 18067000 => 'Travel Agents and Tour Operators',
243
+ 18068000 => 'Utilities',
244
+ 18069000 => 'Veterinarians',
245
+ 18070000 => 'Water and Waste Management',
246
+ 18071000 => 'Web Design and Development',
247
+ 18072000 => 'Welding',
248
+ 18073000 => 'Agriculture and Forestry',
249
+ 18074000 => 'Art and Graphic Design',
250
+ 19001000 => 'Adult',
251
+ 19002000 => 'Antiques',
252
+ 19003000 => 'Arts and Crafts',
253
+ 19004000 => 'Auctions',
254
+ 19005000 => 'Automotive',
255
+ 19006000 => 'Beauty Products',
256
+ 19007000 => 'Bicycles',
257
+ 19008000 => 'Boat Dealers',
258
+ 19009000 => 'Bookstores',
259
+ 19010000 => 'Cards and Stationery',
260
+ 19011000 => 'Children',
261
+ 19012000 => 'Clothing and Accessories',
262
+ 19013000 => 'Computers and Electronics',
263
+ 19014000 => 'Construction Supplies',
264
+ 19015000 => 'Convenience Stores',
265
+ 19016000 => 'Costumes',
266
+ 19017000 => 'Dance and Music',
267
+ 19018000 => 'Department Stores',
268
+ 19019000 => 'Digital Purchase',
269
+ 19020000 => 'Discount Stores',
270
+ 19021000 => 'Electrical Equipment',
271
+ 19022000 => 'Equipment Rental',
272
+ 19023000 => 'Flea Markets',
273
+ 19024000 => 'Florists',
274
+ 19025000 => 'Food and Beverage Store',
275
+ 19026000 => 'Fuel Dealer',
276
+ 19027000 => 'Furniture and Home Decor',
277
+ 19028000 => 'Gift and Novelty',
278
+ 19029000 => 'Glasses and Optometrist',
279
+ 19030000 => 'Hardware Store',
280
+ 19031000 => 'Hobby and Collectibles',
281
+ 19032000 => 'Industrial Supplies',
282
+ 19033000 => 'Jewelry and Watches',
283
+ 19034000 => 'Luggage',
284
+ 19035000 => 'Marine Supplies',
285
+ 19036000 => 'Music, Video and DVD',
286
+ 19037000 => 'Musical Instruments',
287
+ 19038000 => 'Newsstands',
288
+ 19039000 => 'Office Supplies',
289
+ 19040000 => 'Outlet',
290
+ 19041000 => 'Pawn Shops',
291
+ 19042000 => 'Pets',
292
+ 19043000 => 'Pharmacies',
293
+ 19044000 => 'Photos and Frames',
294
+ 19045000 => 'Shopping Centers and Malls',
295
+ 19046000 => 'Sporting Goods',
296
+ 19047000 => 'Supermarkets and Groceries',
297
+ 19048000 => 'Tobacco',
298
+ 19049000 => 'Toys',
299
+ 19050000 => 'Vintage and Thrift',
300
+ 19051000 => 'Warehouses and Wholesale Stores',
301
+ 19052000 => 'Wedding and Bridal',
302
+ 19053000 => 'Wholesale',
303
+ 19054000 => 'Lawn and Garden',
304
+ 20001000 => 'Refund',
305
+ 20002000 => 'Payment',
306
+ 21001000 => 'Internal Account Transfer',
307
+ 21002000 => 'ACH',
308
+ 21003000 => 'Billpay',
309
+ 21004000 => 'Check',
310
+ 21005000 => 'Credit',
311
+ 21006000 => 'Debit',
312
+ 21007000 => 'Deposit',
313
+ 21008000 => 'Keep the Change Savings Program',
314
+ 21009000 => 'Payroll',
315
+ 21010000 => 'Third Party',
316
+ 21011000 => 'Wire',
317
+ 21012000 => 'Withdrawal',
318
+ 21013000 => 'Save As You Go',
319
+ 22001000 => 'Airlines and Aviation Services',
320
+ 22002000 => 'Airports',
321
+ 22003000 => 'Boat',
322
+ 22004000 => 'Bus Stations',
323
+ 22005000 => 'Car and Truck Rentals',
324
+ 22006000 => 'Car Service',
325
+ 22007000 => 'Charter Buses',
326
+ 22008000 => 'Cruises',
327
+ 22009000 => 'Gas Stations',
328
+ 22010000 => 'Heliports',
329
+ 22011000 => 'Limos and Chauffeurs',
330
+ 22012000 => 'Lodging',
331
+ 22013000 => 'Parking',
332
+ 22014000 => 'Public Transportation Services',
333
+ 22015000 => 'Rail',
334
+ 22016000 => 'Taxi',
335
+ 22017000 => 'Tolls and Fees',
336
+ 22018000 => 'Transportation Centers'
337
+ }
338
+
339
+ THIRD_DIV = {
340
+ 12002001 => 'Facilities and Nursing Homes',
341
+ 12002002 => 'Caretakers',
342
+ 12008001 => 'Vocational Schools',
343
+ 12008002 => 'Tutoring and Educational Services',
344
+ 12008003 => 'Primary and Secondary Schools',
345
+ 12008004 => 'Fraternities and Sororities',
346
+ 12008005 => 'Driving Schools',
347
+ 12008006 => 'Dance Schools',
348
+ 12008007 => 'Culinary Lessons and Schools',
349
+ 12008008 => 'Computer Training',
350
+ 12008009 => 'Colleges and Universities',
351
+ 12008010 => 'Art School',
352
+ 12008011 => 'Adult Education',
353
+ 12012001 => 'Police Stations',
354
+ 12012002 => 'Fire Stations',
355
+ 12012003 => 'Correctional Institutions',
356
+ 12015001 => 'Youth Organizations',
357
+ 12015002 => 'Environmental',
358
+ 12015003 => 'Charities and Non-Profits',
359
+ 12018001 => 'Temple',
360
+ 12018002 => 'Synagogues',
361
+ 12018003 => 'Mosques',
362
+ 12018004 => 'Churches',
363
+ 12019001 => 'Retirement',
364
+ 13001001 => 'Wine Bar',
365
+ 13001002 => 'Sports Bar',
366
+ 13001003 => 'Hotel Lounge',
367
+ 13004001 => 'Strip Club',
368
+ 13004002 => 'Night Clubs',
369
+ 13004003 => 'Karaoke',
370
+ 13004004 => 'Jazz and Blues Cafe',
371
+ 13004005 => 'Hookah Lounges',
372
+ 13004006 => 'Adult Entertainment',
373
+ 13005001 => 'Winery',
374
+ 13005002 => 'Vegan and Vegetarian',
375
+ 13005003 => 'Turkish',
376
+ 13005004 => 'Thai',
377
+ 13005005 => 'Swiss',
378
+ 13005006 => 'Sushi',
379
+ 13005007 => 'Steakhouses',
380
+ 13005008 => 'Spanish',
381
+ 13005009 => 'Seafood',
382
+ 13005010 => 'Scandinavian',
383
+ 13005011 => 'Portuguese',
384
+ 13005012 => 'Pizza',
385
+ 13005013 => 'Moroccan',
386
+ 13005014 => 'Middle Eastern',
387
+ 13005015 => 'Mexican',
388
+ 13005016 => 'Mediterranean',
389
+ 13005017 => 'Latin American',
390
+ 13005018 => 'Korean',
391
+ 13005019 => 'Juice Bar',
392
+ 13005020 => 'Japanese',
393
+ 13005021 => 'Italian',
394
+ 13005022 => 'Indonesian',
395
+ 13005023 => 'Indian',
396
+ 13005024 => 'Ice Cream',
397
+ 13005025 => 'Greek',
398
+ 13005026 => 'German',
399
+ 13005027 => 'Gastropub',
400
+ 13005028 => 'French',
401
+ 13005029 => 'Food Truck',
402
+ 13005030 => 'Fish and Chips',
403
+ 13005031 => 'Filipino',
404
+ 13005032 => 'Fast Food',
405
+ 13005033 => 'Falafel',
406
+ 13005034 => 'Ethiopian',
407
+ 13005035 => 'Eastern European',
408
+ 13005036 => 'Donuts',
409
+ 13005037 => 'Distillery',
410
+ 13005038 => 'Diners',
411
+ 13005039 => 'Dessert',
412
+ 13005040 => 'Delis',
413
+ 13005041 => 'Cupcake Shop',
414
+ 13005042 => 'Cuban',
415
+ 13005043 => 'Coffee Shop',
416
+ 13005044 => 'Chinese',
417
+ 13005045 => 'Caribbean',
418
+ 13005046 => 'Cajun',
419
+ 13005047 => 'Cafe',
420
+ 13005048 => 'Burrito',
421
+ 13005049 => 'Burgers',
422
+ 13005050 => 'Breakfast Spot',
423
+ 13005051 => 'Brazilian',
424
+ 13005052 => 'Barbecue',
425
+ 13005053 => 'Bakery',
426
+ 13005054 => 'Bagel Shop',
427
+ 13005055 => 'Australian',
428
+ 13005056 => 'Asian',
429
+ 13005057 => 'American',
430
+ 13005058 => 'African',
431
+ 13005059 => 'Afghan',
432
+ 14001001 => 'Psychologists',
433
+ 14001002 => 'Pregnancy and Sexual Health',
434
+ 14001003 => 'Podiatrists',
435
+ 14001004 => 'Physical Therapy',
436
+ 14001005 => 'Optometrists',
437
+ 14001006 => 'Nutritionists',
438
+ 14001007 => 'Nurses',
439
+ 14001008 => 'Mental Health',
440
+ 14001009 => 'Medical Supplies and Labs',
441
+ 14001010 => 'Hospitals, Clinics and Medical Centers',
442
+ 14001011 => 'Emergency Services',
443
+ 14001012 => 'Dentists',
444
+ 14001013 => 'Counseling and Therapy',
445
+ 14001014 => 'Chiropractors',
446
+ 14001015 => 'Blood Banks and Centers',
447
+ 14001016 => 'Alternative Medicine',
448
+ 14001017 => 'Acupuncture',
449
+ 14002001 => 'Urologists',
450
+ 14002002 => 'Respiratory',
451
+ 14002003 => 'Radiologists',
452
+ 14002004 => 'Psychiatrists',
453
+ 14002005 => 'Plastic Surgeons',
454
+ 14002006 => 'Pediatricians',
455
+ 14002007 => 'Pathologists',
456
+ 14002008 => 'Orthopedic Surgeons',
457
+ 14002009 => 'Ophthalmologists',
458
+ 14002010 => 'Oncologists',
459
+ 14002011 => 'Obstetricians and Gynecologists',
460
+ 14002012 => 'Neurologists',
461
+ 14002013 => 'Internal Medicine',
462
+ 14002014 => 'General Surgery',
463
+ 14002015 => 'Gastroenterologists',
464
+ 14002016 => 'Family Medicine',
465
+ 14002017 => 'Ear, Nose and Throat',
466
+ 14002018 => 'Dermatologists',
467
+ 14002019 => 'Cardiologists',
468
+ 14002020 => 'Anesthesiologists',
469
+ 17001001 => 'Theatrical Productions',
470
+ 17001002 => 'Symphony and Opera',
471
+ 17001003 => 'Sports Venues',
472
+ 17001004 => 'Social Clubs',
473
+ 17001005 => 'Psychics and Astrologers',
474
+ 17001006 => 'Party Centers',
475
+ 17001007 => 'Music and Show Venues',
476
+ 17001008 => 'Museums',
477
+ 17001009 => 'Movie Theatres',
478
+ 17001010 => 'Fairgrounds and Rodeos',
479
+ 17001011 => 'Entertainment',
480
+ 17001012 => 'Dance Halls and Saloons',
481
+ 17001013 => 'Circuses and Carnivals',
482
+ 17001014 => 'Casinos and Gaming',
483
+ 17001015 => 'Bowling',
484
+ 17001016 => 'Billiards and Pool',
485
+ 17001017 => 'Art Dealers and Galleries',
486
+ 17001018 => 'Arcades and Amusement Parks',
487
+ 17001019 => 'Aquarium',
488
+ 17023001 => 'Monuments and Memorials',
489
+ 17023002 => 'Historic Sites',
490
+ 17023003 => 'Gardens',
491
+ 17023004 => 'Buildings and Structures',
492
+ 17025001 => 'Rivers',
493
+ 17025002 => 'Mountains',
494
+ 17025003 => 'Lakes',
495
+ 17025004 => 'Forests',
496
+ 17025005 => 'Beaches',
497
+ 17027001 => 'Playgrounds',
498
+ 17027002 => 'Picnic Areas',
499
+ 17027003 => 'Natural Parks',
500
+ 18001001 => 'Writing, Copywriting and Technical Writing',
501
+ 18001002 => 'Search Engine Marketing and Optimization',
502
+ 18001003 => 'Public Relations',
503
+ 18001004 => 'Promotional Items',
504
+ 18001005 => 'Print, TV, Radio and Outdoor Advertising',
505
+ 18001006 => 'Online Advertising',
506
+ 18001007 => 'Market Research and Consulting',
507
+ 18001008 => 'Direct Mail and Email Marketing Services',
508
+ 18001009 => 'Creative Services',
509
+ 18001010 => 'Advertising Agencies and Media Buyers',
510
+ 18006001 => 'Towing',
511
+ 18006002 => 'Motorcycle, Moped and Scooter Repair',
512
+ 18006003 => 'Maintenance and Repair',
513
+ 18006004 => 'Car Wash and Detail',
514
+ 18006005 => 'Car Appraisers',
515
+ 18006006 => 'Auto Transmission',
516
+ 18006007 => 'Auto Tires',
517
+ 18006008 => 'Auto Smog Check',
518
+ 18006009 => 'Auto Oil and Lube',
519
+ 18008001 => 'Printing and Publishing',
520
+ 18012001 => 'Maintenance and Repair',
521
+ 18012002 => 'Software Development',
522
+ 18013001 => 'Specialty',
523
+ 18013002 => 'Roofers',
524
+ 18013003 => 'Painting',
525
+ 18013004 => 'Masonry',
526
+ 18013005 => 'Infrastructure',
527
+ 18013006 => 'Heating, Ventilating and Air Conditioning',
528
+ 18013007 => 'Electricians',
529
+ 18013008 => 'Contractors',
530
+ 18013009 => 'Carpet and Flooring',
531
+ 18013010 => 'Carpenters',
532
+ 18018001 => 'Media',
533
+ 18020001 => 'Taxes',
534
+ 18020002 => 'Student Aid and Grants',
535
+ 18020003 => 'Stock Brokers',
536
+ 18020004 => 'Loans and Mortgages',
537
+ 18020005 => 'Holding and Investment Offices',
538
+ 18020006 => 'Fund Raising',
539
+ 18020007 => 'Financial Planning and Investments',
540
+ 18020008 => 'Credit Reporting',
541
+ 18020009 => 'Collections',
542
+ 18020010 => 'Check Cashing',
543
+ 18020011 => 'Business Brokers and Franchises',
544
+ 18020012 => 'Banking and Finance',
545
+ 18020013 => 'ATMs',
546
+ 18020014 => 'Accounting and Bookkeeping',
547
+ 18021001 => 'Distribution',
548
+ 18021002 => 'Catering',
549
+ 18024001 => 'Upholstery',
550
+ 18024002 => 'Tree Service',
551
+ 18024003 => 'Swimming Pool Maintenance and Services',
552
+ 18024004 => 'Storage',
553
+ 18024005 => 'Roofers',
554
+ 18024006 => 'Pools and Spas',
555
+ 18024007 => 'Plumbing',
556
+ 18024008 => 'Pest Control',
557
+ 18024009 => 'Painting',
558
+ 18024010 => 'Movers',
559
+ 18024011 => 'Mobile Homes',
560
+ 18024012 => 'Lighting Fixtures',
561
+ 18024013 => 'Landscaping and Gardeners',
562
+ 18024014 => 'Kitchens',
563
+ 18024015 => 'Interior Design',
564
+ 18024016 => 'Housewares',
565
+ 18024017 => 'Home Inspection Services',
566
+ 18024018 => 'Home Appliances',
567
+ 18024019 => 'Heating, Ventilation and Air Conditioning',
568
+ 18024020 => 'Hardware and Services',
569
+ 18024021 => 'Fences, Fireplaces and Garage Doors',
570
+ 18024022 => 'Electricians',
571
+ 18024023 => 'Doors and Windows',
572
+ 18024024 => 'Contractors',
573
+ 18024025 => 'Carpet and Flooring',
574
+ 18024026 => 'Carpenters',
575
+ 18024027 => 'Architects',
576
+ 18037001 => 'Apparel and Fabric Products',
577
+ 18037002 => 'Chemicals and Gasses',
578
+ 18037003 => 'Computers and Office Machines',
579
+ 18037004 => 'Electrical Equipment and Components',
580
+ 18037005 => 'Food and Beverage',
581
+ 18037006 => 'Furniture and Fixtures',
582
+ 18037007 => 'Glass Products',
583
+ 18037008 => 'Industrial Machinery and Equipment',
584
+ 18037009 => 'Leather Goods',
585
+ 18037010 => 'Metal Products',
586
+ 18037011 => 'Nonmetallic Mineral Products',
587
+ 18037012 => 'Paper Products',
588
+ 18037013 => 'Petroleum',
589
+ 18037014 => 'Plastic Products',
590
+ 18037015 => 'Rubber Products',
591
+ 18037016 => 'Service Instruments',
592
+ 18037017 => 'Textiles',
593
+ 18037018 => 'Tobacco',
594
+ 18037019 => 'Transportation Equipment',
595
+ 18037020 => 'Wood Products',
596
+ 18040001 => 'Coal',
597
+ 18040002 => 'Metal',
598
+ 18040003 => 'Non-Metallic Minerals',
599
+ 18045001 => 'Tattooing',
600
+ 18045002 => 'Tanning Salons',
601
+ 18045003 => 'Spas',
602
+ 18045004 => 'Skin Care',
603
+ 18045005 => 'Piercing',
604
+ 18045006 => 'Massage Clinics and Therapists',
605
+ 18045007 => 'Manicures and Pedicures',
606
+ 18045008 => 'Laundry and Garment Services',
607
+ 18045009 => 'Hair Salons and Barbers',
608
+ 18045010 => 'Hair Removal',
609
+ 18050001 => 'Real Estate Development and Title Companies',
610
+ 18050002 => 'Real Estate Appraiser',
611
+ 18050003 => 'Real Estate Agents',
612
+ 18050004 => 'Property Management',
613
+ 18050005 => 'Corporate Housing',
614
+ 18050006 => 'Commercial Real Estate',
615
+ 18050007 => 'Building and Land Surveyors',
616
+ 18050008 => 'Boarding Houses',
617
+ 18050009 => 'Apartments, Condos and Houses',
618
+ 18050010 => 'Rent',
619
+ 18068001 => 'Water',
620
+ 18068002 => 'Sanitary and Waste Management',
621
+ 18068003 => 'Heating, Ventilating, and Air Conditioning',
622
+ 18068004 => 'Gas',
623
+ 18068005 => 'Electric',
624
+ 18073001 => 'Crop Production',
625
+ 18073002 => 'Forestry',
626
+ 18073003 => 'Livestock and Animals',
627
+ 18073004 => 'Services',
628
+ 19005001 => 'Used Car Dealers',
629
+ 19005002 => 'Salvage Yards',
630
+ 19005003 => 'RVs and Motor Homes',
631
+ 19005004 => 'Motorcycles, Mopeds and Scooters',
632
+ 19005005 => 'Classic and Antique Car',
633
+ 19005006 => 'Car Parts and Accessories',
634
+ 19005007 => 'Car Dealers and Leasing',
635
+ 19012001 => 'Women\'s Store',
636
+ 19012002 => 'Swimwear',
637
+ 19012003 => 'Shoe Store',
638
+ 19012004 => 'Men\'s Store',
639
+ 19012005 => 'Lingerie Store',
640
+ 19012006 => 'Kids\' Store',
641
+ 19012007 => 'Boutique',
642
+ 19012008 => 'Accessories Store',
643
+ 19013001 => 'Video Games',
644
+ 19013002 => 'Mobile Phones',
645
+ 19013003 => 'Cameras',
646
+ 19025001 => 'Specialty',
647
+ 19025002 => 'Health Food',
648
+ 19025003 => 'Farmers Markets',
649
+ 19025004 => 'Beer, Wine and Spirits',
650
+ 19040001 => 'Women\'s Store',
651
+ 19040002 => 'Swimwear',
652
+ 19040003 => 'Shoe Store',
653
+ 19040004 => 'Men\'s Store',
654
+ 19040005 => 'Lingerie Store',
655
+ 19040006 => 'Kids\' Store',
656
+ 19040007 => 'Boutique',
657
+ 19040008 => 'Accessories Store',
658
+ 21007001 => 'Check',
659
+ 21007002 => 'ATM',
660
+ 21009001 => 'Benefits',
661
+ 21010001 => 'Venmo',
662
+ 21010002 => 'Square Cash',
663
+ 21010003 => 'Square',
664
+ 21010004 => 'PayPal',
665
+ 21010005 => 'Dwolla',
666
+ 21010006 => 'Coinbase',
667
+ 21010007 => 'Chase QuickPay',
668
+ 21010008 => 'Acorns',
669
+ 21010009 => 'Digit',
670
+ 21010010 => 'Betterment',
671
+ 21012001 => 'Check',
672
+ 21012002 => 'ATM',
673
+ 22006001 => 'Ride Share',
674
+ 22012001 => 'Resorts',
675
+ 22012002 => 'Lodges and Vacation Rentals',
676
+ 22012003 => 'Hotels and Motels',
677
+ 22012004 => 'Hostels',
678
+ 22012005 => 'Cottages and Cabins',
679
+ 22012006 => 'Bed and Breakfasts'
680
+ }
681
+ end
682
+ end