earth 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/CHANGELOG +12 -0
  2. data/data/residence/recs_response_groupings.csv +52 -0
  3. data/earth.gemspec +1 -1
  4. data/lib/earth/automobile/automobile_make_model_year_variant/data_miner.rb +1 -1
  5. data/lib/earth/industry/mecs_energy.rb +26 -16
  6. data/lib/earth/{insolation_scopes.rb → irradiance_scopes.rb} +1 -1
  7. data/lib/earth/loader.rb +5 -4
  8. data/lib/earth/locality/{direct_normal_insolation.rb → direct_normal_irradiance.rb} +4 -4
  9. data/lib/earth/locality/{direct_normal_insolation → direct_normal_irradiance}/data_miner.rb +4 -4
  10. data/lib/earth/locality/electricity_mix/data_miner.rb +8 -8
  11. data/lib/earth/locality/{global_horizontal_insolation.rb → global_horizontal_irradiance.rb} +4 -4
  12. data/lib/earth/locality/{global_horizontal_insolation → global_horizontal_irradiance}/data_miner.rb +4 -4
  13. data/lib/earth/locality/{photovoltaic_insolation.rb → photovoltaic_irradiance.rb} +4 -4
  14. data/lib/earth/locality/{photovoltaic_insolation → photovoltaic_irradiance}/data_miner.rb +4 -4
  15. data/lib/earth/locality/state.rb +3 -1
  16. data/lib/earth/locality/state/data_miner.rb +15 -8
  17. data/lib/earth/locality/zip_code/data_miner.rb +1 -1
  18. data/lib/earth/residence/recs_2009_response.rb +655 -0
  19. data/lib/earth/residence/recs_2009_response/data_miner.rb +402 -0
  20. data/lib/earth/residence/recs_2009_response/parser.rb +879 -0
  21. data/lib/earth/version.rb +1 -1
  22. data/spec/earth/locality/direct_normal_irradiance_spec.rb +8 -0
  23. data/spec/earth/locality/global_horizontal_irradiance_spec.rb +8 -0
  24. data/spec/earth/locality/photovoltaic_irradiance_spec.rb +8 -0
  25. data/spec/earth/locality/state_spec.rb +7 -0
  26. data/spec/earth/residence/recs_2009_response_spec.rb +388 -0
  27. data/spec/earth_spec.rb +1 -1
  28. metadata +386 -246
  29. data/ar17.html +0 -2093
  30. data/spec/earth/locality/direct_normal_insolation_spec.rb +0 -8
  31. data/spec/earth/locality/global_horizontal_insolation_spec.rb +0 -8
  32. data/spec/earth/locality/photovoltaic_insolation_spec.rb +0 -8
@@ -0,0 +1,402 @@
1
+ require 'earth/residence/recs_2009_response/parser'
2
+
3
+ Recs2009Response.class_eval do
4
+ data_miner do
5
+ import 'the 2009 EIA Residential Energy Consumption Survey microdata',
6
+ :url => 'http://www.eia.gov/consumption/residential/data/2009/csv/recs2009_public_v3.csv',
7
+ :transform => { :class => Recs2009Response::Parser } do
8
+ key 'id'
9
+ store 'weighting'
10
+
11
+ # location
12
+ store 'census_region_number'
13
+ store 'census_division_number'
14
+ store 'recs_grouping_id'
15
+ store 'urban_rural'
16
+ store 'metro_micro'
17
+ store 'climate_region_id'
18
+ store 'climate_zone_id'
19
+ store 'hdd_2009', :from_units => :degrees_fahrenheit, :to_units => :degrees_celsius
20
+ store 'hdd_avg', :from_units => :degrees_fahrenheit, :to_units => :degrees_celsius
21
+ store 'cdd_2009', :from_units => :degrees_fahrenheit, :to_units => :degrees_celsius
22
+ store 'cdd_avg', :from_units => :degrees_fahrenheit, :to_units => :degrees_celsius
23
+
24
+ # building
25
+ store 'building_type'
26
+ store 'converted_house'
27
+ store 'condo_coop'
28
+ store 'apartments'
29
+ store 'year_built'
30
+ store 'year_occupied'
31
+ store 'building_floors'
32
+ store 'levels'
33
+ store 'area', :from_units => :square_feet, :to_units => :square_metres
34
+ store 'rooms'
35
+ store 'bedrooms'
36
+ store 'bathrooms'
37
+ store 'half_baths'
38
+ store 'other_rooms'
39
+ store 'attic_rooms'
40
+ store 'basement_rooms'
41
+ store 'garage_type'
42
+ store 'garage_size'
43
+ store 'pool'
44
+ store 'shaded'
45
+
46
+ # envelope
47
+ store 'slab'
48
+ store 'crawlspace'
49
+ store 'basement_type'
50
+ store 'attic_type'
51
+ store 'wall_material'
52
+ store 'roof_material'
53
+ store 'windows'
54
+ store 'window_panes'
55
+ store 'sliding_doors'
56
+ store 'insulation'
57
+ store 'drafty'
58
+ store 'high_ceiling'
59
+
60
+ # HVAC
61
+ store 'heating'
62
+ store 'heater'
63
+ store 'heater_age'
64
+ store 'heater_fuel'
65
+ store 'heater_shared'
66
+ store 'heater_thermostats'
67
+ store 'heater_portion'
68
+ store 'heater_2'
69
+ store 'heater_2_fuel'
70
+ store 'heater_3'
71
+ store 'heater_3_fuel'
72
+ store 'heater_4'
73
+ store 'heater_4_fuel'
74
+ store 'heater_5'
75
+ store 'heater_5_fuel'
76
+ store 'heater_6'
77
+ store 'heater_6_fuel'
78
+ store 'cooling'
79
+ store 'cooler_central_age'
80
+ store 'cooler_central_shared'
81
+ store 'cooler_ac_units'
82
+ store 'cooler_ac_age'
83
+ store 'cooler_ac_energy_star'
84
+ store 'fans'
85
+
86
+ # water heating
87
+ store 'water_heaters_storage'
88
+ store 'water_heaters_tankless'
89
+ store 'water_heater'
90
+ store 'water_heater_fuel'
91
+ store 'water_heater_age'
92
+ store 'water_heater_size'
93
+ store 'water_heater_shared'
94
+ store 'water_heater_2'
95
+ store 'water_heater_2_fuel'
96
+ store 'water_heater_2_age'
97
+ store 'water_heater_2_size'
98
+ store 'pool_fuel'
99
+ store 'hot_tub_fuel'
100
+
101
+ # lighting
102
+ store 'lights_high_use'
103
+ store 'lights_high_use_efficient'
104
+ store 'lights_med_use'
105
+ store 'lights_med_use_efficient'
106
+ store 'lights_low_use'
107
+ store 'lights_low_use_efficient'
108
+ store 'lights_outdoor'
109
+ store 'lights_outdoor_efficient'
110
+
111
+ # appliances
112
+ store 'cooking_fuel'
113
+ store 'stoves'
114
+ store 'stove_fuel'
115
+ store 'cooktops'
116
+ store 'cooktop_fuel'
117
+ store 'ovens'
118
+ store 'oven_fuel'
119
+ store 'oven_type'
120
+ store 'outdoor_grill_fuel'
121
+ store 'indoor_grill_fuel'
122
+ store 'toaster'
123
+ store 'coffee'
124
+
125
+ store 'fridges'
126
+ store 'fridge_type'
127
+ store 'fridge_size'
128
+ store 'fridge_defrost'
129
+ store 'fridge_door_ice'
130
+ store 'fridge_age'
131
+ store 'fridge_energy_star'
132
+ store 'fridge_2_type'
133
+ store 'fridge_2_size'
134
+ store 'fridge_2_defrost'
135
+ store 'fridge_2_age'
136
+ store 'fridge_2_energy_star'
137
+ store 'fridge_3_type'
138
+ store 'fridge_3_size'
139
+ store 'fridge_3_defrost'
140
+ store 'fridge_3_age'
141
+ store 'fridge_3_energy_star'
142
+ store 'freezers'
143
+ store 'freezer_type'
144
+ store 'freezer_size'
145
+ store 'freezer_defrost'
146
+ store 'freezer_age'
147
+ store 'freezer_2_type'
148
+ store 'freezer_2_size'
149
+ store 'freezer_2_defrost'
150
+ store 'freezer_2_age'
151
+ store 'dishwasher_age'
152
+ store 'dishwasher_energy_star'
153
+ store 'washer_type'
154
+ store 'washer_age'
155
+ store 'washer_energy_star'
156
+ store 'dryer_fuel'
157
+ store 'dryer_age'
158
+
159
+ # electronics
160
+ store 'tvs'
161
+ store 'tv_size'
162
+ store 'tv_type'
163
+ store 'tv_theater'
164
+ store 'tv_2_size'
165
+ store 'tv_2_type'
166
+ store 'tv_2_theater'
167
+ store 'tv_3_size'
168
+ store 'tv_3_type'
169
+ store 'tv_3_theater'
170
+ store 'computers'
171
+ store 'computer_type'
172
+ store 'computer_monitor'
173
+ store 'computer_2_type'
174
+ store 'computer_2_monitor'
175
+ store 'computer_3_type'
176
+ store 'computer_3_monitor'
177
+ store 'internet'
178
+ store 'printers'
179
+ store 'fax'
180
+ store 'copier'
181
+ store 'well_pump'
182
+ store 'engine_block_heater'
183
+ store 'aquarium'
184
+ store 'stereo'
185
+ store 'cordless_phone'
186
+ store 'answering_machine'
187
+ store 'tools'
188
+ store 'electronics'
189
+
190
+ # behaviour
191
+ store 'home_business'
192
+ store 'home_during_week'
193
+ store 'telecommuting', :units => :days_per_month
194
+ store 'unusual_activities'
195
+ store 'heat_area', :from_units => :square_feet, :to_units => :square_metres
196
+ store 'heat_rooms'
197
+ store 'heat_attic_portion'
198
+ store 'heat_basement_portion'
199
+ store 'heat_garage'
200
+ store 'heat_temp_day', :units => :degrees_fahrenheit
201
+ store 'heat_temp_night', :units => :degrees_fahrenheit
202
+ store 'heat_temp_away', :units => :degrees_fahrenheit
203
+ store 'heat_auto_adjust_day'
204
+ store 'heat_auto_adjust_night'
205
+ store 'cool_area', :from_units => :square_feet, :to_units => :square_metres
206
+ store 'cool_rooms'
207
+ store 'cool_attic_portion'
208
+ store 'cool_basement_portion'
209
+ store 'cool_garage'
210
+ store 'cool_temp_day', :units => :degrees_fahrenheit
211
+ store 'cool_temp_night', :units => :degrees_fahrenheit
212
+ store 'cool_temp_away', :units => :degrees_fahrenheit
213
+ store 'cool_auto_adjust_day'
214
+ store 'cool_auto_adjust_night'
215
+ store 'cooler_central_use'
216
+ store 'cooler_ac_use'
217
+ store 'fan_use'
218
+ store 'humidifier_use', :units => :months
219
+ store 'dehumidifier_use', :units => :months
220
+ store 'oven_use', :units => :times_per_month
221
+ store 'microwave_use'
222
+ store 'microwave_defrost'
223
+ store 'cooking_frequency', :units => :times_per_month
224
+ store 'fridge_2_use', :units => :months
225
+ store 'fridge_3_use', :units => :months
226
+ store 'dishwasher_use', :units => :times_per_month
227
+ store 'washer_use', :units => :times_per_month
228
+ store 'washer_temp_wash'
229
+ store 'washer_temp_rinse'
230
+ store 'dryer_use'
231
+ store 'tv_weekday_use', :units => :hours_per_day
232
+ store 'tv_weekend_use', :units => :hours_per_day
233
+ store 'tv_2_weekday_use', :units => :hours_per_day
234
+ store 'tv_2_weekend_use', :units => :hours_per_day
235
+ store 'tv_3_weekday_use', :units => :hours_per_day
236
+ store 'tv_3_weekend_use', :units => :hours_per_day
237
+ store 'computer_use', :units => :hours_per_day
238
+ store 'computer_idle'
239
+ store 'computer_2_use', :units => :hours_per_day
240
+ store 'computer_2_idle'
241
+ store 'computer_3_use', :units => :hours_per_day
242
+ store 'computer_3_idle'
243
+ store 'tool_charging'
244
+ store 'tool_vampires'
245
+ store 'electronic_charging'
246
+ store 'electronic_vampires'
247
+
248
+ # improvements and incentives
249
+ store 'energy_audit'
250
+ store 'energy_audit_year'
251
+ store 'energy_audit_incent'
252
+ store 'energy_audit_incent_year'
253
+ store 'insulation_added'
254
+ store 'insulation_added_year'
255
+ store 'insulation_incent'
256
+ store 'insulation_incent_year'
257
+ store 'caulking_added'
258
+ store 'caulking_added_year'
259
+ store 'caulking_incent'
260
+ store 'caulking_incent_year'
261
+ store 'windows_replaced'
262
+ store 'windows_incent'
263
+ store 'windows_incent_year'
264
+ store 'heater_maintained'
265
+ store 'heater_replaced'
266
+ store 'heater_incent'
267
+ store 'heater_incent_year'
268
+ store 'cooler_central_maintained'
269
+ store 'cooler_central_replaced'
270
+ store 'cooler_central_incent'
271
+ store 'cooler_central_incent_year'
272
+ store 'cooler_ac_replaced'
273
+ store 'cooler_ac_incent'
274
+ store 'cooler_ac_incent_year'
275
+ store 'water_heater_blanket'
276
+ store 'water_heater_incent'
277
+ store 'water_heater_incent_year'
278
+ store 'lights_replaced'
279
+ store 'lights_incent'
280
+ store 'lights_incent_year'
281
+ store 'dishwasher_replaced'
282
+ store 'dishwasher_incent'
283
+ store 'dishwasher_incent_year'
284
+ store 'fridge_replaced'
285
+ store 'fridge_incent'
286
+ store 'fridge_incent_year'
287
+ store 'freezer_replaced'
288
+ store 'freezer_incent'
289
+ store 'freezer_incent_year'
290
+ store 'washer_replaced'
291
+ store 'washer_incent'
292
+ store 'washer_incent_year'
293
+ store 'renewable_energy'
294
+
295
+ # demographics
296
+ store 'own_rent'
297
+ store 'sex'
298
+ store 'employment'
299
+ store 'live_with_spouse'
300
+ store 'race'
301
+ store 'latino'
302
+ store 'education'
303
+ store 'household_size'
304
+ store 'member_1_age'
305
+ store 'member_2_age'
306
+ store 'member_3_age'
307
+ store 'member_4_age'
308
+ store 'member_5_age'
309
+ store 'member_6_age'
310
+ store 'member_7_age'
311
+ store 'member_8_age'
312
+ store 'member_9_age'
313
+ store 'member_10_age'
314
+ store 'member_11_age'
315
+ store 'member_12_age'
316
+ store 'member_13_age'
317
+ store 'member_14_age'
318
+ store 'income'
319
+ store 'income_employment'
320
+ store 'income_retirement'
321
+ store 'income_ssi'
322
+ store 'income_welfare'
323
+ store 'income_investment'
324
+ store 'income_other'
325
+ store 'poverty_100'
326
+ store 'poverty_150'
327
+ store 'public_housing_authority'
328
+ store 'low_rent'
329
+ store 'food_stamps'
330
+
331
+ # who pays bills
332
+ store 'pays_electricity_heat'
333
+ store 'pays_electricity_water'
334
+ store 'pays_electricity_cooking'
335
+ store 'pays_electricity_cool'
336
+ store 'pays_electricity_lighting'
337
+ store 'pays_natural_gas_heat'
338
+ store 'pays_natural_gas_water'
339
+ store 'pays_natural_gas_cooking'
340
+ store 'pays_natural_gas_other'
341
+ store 'pays_fuel_oil'
342
+ store 'pays_propane'
343
+
344
+ # end uses
345
+ store 'electricity_heat'
346
+ store 'electricity_heat_2'
347
+ store 'electricity_cool'
348
+ store 'electricity_water'
349
+ store 'electricity_cooking'
350
+ store 'electricity_other'
351
+ store 'natural_gas_heat'
352
+ store 'natural_gas_heat_2'
353
+ store 'natural_gas_water'
354
+ store 'natural_gas_cooking'
355
+ store 'natural_gas_other'
356
+ store 'propane_heat'
357
+ store 'propane_heat_2'
358
+ store 'propane_water'
359
+ store 'propane_cooking'
360
+ store 'propane_other'
361
+ store 'fuel_oil_heat'
362
+ store 'fuel_oil_heat_2'
363
+ store 'fuel_oil_water'
364
+ store 'fuel_oil_other'
365
+ store 'kerosene_heat'
366
+ store 'kerosene_heat_2'
367
+ store 'kerosene_water'
368
+ store 'kerosene_other'
369
+ store 'wood_heat'
370
+ store 'wood_heat_2'
371
+ store 'wood_water'
372
+ store 'wood_other'
373
+ store 'solar_heat'
374
+ store 'solar_heat_2'
375
+ store 'solar_water'
376
+ store 'solar_other'
377
+ store 'other_heat'
378
+ store 'other_heat_2'
379
+ store 'other_water'
380
+ store 'other_cooking'
381
+
382
+ # consumption
383
+ store 'energy', :from_units => :kbtus, :to_units => :megajoules
384
+ store 'energy_cost', :units => :dollars
385
+ store 'electricity', :units => :kilowatt_hours
386
+ store 'electricity_cost', :units => :dollars
387
+ store 'natural_gas', :from_units => :kbtus, :to_units => :megajoules
388
+ store 'natural_gas_cost', :units => :dollars
389
+ store 'propane', :from_units => :kbtus, :to_units => :megajoules
390
+ store 'propane_cost', :units => :dollars
391
+ store 'fuel_oil', :from_units => :kbtus, :to_units => :megajoules
392
+ store 'fuel_oil_cost', :units => :dollars
393
+ store 'kerosene', :from_units => :kbtus, :to_units => :megajoules
394
+ store 'kerosene_cost', :units => :dollars
395
+ store 'wood', :from_units => :kbtus, :to_units => :megajoules
396
+ end
397
+
398
+ process 'Correct any obvious problems with estimated move-in date' do
399
+ where('year_occupied < year_built').update_all 'year_occupied = year_built'
400
+ end
401
+ end
402
+ end
@@ -0,0 +1,879 @@
1
+ # For parsing the EIA RECS 2009 microdata file
2
+ require 'earth/residence/recs_2009_response'
3
+
4
+ class Recs2009Response::Parser
5
+ AGE = {
6
+ '1' => 1, # Less than 2
7
+ '2' => 3, # 2 to 4
8
+ '3' => 7, # 5 to 9
9
+ '41' => 12, # 10 to 14
10
+ '42' => 17, # 15 to 19
11
+ '5' => 25 # 20 or older
12
+ }
13
+ BOOLEAN = {
14
+ '0' => false,
15
+ '1' => true
16
+ }
17
+ BOOLEAN_NO_NIL = {
18
+ '0' => false,
19
+ '1' => true,
20
+ '-2' => false
21
+ }
22
+ BUILDING_TYPE = {
23
+ '1' => 'Mobile Home',
24
+ '2' => 'Single-family Detached',
25
+ '3' => 'Single-family Attached',
26
+ '4' => 'Apartment <4 units',
27
+ '5' => 'Apartment >5 units'
28
+ }
29
+ CHARGING = {
30
+ '1' => 'Always charging',
31
+ '2' => 'Recharge as needed',
32
+ '3' => 'Both'
33
+ }
34
+ COMPUTER_MONITOR = {
35
+ '1' => 'CRT',
36
+ '2' => 'LCD'
37
+ }
38
+ COMPUTER_TYPE = {
39
+ '1' => 'Desktop',
40
+ '2' => 'Laptop'
41
+ }
42
+ CONDO_COOP = {
43
+ '1' => 'Condo',
44
+ '2' => 'Coop'
45
+ }
46
+ CONVERTED_HOUSE = {
47
+ '1' => true, # house converted to apt bldg that looks like a house
48
+ '2' => false # house converted to apt bldg that looks like apt bldg
49
+ }
50
+ COOLER = {
51
+ '1' => 'Central',
52
+ '2' => 'Window/wall units',
53
+ '3' => 'Central and window/wall units'
54
+ }
55
+ COOLER_USE = {
56
+ '1' => 'Turned on occasionally',
57
+ '2' => 'Turned on quite a bit',
58
+ '3' => 'Turned on just about all summer'
59
+ # '4' => 'Not used at all'
60
+ }
61
+ DEFROST = {
62
+ '1' => 'Manual',
63
+ '2' => 'Frost-free'
64
+ }
65
+ DEVICES = {
66
+ '0' => 0,
67
+ '1' => 2, # 1 to 3
68
+ '2' => 6, # 4 to 8
69
+ '3' => 12 # more than 8
70
+ }
71
+ DRAFTY = {
72
+ '1' => 'All the time',
73
+ '2' => 'Most of the time',
74
+ '3' => 'Some of the time',
75
+ '4' => 'Never'
76
+ }
77
+ DRYER_USE = {
78
+ '1' => 'Every load of laundry',
79
+ '2' => 'Some loads of laundry',
80
+ '3' => 'Infrequent'
81
+ }
82
+ EDUCATION = {
83
+ '0' => 'No schooling completed',
84
+ '1' => 'Kindergarten to grade 12',
85
+ '2' => 'High school diploma or GED',
86
+ '3' => 'Some college, no degree',
87
+ '4' => "Associate's degree",
88
+ '5' => "Bachelor's degree",
89
+ '6' => "Master's degree",
90
+ '7' => 'Professional degree',
91
+ '8' => 'Doctorate degree'
92
+ }
93
+ EMPLOYMENT = {
94
+ '0' => 'Not employed / retired',
95
+ '1' => 'Full-time',
96
+ '2' => 'Part-time'
97
+ }
98
+ FINISHED_SPACE = {
99
+ '0' => 'Unfinished',
100
+ '1' => 'Finished'
101
+ }
102
+ FREEZER_SIZE = {
103
+ '1' => 'Small (14 cu ft or less)',
104
+ '2' => 'Medium (15 to 18 cu ft)',
105
+ '3' => 'Large (19 to 22 cu ft)',
106
+ '4' => 'Very large (more than 20 cu ft)'
107
+ }
108
+ FREEZER_TYPE = {
109
+ '1' => 'Upright',
110
+ '2' => 'Chest'
111
+ }
112
+ FRIDGE_SIZE = {
113
+ '1' => 'Half-size / compact',
114
+ '2' => 'Small (14 cu ft or less)',
115
+ '3' => 'Medium (15 to 18 cu ft)',
116
+ '4' => 'Large (19 to 22 cu ft)',
117
+ '5' => 'Very large (more than 20 cu ft)'
118
+ }
119
+ FRIDGE_TYPE = {
120
+ '1' => 'Full-size, 1 door',
121
+ '3' => 'Half-size / compact',
122
+ '4' => 'Other',
123
+ '5' => 'Full-size, 3+ doors',
124
+ '21' => 'Full-size, 2 doors, freezer beside',
125
+ '22' => 'Full-size, 2 doors, freezer above',
126
+ '23' => 'Full-size, 2 doors, freezer below'
127
+ }
128
+ FUEL = {
129
+ '1' => 'Natural Gas',
130
+ '2' => 'Propane/LPG',
131
+ '3' => 'Fuel Oil',
132
+ '4' => 'Kerosene',
133
+ '5' => 'Electricity',
134
+ '7' => 'Wood',
135
+ '8' => 'Solar',
136
+ '9' => 'District Steam',
137
+ '21' => 'Other'
138
+ }
139
+ GARAGE_SIZE = {
140
+ '1' => 'One-car',
141
+ '2' => 'Two-car',
142
+ '3' => 'Three-car+',
143
+ '4' => 'Carport'
144
+ }
145
+ HEATER = {
146
+ '2' => 'Steam or Hot Water System',
147
+ '3' => 'Central Warm-Air Furnace',
148
+ '4' => 'Heat Pump',
149
+ '5' => 'Built-In Electric Units',
150
+ '6' => 'Floor or Wall Pipeless Furnace',
151
+ '7' => 'Built-In Room Heaters',
152
+ '8' => 'Heating Stove',
153
+ '9' => 'Fireplace',
154
+ '10' => 'Portable Electric Heaters',
155
+ '11' => 'Portable Kerosene Heaters',
156
+ '12' => 'Cooking Stove',
157
+ '21' => 'Other'
158
+ }
159
+ HEATER_PORTION = {
160
+ '1' => 1, # main heater provides almost all space heat
161
+ '2' => 0.75, # main heater provides about 3/4 of space heat
162
+ '3' => 0.5 # main heater provides closer to 1/2 of space heat
163
+ }
164
+ INCENTIVE = {
165
+ '0' => 'None',
166
+ '1' => 'Manfacturer or retailer rebate',
167
+ '2' => 'Utility or energy supplier rebate',
168
+ '3' => 'Tax credit',
169
+ '4' => 'Subsidized loan',
170
+ '5' => 'Weatherization assistance',
171
+ '-8' => 'Refuse',
172
+ '-9' => "Don't Know"
173
+ }
174
+ INCOME = {
175
+ '1' => 1250, # Less than $2,500
176
+ '2' => 3750, # $2,500 to $4,999
177
+ '3' => 6250, # $5,000 to $7,499
178
+ '4' => 8750, # $7,500 to $9,999
179
+ '5' => 12500, # $10,000 to $14,999
180
+ '6' => 17500, # $15,000 to $19,999
181
+ '7' => 22500, # $20,000 to $24,999
182
+ '8' => 27500, # $25,000 to $29,999
183
+ '9' => 32500, # $30,000 to $34,999
184
+ '10' => 37500, # $35,000 to $39,999
185
+ '11' => 42500, # $40,000 to $44,999
186
+ '12' => 47500, # $45,000 to $49,999
187
+ '13' => 52500, # $50,000 to $54,999
188
+ '14' => 57500, # $55,000 to $59,999
189
+ '15' => 62500, # $60,000 to $64,999
190
+ '16' => 67500, # $65,000 to $69,999
191
+ '17' => 72500, # $70,000 to $74,999
192
+ '18' => 77500, # $75,000 to $79,999
193
+ '19' => 82500, # $80,000 to $84,999
194
+ '20' => 87500, # $85,000 to $89,999
195
+ '21' => 92500, # $90,000 to $94,999
196
+ '22' => 97500, # $95,000 to $99,999
197
+ '23' => 110000, # $100,000 to $119,999
198
+ '24' => 200000 # $120,000 or More
199
+ }
200
+ INSULATION = {
201
+ '1' => 'Good',
202
+ '2' => 'Adequate',
203
+ '3' => 'Poor',
204
+ '4' => 'None'
205
+ }
206
+ MEMBER_AGE = {
207
+ '1' => 3, # < 5 years old
208
+ '2' => 7, # 5-9 years old
209
+ '3' => 12, # 10-14 years old
210
+ '4' => 17, # 15-19 years old
211
+ '5' => 22, # 20-24 years old
212
+ '6' => 27, # 25-29 years old
213
+ '7' => 32, # 30-34 years old
214
+ '8' => 37, # 35-39 years old
215
+ '9' => 42, # 40-44 years old
216
+ '10' => 47, # 45-49 years old
217
+ '11' => 52, # 50-54 years old
218
+ '12' => 57, # 55-59 years old
219
+ '13' => 62, # 60-64 years old
220
+ '14' => 67, # 65-69 years old
221
+ '15' => 62, # 70-74 years old
222
+ '16' => 77, # 75-79 years old
223
+ '17' => 82, # 80-84 years old
224
+ '18' => 89 # 85 or more years old
225
+ }
226
+ METRO_MICRO = {
227
+ 'METRO' => 'Metro', # in a census metropolitan statistical area
228
+ 'MICRO' => 'Micro', # in a census micropolitan statistical area
229
+ 'NONE' => nil
230
+ }
231
+ MICROWAVE_USE = {
232
+ '1' => 'Most meals and snacks',
233
+ '2' => 'About half of meals and snacks',
234
+ '3' => 'A few meals and snacks',
235
+ '4' => 'Very little'
236
+ }
237
+ MONTHLY_TIMES = {
238
+ '0' => 0, # Not used
239
+ '1' => 100, # Three or more times a day
240
+ '2' => 61, # Two times a day
241
+ '3' => 30, # Once a day
242
+ '4' => 13, # A few times a week
243
+ '5' => 4, # About once a week
244
+ '6' => 2, # Less than once a week
245
+ '11' => 2, # Less than once a week
246
+ '12' => 4, # Once a week
247
+ '13' => 11, # 2 or 3 times a week
248
+ '20' => 22, # 4 to 6 times a week
249
+ '30' => 35, # At least once each day
250
+ }
251
+ MONTHS_USE = {
252
+ '1' => 2, # 1 to 3 months
253
+ '2' => 5, # 4 to 6 months
254
+ '3' => 8, # 7 to 9 months
255
+ '4' => 11, # 10 to 11 months
256
+ '5' => 12 # All year
257
+ }
258
+ OWN_RENT = {
259
+ '1' => 'Owner',
260
+ '2' => 'Renter',
261
+ '3' => nil
262
+ }
263
+ RACE = {
264
+ '1' => 'White',
265
+ '2' => 'Black / African American',
266
+ '3' => 'American Indian or Alaska Native',
267
+ '4' => 'Asian',
268
+ '5' => 'Native Hawaiian or Pacific Islander',
269
+ '6' => 'Other',
270
+ '7' => 'Multiple'
271
+ }
272
+ RENEWABLE = {
273
+ '0' => 'Off-grid',
274
+ '1' => 'Grid-connected'
275
+ }
276
+ ROOF_MATERIAL = {
277
+ '1' => 'Ceramic or Clay Tiles',
278
+ '2' => 'Wood Shingles/Shakes',
279
+ '3' => 'Metal',
280
+ '4' => 'Slate or Synthetic Slate',
281
+ '5' => 'Composition Shingles',
282
+ '6' => 'Asphalt',
283
+ '7' => 'Concrete Tiles',
284
+ '8' => 'Other'
285
+ }
286
+ SEX = {
287
+ '1' => 'Female',
288
+ '2' => 'Male'
289
+ }
290
+ STORIES = {
291
+ '10' => 1,
292
+ '20' => 2,
293
+ '31' => 3,
294
+ '32' => 4, # Four or more stories
295
+ '40' => 2, # Split-level
296
+ '50' => nil # Other
297
+ }
298
+ TV_SIZE = {
299
+ '1' => '20 inches or less',
300
+ '2' => '21 to 26 inches',
301
+ '3' => '37 inches or more'
302
+ }
303
+ TV_TYPE = {
304
+ '1' => 'CRT',
305
+ '2' => 'LCD',
306
+ '3' => 'Plasma',
307
+ '4' => 'Projection',
308
+ '5' => 'LED'
309
+ }
310
+ TV_USE = {
311
+ '1' => 1,
312
+ '2' => 2,
313
+ '3' => 5,
314
+ '4' => 8,
315
+ '5' => 12
316
+ }
317
+ URBAN_RURAL = {
318
+ 'U' => 'Urban',
319
+ 'R' => 'Rural'
320
+ }
321
+ WALL_MATERIAL = {
322
+ '1' => 'Brick',
323
+ '2' => 'Wood',
324
+ '3' => 'Siding (Aluminum, Vinyl, Steel)',
325
+ '4' => 'Stucco',
326
+ '5' => 'Composition (Shingle)',
327
+ '6' => 'Stone',
328
+ '7' => 'Concrete/Concrete Block',
329
+ '8' => 'Glass',
330
+ '9' => 'Other'
331
+ }
332
+ WASHER_TYPE = {
333
+ '1' => 'Top-loading',
334
+ '2' => 'Front-loading'
335
+ }
336
+ WASHER_TEMP = {
337
+ '1' => 'Hot',
338
+ '2' => 'Warm',
339
+ '3' => 'Cold'
340
+ }
341
+ WASHER_USE = {
342
+ '1' => 3, # 1 load or less each week
343
+ '2' => 13, # 2 to 4 loads each week
344
+ '3' => 30, # 5 to 9 loads each week
345
+ '4' => 54, # 10 to 15 loads each week
346
+ '5' => 70 # More than 15 loads each week
347
+ }
348
+ WATER_HEATER = {
349
+ '1' => 'Storage',
350
+ '2' => 'Tankless'
351
+ }
352
+ WATER_HEATER_SIZE = {
353
+ '1' => 'Small (30 gallons or less)',
354
+ '2' => 'Medium (31 to 49 gallons)',
355
+ '3' => 'Large (50 gallons or more)'
356
+ }
357
+ WINDOW_PANES = {
358
+ '1' => 1,
359
+ '2' => 2,
360
+ '3' => 3
361
+ }
362
+ WINDOWS = {
363
+ '0' => 0, # None
364
+ '10' => 2, # 1 or 2
365
+ '20' => 4, # 3 to 5
366
+ '30' => 8, # 6 to 9
367
+ '41' => 13, # 10 to 15
368
+ '42' => 18, # 16 to 19
369
+ '50' => 25, # 20 to 29
370
+ '60' => 35 # 30 or more
371
+ }
372
+ WINDOWS_REPLACED = {
373
+ '1' => 'All',
374
+ '2' => 'Some',
375
+ '3' => 'None'
376
+ }
377
+ YEAR_INCENTIVIZED = {
378
+ '1' => 2006,
379
+ '2' => 2007,
380
+ '3' => 2008,
381
+ '4' => 2009,
382
+ '5' => 2003, # Prior to 2006
383
+ '6' => 2010
384
+ }
385
+ YEAR_OCCUPIED = {
386
+ '1' => 1925, # Before 1950
387
+ '2' => 1955, # 1950 to 1959
388
+ '3' => 1965, # 1960 to 1969
389
+ '4' => 1975, # 1970 to 1979
390
+ '5' => 1985, # 1980 to 1989
391
+ '6' => 1995, # 1990 to 1999
392
+ '7' => 2002, # 2000 to 2004
393
+ '8' => 2007 # 2005 to 2009
394
+ }
395
+
396
+ # required by remote_table transform
397
+ def initialize(*)
398
+ # nothing to see here
399
+ end
400
+
401
+ def computer_idle(on_off, sleep)
402
+ if BOOLEAN[on_off]
403
+ 'Turned off'
404
+ elsif BOOLEAN[sleep]
405
+ 'Sleep / standby'
406
+ end
407
+ end
408
+
409
+ # Type of garage
410
+ def garage(row)
411
+ if BOOLEAN[row['PRKGPLC1']]
412
+ 'Attached'
413
+ elsif BOOLEAN[row['PRKGPLC2']]
414
+ 'Detached'
415
+ end
416
+ end
417
+
418
+ def heat_cool_coverage(any, all_some, portion)
419
+ case any
420
+ when '0' # no heating or cooling
421
+ 0
422
+ when '1' # some heating or cooling
423
+ case all_some
424
+ when '1' # entire space heated or cooled
425
+ 1
426
+ when '2' # part of space heated or cooled
427
+ case portion
428
+ when '1' # Very Little (1-4%)
429
+ 0.025
430
+ when '2' # Some (5-33%)
431
+ 0.19
432
+ when '3' # About Half (33-66%)
433
+ 0.5
434
+ when '4' # About Three-Quarters (67-95%)
435
+ 0.75
436
+ when '5' # Most of It (96-99%)
437
+ 0.975
438
+ end
439
+ end
440
+ end
441
+ end
442
+
443
+ def numerize(value, negative_interpretation)
444
+ number = value.to_i
445
+ number < 0 ? negative_interpretation : number
446
+ end
447
+
448
+ def oven_type(row)
449
+ if BOOLEAN[row['OVENCLN']]
450
+ case row['TYPECLN']
451
+ when '1'
452
+ 'Continuous self-cleaning'
453
+ when '2'
454
+ 'Manual self-cleaning'
455
+ else
456
+ "Not self-cleaning"
457
+ end
458
+ end
459
+ end
460
+
461
+ def payer(initial, follow_up)
462
+ case initial
463
+ when '1'
464
+ 'Paid by the household'
465
+ when '2'
466
+ 'Included in rent'
467
+ when '3'
468
+ case follow_up
469
+ when '1'
470
+ 'Paid by a relative'
471
+ when '2'
472
+ 'Paid by rental or condo agency'
473
+ when '3'
474
+ 'Paid by some other party'
475
+ end
476
+ end
477
+ end
478
+
479
+ def secondary_heating_systems(row)
480
+ @secondary_heating_systems ||= {
481
+ 'Steam or Hot Water System' => (row['RADFUEL'] if BOOLEAN[row['STEAMR' ]]),
482
+ 'Central Warm-Air Furnace' => (row['FURNFUEL'] if BOOLEAN[row['WARMAIR' ]]),
483
+ 'Heat Pump' => ('5' if BOOLEAN[row['REVERSE' ]]),
484
+ 'Built-In Electric Units' => ('5' if BOOLEAN[row['PERMELEC']]),
485
+ 'Floor or Wall Pipeless Furnace' => (row['PIPEFUEL'] if BOOLEAN[row['PIPELESS']]),
486
+ 'Built-In Room Heaters' => (row['RMHTFUEL'] if BOOLEAN[row['ROOMHEAT']]),
487
+ 'Heating Stove' => (row['HSFUEL'] if BOOLEAN[row['WOODKILN']]),
488
+ 'Fireplace' => (row['FPFUEL'] if BOOLEAN[row['CHIMNEY' ]]),
489
+ 'Portable Electric Heaters' => ('5' if BOOLEAN[row['CARRYEL' ]]),
490
+ 'Portable Kerosene Heaters' => ('4' if BOOLEAN[row['CARRYKER']]),
491
+ 'Cooking Stove' => (row['RNGFUEL'] if BOOLEAN[row['RANGE' ]]),
492
+ 'Other' => (row['DIFFUEL'] if BOOLEAN[row['DIFEQUIP']])
493
+ }.keep_if{|k,v| v}
494
+ end
495
+
496
+ def vampires(charging, unplugging)
497
+ if charging == '1'
498
+ 'Chargers never unplugged'
499
+ else
500
+ case unplugging
501
+ when '1'
502
+ 'Chargers always unplugged'
503
+ when '2'
504
+ 'Chargers never unplugged'
505
+ when '3'
506
+ 'Chargers sometimes unplugged'
507
+ end
508
+ end
509
+ end
510
+
511
+ def year_improved(improvement_age)
512
+ 2009 - improvement_age if improvement_age
513
+ end
514
+
515
+ def apply(row)
516
+ parsed_row = {
517
+ 'area' => row['TOTSQFT'],
518
+ 'bathrooms' => row['NCOMBATH'],
519
+ 'cdd_2009' => row['CDD65'],
520
+ 'cdd_avg' => row['CDD30YR'],
521
+ 'census_region_number' => row['REGIONC'],
522
+ 'census_division_number' => row['DIVISION'],
523
+ 'climate_region_id' => row['Climate_Region_Pub'],
524
+ 'climate_zone_id' => row['AIA_Zone'],
525
+ 'computers' => row['NUMPC'],
526
+ 'cooktops' => row['STOVE'],
527
+ 'cool_area' => row['TOTCSQFT'],
528
+ 'electricity' => row['KWH'],
529
+ 'electricity_cost' => row['DOLLAREL'],
530
+ 'energy' => row['TOTALBTU'],
531
+ 'energy_cost' => row['TOTALDOL'],
532
+ 'fans' => row['NUMCFAN'],
533
+ 'fridges' => row['NUMFRIG'],
534
+ 'fuel_oil' => row['BTUFO'],
535
+ 'fuel_oil_cost' => row['DOLLARFO'],
536
+ 'half_baths' => row['NHAFBATH'],
537
+ 'hdd_2009' => row['HDD65'],
538
+ 'hdd_avg' => row['HDD30YR'],
539
+ 'heat_area' => row['TOTHSQFT'],
540
+ 'household_size' => row['NHSLDMEM'],
541
+ 'id' => row['DOEID'],
542
+ 'kerosene' => row['BTUKER'],
543
+ 'kerosene_cost' => row['DOLLARKER'],
544
+ 'lights_high_use' => row['LGT12'],
545
+ 'lights_low_use' => row['LGT1'],
546
+ 'lights_med_use' => row['LGT4'],
547
+ 'member_1_age' => row['HHAGE'],
548
+ 'other_rooms' => row['OTHROOMS'],
549
+ 'natural_gas' => row['BTUNG'],
550
+ 'natural_gas_cost' => row['DOLLARNG'],
551
+ 'ovens' => row['OVEN'],
552
+ 'propane' => row['BTULP'],
553
+ 'propane_cost' => row['DOLLARLP'],
554
+ 'recs_grouping_id' => row['REPORTABLE_DOMAIN'],
555
+ 'rooms' => row['TOTROOMS'],
556
+ 'stoves' => row['STOVEN'],
557
+ 'tvs' => row['TVCOLOR'],
558
+ 'weighting' => row['NWEIGHT'],
559
+ 'wood' => row['BTUWOOD'],
560
+ 'year_built' => row['YEARMADE']
561
+ }
562
+
563
+ @secondary_heating_systems = nil
564
+ (2..6).each do |i|
565
+ parsed_row.merge!({
566
+ "heater_#{i}" => secondary_heating_systems(row).keys[i - 2],
567
+ "heater_#{i}_fuel" => FUEL[secondary_heating_systems(row).values[i - 2]]
568
+ })
569
+ end
570
+
571
+ parsed_row.merge!({
572
+ 'answering_machine' => BOOLEAN[row['ANSMACH']],
573
+ 'aquarium' => BOOLEAN[row['AQUARIUM']],
574
+ 'apartments' => numerize(row['NUMAPTS'], nil),
575
+ 'attic_type' => FINISHED_SPACE[row['ATTICFIN']],
576
+ 'attic_rooms' => numerize(row['FINATTRMS'], 0),
577
+ 'basement_type' => FINISHED_SPACE[row['BASEFIN']],
578
+ 'basement_rooms' => numerize(row['FINBASERMS'], 0),
579
+ 'bedrooms' => numerize(row['BEDROOMS'], 0),
580
+ 'building_floors' => [numerize(row['NUMFLRS'], nil), STORIES[row['STORIES']]].compact.first,
581
+ 'building_type' => BUILDING_TYPE[row['TYPEHUQ']],
582
+ 'caulking_added' => BOOLEAN[row['INSTLWS']],
583
+ 'caulking_added_year' => year_improved(AGE[row['AGEWS']]),
584
+ 'caulking_incent' => INCENTIVE[row['HELPWS']],
585
+ 'caulking_incent_year' => YEAR_INCENTIVIZED[row['HELPWSY']],
586
+ 'coffee' => BOOLEAN[row['COFFEE']],
587
+ 'computer_idle' => computer_idle(row['PCONOFF1'], row['PCSLEEP1']),
588
+ 'computer_monitor' => COMPUTER_MONITOR[row['MONITOR1']],
589
+ 'computer_type' => COMPUTER_TYPE[row['PCTYPE1']],
590
+ 'computer_use' => TV_USE[row['TIMEON1']],
591
+ 'computer_2_idle' => computer_idle(row['PCONOFF2'], row['PCSLEEP2']),
592
+ 'computer_2_monitor' => COMPUTER_MONITOR[row['MONITOR2']],
593
+ 'computer_2_type' => COMPUTER_TYPE[row['PCTYPE2']],
594
+ 'computer_2_use' => TV_USE[row['TIMEON2']],
595
+ 'computer_3_idle' => computer_idle(row['PCONOFF3'], row['PCSLEEP3']),
596
+ 'computer_3_monitor' => COMPUTER_MONITOR[row['MONITOR3']],
597
+ 'computer_3_type' => COMPUTER_TYPE[row['PCTYPE3']],
598
+ 'computer_3_use' => TV_USE[row['TIMEON3']],
599
+ 'condo_coop' => CONDO_COOP[row['CONDCOOP']],
600
+ 'converted_house' => CONVERTED_HOUSE[row['LOOKLIKE']],
601
+ 'cooking_fuel' => FUEL[row['FUELFOOD']],
602
+ 'cooking_frequency' => MONTHLY_TIMES[row['NUMMEAL']],
603
+ 'cooktop_fuel' => FUEL[row['STOVEFUEL']],
604
+ 'cool_attic_portion' => heat_cool_coverage(row['ATTCCOOL'], row['ATTCCL2'], row['PCTATTCL']),
605
+ 'cool_auto_adjust_day' => BOOLEAN[row['AUTOCOOLDAY']],
606
+ 'cool_auto_adjust_night' => BOOLEAN[row['AUTOCOOLNITE']],
607
+ 'cool_basement_portion' => heat_cool_coverage(row['BASECOOL'], row['BASECL2'], row['PCTBSTCL']),
608
+ 'cool_garage' => BOOLEAN[row['GARGCOOL']],
609
+ 'cool_rooms' => numerize(row['ACROOMS'], 0),
610
+ 'cool_temp_away' => numerize(row['TEMPGONEAC'], nil),
611
+ 'cool_temp_day' => numerize(row['TEMPHOMEAC'], nil),
612
+ 'cool_temp_night' => numerize(row['TEMPNITEAC'], nil),
613
+ 'cooler_ac_age' => AGE[row['WWACAGE']],
614
+ 'cooler_ac_energy_star' => BOOLEAN[row['ESWWAC']],
615
+ 'cooler_ac_incent' => INCENTIVE[row['HELPWWAC']],
616
+ 'cooler_ac_incent_year' => YEAR_INCENTIVIZED[row['HELPWWACY']],
617
+ 'cooler_ac_replaced' => BOOLEAN[row['REPLCWWAC']],
618
+ 'cooler_ac_use' => COOLER_USE[row['USEWWAC']],
619
+ 'cooler_ac_units' => numerize(row['NUMBERAC'], 0),
620
+ 'cooler_central_age' => AGE[row['AGECENAC']],
621
+ 'cooler_central_incent' => INCENTIVE[row['HELPCAC']],
622
+ 'cooler_central_incent_year' => YEAR_INCENTIVIZED[row['HELPCACY']],
623
+ 'cooler_central_maintained' => BOOLEAN[row['MAINTAC']],
624
+ 'cooler_central_replaced' => BOOLEAN[row['REPLCCAC']],
625
+ 'cooler_central_shared' => BOOLEAN[row['ACOTHERS']],
626
+ 'cooler_central_use' => COOLER_USE[row['USECENAC']],
627
+ 'cooling' => BOOLEAN[row['AIRCOND']],
628
+ 'copier' => BOOLEAN[row['COPIER']],
629
+ 'cordless_phone' => BOOLEAN[row['NOCORD']],
630
+ 'crawlspace' => BOOLEAN_NO_NIL[row['CRAWL']],
631
+ 'dehumidifier_use' => MONTHS_USE[row['USENOTMOIST']],
632
+ 'dishwasher_age' => AGE[row['AGEDW']],
633
+ 'dishwasher_energy_star' => BOOLEAN[row['ESDISHW']],
634
+ 'dishwasher_use' => MONTHLY_TIMES[row['DWASHUSE']],
635
+ 'dishwasher_incent' => INCENTIVE[row['HELPDW']],
636
+ 'dishwasher_incent_year' => YEAR_INCENTIVIZED[row['HELPDWY']],
637
+ 'dishwasher_replaced' => BOOLEAN[row['REPLCDW']],
638
+ 'drafty' => DRAFTY[row['DRAFTY']],
639
+ 'dryer_age' => AGE[row['AGECDRYER']],
640
+ 'dryer_fuel' => FUEL[row['DRYRFUEL']],
641
+ 'dryer_use' => DRYER_USE[row['DRYRUSE']],
642
+ 'education' => EDUCATION[row['EDUCATION']],
643
+ 'electricity_heat' => BOOLEAN[row['ELWARM']],
644
+ 'electricity_heat_2' => BOOLEAN[row['ELECAUX']],
645
+ 'electricity_cool' => BOOLEAN[row['ELCOOL']],
646
+ 'electricity_water' => BOOLEAN[row['ELWATER']],
647
+ 'electricity_cooking' => BOOLEAN[row['ELFOOD']],
648
+ 'electricity_other' => BOOLEAN[row['ELOTHER']],
649
+ 'electronic_charging' => CHARGING[row['ELECCHRG']],
650
+ 'electronic_vampires' => vampires(row['ELECCHRG'], row['CHRGPLGE']),
651
+ 'electronics' => DEVICES[row['ELECDEV']],
652
+ 'employment' => EMPLOYMENT[row['EMPLOYHH']],
653
+ 'energy_audit' => BOOLEAN[row['AUDIT']],
654
+ 'energy_audit_incent' => INCENTIVE[row['HELPAUD']],
655
+ 'energy_audit_incent_year' => YEAR_INCENTIVIZED[row['HELPAUDY']],
656
+ 'energy_audit_year' => year_improved(AGE[row['AGEAUD']]),
657
+ 'engine_block_heater' => BOOLEAN[row['DIPSTICK']],
658
+ 'fax' => BOOLEAN[row['FAX']],
659
+ 'fan_use' => COOLER_USE[row['USECFAN']],
660
+ 'food_stamps' => BOOLEAN[row['FOODASST']],
661
+ 'freezers' => numerize(row['NUMFREEZ'], 0),
662
+ 'freezer_age' => AGE[row['AGEFRZR']],
663
+ 'freezer_defrost' => DEFROST[row['FREEZER']],
664
+ 'freezer_incent' => INCENTIVE[row['HELPFRZ']],
665
+ 'freezer_incent_year' => YEAR_INCENTIVIZED[row['HELPFRZY']],
666
+ 'freezer_replaced' => BOOLEAN[row['REPLCFRZ']],
667
+ 'freezer_size' => FREEZER_SIZE[row['SIZFREEZ']],
668
+ 'freezer_type' => FREEZER_TYPE[row['UPRTFRZR']],
669
+ 'freezer_2_age' => AGE[row['AGEFRZR2']],
670
+ 'freezer_2_defrost' => DEFROST[row['FREEZER2']],
671
+ 'freezer_2_size' => FREEZER_SIZE[row['SIZFREEZ2']],
672
+ 'freezer_2_type' => FREEZER_TYPE[row['UPRTFRZR2']],
673
+ 'fridge_age' => AGE[row['AGERFRI1']],
674
+ 'fridge_defrost' => DEFROST[row['REFRIGT1']],
675
+ 'fridge_door_ice' => BOOLEAN[row['ICE']],
676
+ 'fridge_energy_star' => BOOLEAN[row['ESFRIG']],
677
+ 'fridge_size' => FRIDGE_SIZE[row['SIZRFRI1']],
678
+ 'fridge_type' => FRIDGE_TYPE[row['TYPERFR1']],
679
+ 'fridge_2_age' => AGE[row['AGERFRI2']],
680
+ 'fridge_2_defrost' => DEFROST[row['REFRIGT2']],
681
+ 'fridge_2_energy_star' => BOOLEAN[row['ESFRIG2']],
682
+ 'fridge_2_size' => FRIDGE_SIZE[row['SIZRFRI2']],
683
+ 'fridge_2_type' => FRIDGE_TYPE[row['TYPERFR2']],
684
+ 'fridge_2_use' => numerize(row['MONRFRI2'], nil),
685
+ 'fridge_3_age' => AGE[row['AGERFRI3']],
686
+ 'fridge_3_defrost' => DEFROST[row['REFRIGT3']],
687
+ 'fridge_3_energy_star' => BOOLEAN[row['ESFRIG3']],
688
+ 'fridge_3_size' => FRIDGE_SIZE[row['SIZRFRI3']],
689
+ 'fridge_3_type' => FRIDGE_TYPE[row['TYPERFR3']],
690
+ 'fridge_3_use' => numerize(row['MONRFRI3'], nil),
691
+ 'fridge_incent' => INCENTIVE[row['HELPFRI']],
692
+ 'fridge_incent_year' => YEAR_INCENTIVIZED[row['HELPFRIY']],
693
+ 'fridge_replaced' => BOOLEAN[row['REPLCFRI']],
694
+ 'fuel_oil_heat' => BOOLEAN[row['FOWARM']],
695
+ 'fuel_oil_heat_2' => BOOLEAN[row['FOILAUX']],
696
+ 'fuel_oil_water' => BOOLEAN[row['FOWATER']],
697
+ 'fuel_oil_other' => BOOLEAN[row['FOOTHER']],
698
+ 'garage_type' => garage(row),
699
+ 'garage_size' => GARAGE_SIZE[(BOOLEAN[row['PRKGPLC1']] ? row['SIZEOFGARAGE'] : row['SIZEOFDETACH'])],
700
+ 'heat_attic_portion' => heat_cool_coverage(row['ATTCHEAT'], row['ATTCHT2'], row['PCTATTHT']),
701
+ 'heat_auto_adjust_day' => BOOLEAN[row['AUTOHEATDAY']],
702
+ 'heat_auto_adjust_night' => BOOLEAN[row['AUTOHEATNITE']],
703
+ 'heat_basement_portion' => heat_cool_coverage(row['BASEHEAT'], row['BASEHT2'], row['PCTBSTHT']),
704
+ 'heat_garage' => BOOLEAN[row['GARGHEAT']],
705
+ 'heat_rooms' => numerize(row['HEATROOM'], 0),
706
+ 'heat_temp_away' => numerize(row['TEMPGONE'], nil),
707
+ 'heat_temp_day' => numerize(row['TEMPHOME'], nil),
708
+ 'heat_temp_night' => numerize(row['TEMPNITE'], nil),
709
+ 'heater' => [HEATER[row['EQUIPM']], HEATER[row['EQUIPNOHEAT']]].compact.first,
710
+ 'heater_age' => AGE[row['EQUIPAGE']],
711
+ 'heater_fuel' => [FUEL[row['FUELHEAT']], FUEL[row['FUELNOHEAT']]].compact.first,
712
+ 'heater_incent' => INCENTIVE[row['HELPHT']],
713
+ 'heater_incent_year' => YEAR_INCENTIVIZED[row['HELPHTY']],
714
+ 'heater_maintained' => BOOLEAN[row['MAINTHT']],
715
+ 'heater_portion' => HEATER_PORTION[row['EQMAMT']],
716
+ 'heater_replaced' => BOOLEAN[row['REPLCHT']],
717
+ 'heater_shared' => BOOLEAN[row['HEATOTH']],
718
+ 'heater_thermostats' => numerize(row['NUMTHERM'], 0),
719
+ 'heating' => BOOLEAN[row['HEATHOME']],
720
+ 'high_ceiling' => BOOLEAN_NO_NIL[row['HIGHCEIL']],
721
+ 'home_business' => BOOLEAN[row['HBUSNESS']],
722
+ 'home_during_week' => BOOLEAN[row['ATHOME']],
723
+ 'hot_tub_fuel' => FUEL[row['FUELTUB']],
724
+ 'humidifier_use' => MONTHS_USE[row['USEMOISTURE']],
725
+ 'indoor_grill_fuel' => FUEL[row['STGRILA']],
726
+ 'income' => INCOME[row['MONEYPY']],
727
+ 'income_employment' => BOOLEAN[row['WORKPAY']],
728
+ 'income_retirement' => BOOLEAN[row['RETIREPY']],
729
+ 'income_ssi' => BOOLEAN[row['SSINCOME']],
730
+ 'income_welfare' => BOOLEAN[row['CASHBEN']],
731
+ 'income_investment' => BOOLEAN[row['INVESTMT']],
732
+ 'income_other' => BOOLEAN[row['RGLRPAY']],
733
+ 'insulation' => INSULATION[row['ADQINSUL']],
734
+ 'insulation_added' => BOOLEAN[row['INSTLINS']],
735
+ 'insulation_added_year' => year_improved(AGE[row['AGEINS']]),
736
+ 'insulation_incent' => INCENTIVE[row['HELPINS']],
737
+ 'insulation_incent_year' => YEAR_INCENTIVIZED[row['HELPINSY']],
738
+ 'internet' => BOOLEAN_NO_NIL[row['INTERNET']],
739
+ 'kerosene_heat' => BOOLEAN[row['KRWARM']],
740
+ 'kerosene_heat_2' => BOOLEAN[row['KEROAUX']],
741
+ 'kerosene_water' => BOOLEAN[row['KRWATER']],
742
+ 'kerosene_other' => BOOLEAN[row['KROTHER']],
743
+ 'latino' => BOOLEAN[row['SDESCENT']],
744
+ 'levels' => [numerize(row['NAPTFLRS'], nil), STORIES[row['STORIES']]].compact.first,
745
+ 'lights_high_use_efficient' => numerize(row['LGT12EE'], 0),
746
+ 'lights_incent' => INCENTIVE[row['HELPCFL']],
747
+ 'lights_incent_year' => YEAR_INCENTIVIZED[row['HELPCFLY']],
748
+ 'lights_low_use_efficient' => numerize(row['LGT1EE'], 0),
749
+ 'lights_med_use_efficient' => numerize(row['LGT4EE'], 0),
750
+ 'lights_outdoor' => numerize(row['NOUTLGTNT'], 0),
751
+ 'lights_outdoor_efficient' => numerize(row['LGTOEE'], 0),
752
+ 'lights_replaced' => BOOLEAN[row['INSTLCFL']],
753
+ 'low_rent' => BOOLEAN[row['RENTHELP']],
754
+ 'member_2_age' => MEMBER_AGE[row['AGEHHMEMCAT2']],
755
+ 'member_3_age' => MEMBER_AGE[row['AGEHHMEMCAT3']],
756
+ 'member_4_age' => MEMBER_AGE[row['AGEHHMEMCAT4']],
757
+ 'member_5_age' => MEMBER_AGE[row['AGEHHMEMCAT5']],
758
+ 'member_6_age' => MEMBER_AGE[row['AGEHHMEMCAT6']],
759
+ 'member_7_age' => MEMBER_AGE[row['AGEHHMEMCAT7']],
760
+ 'member_8_age' => MEMBER_AGE[row['AGEHHMEMCAT8']],
761
+ 'member_9_age' => MEMBER_AGE[row['AGEHHMEMCAT9']],
762
+ 'member_10_age' => MEMBER_AGE[row['AGEHHMEMCAT10']],
763
+ 'member_11_age' => MEMBER_AGE[row['AGEHHMEMCAT11']],
764
+ 'member_12_age' => MEMBER_AGE[row['AGEHHMEMCAT12']],
765
+ 'member_13_age' => MEMBER_AGE[row['AGEHHMEMCAT13']],
766
+ 'member_14_age' => MEMBER_AGE[row['AGEHHMEMCAT14']],
767
+ 'metro_micro' => METRO_MICRO[row['METROMICRO']],
768
+ 'microwave_defrost' => BOOLEAN[row['DEFROST']],
769
+ 'microwave_use' => MICROWAVE_USE[row['AMTMICRO']],
770
+ 'natural_gas_heat' => BOOLEAN[row['UGWARM']],
771
+ 'natural_gas_heat_2' => BOOLEAN[row['UGASAUX']],
772
+ 'natural_gas_water' => BOOLEAN[row['UGWATER']],
773
+ 'natural_gas_cooking' => BOOLEAN[row['UGCOOK']],
774
+ 'natural_gas_other' => BOOLEAN[row['UGOTH']],
775
+ 'other_heat' => BOOLEAN[row['OTHWARM']],
776
+ 'other_heat_2' => BOOLEAN[row['OTHERAUX']],
777
+ 'other_water' => BOOLEAN[row['OTHWATER']],
778
+ 'other_cooking' => BOOLEAN[row['OTHCOOK']],
779
+ 'outdoor_grill_fuel' => FUEL[row['OUTGRILLFUEL']],
780
+ 'oven_fuel' => FUEL[row['OVENFUEL']],
781
+ 'oven_type' => oven_type(row),
782
+ 'oven_use' => MONTHLY_TIMES[row['OVENUSE']],
783
+ 'own_rent' => OWN_RENT[row['KOWNRENT']],
784
+ 'pays_electricity_heat' => payer(row['PELHEAT'], row['OTHERWAYEL']),
785
+ 'pays_electricity_water' => payer(row['PELHOTWA'], row['OTHERWAYEL']),
786
+ 'pays_electricity_cooking' => payer(row['PELCOOK'], row['OTHERWAYEL']),
787
+ 'pays_electricity_cool' => payer(row['PELAC'], row['OTHERWAYEL']),
788
+ 'pays_electricity_lighting' => payer(row['PELLIGHT'], row['OTHERWAYEL']),
789
+ 'pays_natural_gas_heat' => payer(row['PGASHEAT'], row['OTHERWAYNG']),
790
+ 'pays_natural_gas_water' => payer(row['PGASHTWA'], row['OTHERWAYNG']),
791
+ 'pays_natural_gas_cooking' => payer(row['PUGCOOK'], row['OTHERWAYNG']),
792
+ 'pays_natural_gas_other' => payer(row['PUGOTH'], row['OTHERWAYNG']),
793
+ 'pays_fuel_oil' => payer(row['FOPAY'], row['OTHERWAYFO']),
794
+ 'pays_propane' => payer(row['LPGPAY'], row['OTHERWAYLPG']),
795
+ 'pool' => BOOLEAN_NO_NIL[row['SWIMPOOL']],
796
+ 'pool_fuel' => FUEL[row['FUELPOOL']],
797
+ 'poverty_100' => BOOLEAN[row['POVERTY100']],
798
+ 'poverty_150' => BOOLEAN[row['POVERTY150']],
799
+ 'printers' => numerize(row['PCPRINT'], 0),
800
+ 'propane_heat' => BOOLEAN[row['LPWARM']],
801
+ 'propane_heat_2' => BOOLEAN[row['LPGAUX']],
802
+ 'propane_water' => BOOLEAN[row['LPWATER']],
803
+ 'propane_cooking' => BOOLEAN[row['LPCOOK']],
804
+ 'propane_other' => BOOLEAN[row['LPOTHER']],
805
+ 'public_housing_authority' => BOOLEAN[row['HUPROJ']],
806
+ 'race' => RACE[row['Householder_Race']],
807
+ 'renewable_energy' => RENEWABLE[row['ONSITEGRID']],
808
+ 'roof_material' => ROOF_MATERIAL[row['ROOFTYPE']],
809
+ 'sex' => SEX[row['HHSEX']],
810
+ 'shaded' => BOOLEAN[row['TREESHAD']],
811
+ 'slab' => BOOLEAN_NO_NIL[row['CONCRETE']],
812
+ 'sliding_doors' => numerize(row['DOOR1SUM'], 0),
813
+ 'solar_heat' => BOOLEAN[row['SOLWARM']],
814
+ 'solar_heat_2' => BOOLEAN[row['SOLARAUX']],
815
+ 'solar_water' => BOOLEAN[row['SOLWATER']],
816
+ 'solar_other' => BOOLEAN[row['SOLOTHER']],
817
+ 'live_with_spouse' => BOOLEAN[row['SPOUSE']],
818
+ 'stereo' => BOOLEAN[row['STEREO']],
819
+ 'stove_fuel' => FUEL[row['STOVENFUEL']],
820
+ 'telecommuting' => numerize(row['TELLDAYS'], 0),
821
+ 'toaster' => BOOLEAN[row['TOASTER']],
822
+ 'tool_charging' => CHARGING[row['BATCHRG']],
823
+ 'tool_vampires' => vampires(row['BATCHRG'], row['CHRGPLGT']),
824
+ 'tools' => DEVICES[row['BATTOOLS']],
825
+ 'tv_size' => TV_SIZE[row['TVSIZE1']],
826
+ 'tv_theater' => BOOLEAN[row['TVAUDIOSYS1']],
827
+ 'tv_type' => TV_TYPE[row['TVTYPE1']],
828
+ 'tv_weekday_use' => TV_USE[row['TVONWD1']],
829
+ 'tv_weekend_use' => TV_USE[row['TVONWE1']],
830
+ 'tv_2_size' => TV_SIZE[row['TVSIZE2']],
831
+ 'tv_2_theater' => BOOLEAN[row['TVAUDIOSYS2']],
832
+ 'tv_2_type' => TV_TYPE[row['TVTYPE2']],
833
+ 'tv_2_weekday_use' => TV_USE[row['TVONWD2']],
834
+ 'tv_2_weekend_use' => TV_USE[row['TVONWE2']],
835
+ 'tv_3_size' => TV_SIZE[row['TVSIZE3']],
836
+ 'tv_3_theater' => BOOLEAN[row['TVAUDIOSYS3']],
837
+ 'tv_3_type' => TV_TYPE[row['TVTYPE3']],
838
+ 'tv_3_weekday_use' => TV_USE[row['TVONWD3']],
839
+ 'tv_3_weekend_use' => TV_USE[row['TVONWE3']],
840
+ 'urban_rural' => URBAN_RURAL[row['UR']],
841
+ 'unusual_activities' => BOOLEAN[row['OTHWORK']],
842
+ 'wall_material' => WALL_MATERIAL[row['WALLTYPE']],
843
+ 'washer_age' => AGE[row['AGECWASH']],
844
+ 'washer_energy_star' => BOOLEAN[row['ESCWASH']],
845
+ 'washer_incent' => INCENTIVE[row['HELPCW']],
846
+ 'washer_incent_year' => YEAR_INCENTIVIZED[row['HELPCWY']],
847
+ 'washer_replaced' => BOOLEAN[row['REPLCCW']],
848
+ 'washer_temp_rinse' => WASHER_TEMP[row['RNSETEMP']],
849
+ 'washer_temp_wash' => WASHER_TEMP[row['WASHTEMP']],
850
+ 'washer_type' => WASHER_TYPE[row['TOPFRONT']],
851
+ 'washer_use' => WASHER_USE[row['WASHLOAD']],
852
+ 'water_heater' => WATER_HEATER[row['H2OTYPE1']],
853
+ 'water_heater_age' => AGE[row['WHEATAGE']],
854
+ 'water_heater_blanket' => BOOLEAN[row['WHEATBKT']],
855
+ 'water_heater_fuel' => FUEL[row['FUELH2O']],
856
+ 'water_heater_incent' => INCENTIVE[row['HELPWH']],
857
+ 'water_heater_incent_year' => YEAR_INCENTIVIZED[row['HELPWHY']],
858
+ 'water_heater_size' => WATER_HEATER_SIZE[row['WHEATSIZ']],
859
+ 'water_heater_shared' => BOOLEAN[row['WHEATOTH']],
860
+ 'water_heater_2' => WATER_HEATER[row['H2OTYPE2']],
861
+ 'water_heater_2_age' => AGE[row['WHEATAGE2']],
862
+ 'water_heater_2_fuel' => FUEL[row['FUELH2O2']],
863
+ 'water_heater_2_size' => WATER_HEATER_SIZE[row['WHEATSIZ2']],
864
+ 'water_heaters_storage' => row['NUMH2OHTRS'],
865
+ 'water_heaters_tankless' => row['NUMH2ONOTNK'],
866
+ 'well_pump' => BOOLEAN[row['WELLPUMP']],
867
+ 'window_panes' => WINDOW_PANES[row['TYPEGLASS']],
868
+ 'windows' => WINDOWS[row['WINDOWS']],
869
+ 'windows_incent' => INCENTIVE[row['HELPWIN']],
870
+ 'windows_incent_year' => YEAR_INCENTIVIZED[row['HELPWINY']],
871
+ 'windows_replaced' => WINDOWS_REPLACED[row['NEWGLASS']],
872
+ 'wood_heat' => BOOLEAN[row['WDWARM']],
873
+ 'wood_heat_2' => BOOLEAN[row['WOODAUX']],
874
+ 'wood_water' => BOOLEAN[row['WDWATER']],
875
+ 'wood_other' => BOOLEAN[row['WDOTHUSE']],
876
+ 'year_occupied' => YEAR_OCCUPIED[row['OCCUPYYRANGE']]
877
+ })
878
+ end
879
+ end