Sha256: 1ca05feebfb5b7fd0c9b8d794c1bcbe86604b60b219dcd2d19d10b39792da4ce

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

Airline.class_eval do
  # for errata
  class Airline::Guru
    def not_expressjet?(row)
      not row['Description'] =~ /expressjet/i
    end
  end
  
  data_miner do
    process "Start from scratch" do
      delete_all
    end
    
    import "the BTS unique carrier code lookup table",
           :url => 'http://www.transtats.bts.gov/Download_Lookup.asp?Lookup=L_UNIQUE_CARRIERS',
           :errata => { :url => "file://#{Earth::ERRATA_DIR}/airline/bts_carrier_codes_errata.csv", :responder => 'Airline::Guru' } do
      key 'name',             :synthesize => proc { |row| row['Description'].split("|")[0] }
      store 'secondary_name', :synthesize => proc { |row| row['Description'].split("|")[1] }
      store 'bts_code', :field_name => 'Code'
    end
    
    import "a Brighter Planet-curated list of airlines and codes not included in our proprietary sources",
           :url => 'https://spreadsheets.google.com/spreadsheet/pub?key=0AoQJbWqPrREqdGJoaFpENXRqMEM2NW42am5tNURGU2c&output=csv' do
      key 'name'
      store 'secondary_name', :nullify => true
      store 'iata_code',      :nullify => true
      store 'icao_code',      :nullify => true
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.12.3 lib/earth/air/airline/data_miner.rb
earth-0.12.2 lib/earth/air/airline/data_miner.rb
earth-0.12.1 lib/earth/air/airline/data_miner.rb
earth-0.12.0 lib/earth/air/airline/data_miner.rb