Skip to content

Commit

Permalink
Allow geocoding in debug
Browse files Browse the repository at this point in the history
Geocoding is an expensive process, and sometimes we want to be able to
run local ETL scripts that generate geo data but don't actually run
against a geocoder.  The `debug` flag enables this functionality.

This is intended to only be used for local testing, and the flag may
disappear in future.

Issue #139
  • Loading branch information
slifty committed Sep 16, 2021
1 parent a79a51e commit 1384661
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions etl/etl/competition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,7 @@ def __init__(
new_column_name,
address_pattern,
geocoder,
debug=False,
):
"""Takes:
1. The name of the new column.
Expand All @@ -1315,6 +1316,7 @@ def __init__(
self.new_column_name = new_column_name
self.address_pattern = address_pattern
self.geocoder = geocoder
self.debug = debug

def column_names(self):
return [self.new_column_name]
Expand All @@ -1325,6 +1327,9 @@ def cell(self, proposal, column_name):
if (full_address == ''):
return ""

if (self.debug):
return "0,0"

try:
geocode_result = self.geocoder.geocode(full_address)
if (geocode_result is None):
Expand Down

0 comments on commit 1384661

Please sign in to comment.