Skip to content

Commit

Permalink
Don't Geocode in ingestor to avoid exceeding quota #709
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Nov 9, 2022
1 parent bb201e3 commit 144233c
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lib/ingestors/event_ingestion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,7 @@ def convert_event_types(input)
end

def convert_location(input)
# puts "convert_location(#{input})"
result = nil

# search for locations
locations = Geocoder.search(input)
if !locations.nil? and locations.size > 0 && (!locations.first.nil? and !locations.first.address.nil?)
# puts "address: #{locations.first.address.inspect}"
result = locations.first.address
end

# check substring
if result.nil? or result['country'].nil?
stripped = strip_first_part input
result = convert_location(stripped.lstrip) if !stripped.nil? and stripped.size > 0
end

result
input
end

def strip_first_part(input)
Expand Down

0 comments on commit 144233c

Please sign in to comment.