Sha256: 920a946a6020036d3770754966c0bdd3e48fd30cc6ba0cfe013ae616c17601a9

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

require 'earth/locality/data_miner'

ElectricUtility.class_eval do
  data_miner do
    process "make sure green button adoption is populated" do
      GreenButtonAdoption.run_data_miner!
    end

    import 'EIA Form 861 records from 2010 (revised)',
           :url => 'http://www.eia.gov/Ftproot/pub/electricity/f86110.zip',
           :filename => 'file1_2010.xls',
           :skip => 7,
           :errata => { :url => "file://#{Earth::ERRATA_DIR}/electricity/electric_utility/eia_errata.csv" } do
      key   'eia_id',                    :field_name => 'UTILITY_ID'
      store 'name',                      :field_name => 'UTILITY_NAME'
      store 'state_postal_abbreviation', :field_name => 'MAIL_STATE',    :nullify => true
      store 'nerc_region_abbreviation',        :synthesize => proc { |row| (first_nerc = row['NERC_LOCATION'].match(/^(\w+)/))? first_nerc.captures[0] : nil }
      store 'second_nerc_region_abbreviation', :synthesize => proc { |row| (second_nerc = row['NERC_LOCATION'].match(/^\w+ ?[&,\/] ?(\w+)$/)) ? second_nerc.captures[0] : nil }
    end

    import 'Aliases', :url => 'https://docs.google.com/spreadsheet/pub?key=0AtyCBJLCFHlwdEM5WjVxRjBKWVJRcTJ3c1BhUnlSVXc&single=true&gid=0&output=csv' do
      key 'eia_id', :field_name => 'utility_id'
      store 'nickname', :field_name => 'alias'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/electricity/electric_utility/data_miner.rb
earth-0.12.3 lib/earth/electricity/electric_utility/data_miner.rb
earth-0.12.2 lib/earth/electricity/electric_utility/data_miner.rb
earth-0.12.1 lib/earth/electricity/electric_utility/data_miner.rb
earth-0.12.0 lib/earth/electricity/electric_utility/data_miner.rb
earth-0.11.20 lib/earth/electricity/electric_utility/data_miner.rb
earth-0.11.19 lib/earth/electricity/electric_utility/data_miner.rb