Sha256: e3f7879b9b99f172b00053264826d2babe03e650736ed7dbb926daf0e72d8cfe

Contents?: true

Size: 1.4 KB

Versions: 65

Compression:

Stored size: 1.4 KB

Contents

State.class_eval do
  data_miner do
    schema Earth.database_options do
      string   'postal_abbreviation'
      integer  'fips_code'
      string   'name'
      string   'census_division_number'
      string   'petroleum_administration_for_defense_district_code'
    end
    
    # state names, ansi codes, and postal abbreviations
    import 'the U.S. Census State ANSI Code file',
           :url => 'http://www.census.gov/geo/www/ansi/state.txt',
           :delimiter => '|' do
      key   'postal_abbreviation', :field_name => 'STUSAB'
      store 'fips_code', :field_name => 'STATE'
      store 'name', :field_name => 'STATE_NAME'
    end

    # census divisions
    import 'the U.S. Census Geographic Terms and Definitions',
           :url => 'http://www.census.gov/popest/geographic/codes02.csv',
           :skip => 9,
           :select => lambda { |row| row['FIPS CODE STATE'].to_s.strip != 'X' and row['FIPS CODE COUNTY'].to_s.strip == 'X'} do
      key   'fips_code', :field_name => 'FIPS CODE STATE'
      store 'census_division_number', :field_name => 'Division'
    end
    
    # PADD
    import 'a list of state Petroleum Administration for Defense Districts',
           :url => 'http://spreadsheets.google.com/pub?key=t5HM1KbaRngmTUbntg8JwPA' do
      key   'postal_abbreviation', :field_name => 'State'
      store 'petroleum_administration_for_defense_district_code', :field_name => 'Code'
    end
  end
end

Version data entries

65 entries across 65 versions & 2 rubygems

Version Path
earth-0.4.4 lib/earth/locality/state/data_miner.rb
earth-0.4.3 lib/earth/locality/state/data_miner.rb
earth-0.4.2 lib/earth/locality/state/data_miner.rb
earth-0.4.1 lib/earth/locality/state/data_miner.rb
earth-0.4.0 lib/earth/locality/state/data_miner.rb
earth-0.3.15 lib/earth/locality/state/data_miner.rb
earth-0.3.14 lib/earth/locality/state/data_miner.rb
earth-0.3.13 lib/earth/locality/state/data_miner.rb
earth-0.3.11 lib/earth/locality/state/data_miner.rb
earth-0.3.10 lib/earth/locality/state/data_miner.rb
earth-0.3.9 lib/earth/locality/state/data_miner.rb
earth-0.3.8 lib/earth/locality/state/data_miner.rb
earth-0.3.7 lib/earth/locality/state/data_miner.rb
earth-0.3.6 lib/earth/locality/state/data_miner.rb
earth-0.3.5 lib/earth/locality/state/data_miner.rb
earth-0.3.4 lib/earth/locality/state/data_miner.rb
earth-0.3.3 lib/earth/locality/state/data_miner.rb
earth-0.3.2 lib/earth/locality/state/data_miner.rb
earth-0.3.1 lib/earth/locality/state/data_miner.rb
earth-0.3.0 lib/earth/locality/state/data_miner.rb