Class: Eaternet::Agencies::Multco Deprecated

Inherits:
Lives_1_0::Adapter show all
Includes:
Loggable
Defined in:
lib/eaternet/agencies/multco.rb

Overview

Deprecated.

In May, the County stopped publishing data from the source app which this code relies on. Additionally, the County plans to shut down the legacy app entirely at some point. We're planning a new version of this code which will use the County's new information portal.

A Multnomah County (Portland area) Oregon data source for restaurant health inspections.

It produces output in the LIVES 1.0 open data standard developed by Yelp and the cities of San Francisco and New York.

Instance Method Summary collapse

Methods included from Loggable

#logger

Methods inherited from Lives_1_0::Adapter

#legends

Instance Method Details

#businessesObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/eaternet/agencies/multco.rb', line 25

def businesses
  @businesses ||= multco_get_index do |struct|
    Eaternet::Lives_1_0::Business.new do |b|
      b.business_id = struct['orig_key']
      b.address = struct['address']
      b.city = struct['city']
      b.state = 'OR'
      b.name = struct['name']
      b.postal_code = struct['zipcode']
    end
  end
end

#feed_infoObject



50
51
52
53
54
55
56
57
58
# File 'lib/eaternet/agencies/multco.rb', line 50

def feed_info
  Eaternet::Lives_1_0::FeedInfo.new do |fi|
    fi.feed_date = Date.today
    fi.feed_version = '1.0'
    fi.municipality_name = 'Multnomah County, Oregon'
    fi.municipality_url = 'https://multco.us/services/restaurants'
    fi.contact_email = '[email protected]'
  end
end

#inspectionsObject



38
39
40
41
42
# File 'lib/eaternet/agencies/multco.rb', line 38

def inspections
  @violations = []
  import_inspections_and_capture_violations.map { |struct| try_to_create_inspection(struct) }
    .compact
end

#violationsObject



44
45
46
47
48
# File 'lib/eaternet/agencies/multco.rb', line 44

def violations
  inspections if @violations.nil?
  @violations.map { |struct| try_to_create_violation(struct) }
    .compact
end