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.2.14 lib/earth/locality/state/data_miner.rb
earth-0.2.13 lib/earth/locality/state/data_miner.rb
earth-0.2.12 lib/earth/locality/state/data_miner.rb
earth-0.2.11 lib/earth/locality/state/data_miner.rb
earth-0.2.9 lib/earth/locality/state/data_miner.rb
earth-0.2.8 lib/earth/locality/state/data_miner.rb
earth-0.2.7 lib/earth/locality/state/data_miner.rb
earth-0.2.6 lib/earth/locality/state/data_miner.rb
earth-0.2.5 lib/earth/locality/state/data_miner.rb
earth-0.2.4 lib/earth/locality/state/data_miner.rb
earth-ruby19-0.2.3 lib/earth/locality/state/data_miner.rb
earth-0.2.3 lib/earth/locality/state/data_miner.rb
earth-0.2.2 lib/earth/locality/state/data_miner.rb
earth-0.2.1 lib/earth/locality/state/data_miner.rb
earth-0.2.0 lib/earth/locality/state/data_miner.rb
earth-0.1.4 lib/earth/locality/state/data_miner.rb
earth-0.1.3 lib/earth/locality/state/data_miner.rb
earth-0.1.2 lib/earth/locality/state/data_miner.rb
earth-0.1.1 lib/earth/locality/state/data_miner.rb
earth-0.1.0 lib/earth/locality/state/data_miner.rb