Sha256: 3a9a0f7a4d9a8493fe0e441dc925b9cef81045866e4bdcb240b081d249d3918c
Contents?: true
Size: 828 Bytes
Versions: 11
Compression:
Stored size: 828 Bytes
Contents
ResidenceAppliance.class_eval do data_miner do schema Earth.database_options do string 'name' float 'annual_energy_from_electricity' string 'annual_energy_from_electricity_units' end process "Derive from residential energy consumption survey responses" do ResidentialEnergyConsumptionSurveyResponse.run_data_miner! ResidentialEnergyConsumptionSurveyResponse.column_names.select { |column| column.match(/annual.*_count/) }.map { |column| column.gsub '_count', '' }.each do |appliance_name| appliance = find_or_create_by_name appliance_name appliance.annual_energy_from_electricity = ResidentialEnergyConsumptionSurveyResponse.weighted_average "annual_energy_from_electricity_for_#{appliance_name.pluralize}" appliance.save! end end end end
Version data entries
11 entries across 11 versions & 1 rubygems