Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix requirements, app_config #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion geocoder/app_config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ DB_USER = 'datamade'
DB_PW = ''
DB_HOST = 'localhost'
DB_PORT = '5432'
DB_NAME = 'sunshine'
DB_NAME = 'geocoder'

DB_CONN='postgresql+psycopg2://{0}:{1}@{2}:{3}/{4}'\
.format(DB_USER, DB_PW, DB_HOST, DB_PORT, DB_NAME)

# if no password, the conn_string should be changed to just
# 'postgresql+psychopg2://{0}'.format(DB_NAME)

SECRET_KEY = 'super secret key'

# See: https://pythonhosted.org/Flask-Cache/#configuring-flask-cache
Expand Down
8 changes: 4 additions & 4 deletions linkNewData.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sqlalchemy as sa

from geocoder.app_config import DB_CONN

def checkForTable(engine, table_name):
try:
Expand All @@ -22,7 +22,7 @@ def trainIncoming(name):
import simplejson as json
import dedupe

engine = create_engine('postgresql://localhost:5432/geocoder')
engine = create_engine(DB_CONN)

deduper = DatabaseGazetteer([{'field': 'complete_address', 'type': 'Address'}],
engine=engine)
Expand Down Expand Up @@ -71,7 +71,7 @@ def trainIncoming(name):
def blockIncoming(name, train):
from geocoder.deduper import StaticDatabaseGazetteer

engine = create_engine('postgresql://localhost:5432/geocoder')
engine = create_engine(DB_CONN)

with open('geocoder/data/dedupe.settings', 'rb') as sf:
deduper = StaticDatabaseGazetteer(sf, engine=engine)
Expand Down Expand Up @@ -170,7 +170,7 @@ def blockIncoming(name, train):
if args.link:
from geocoder.deduper import AddressLinkGazetteer

engine = create_engine('postgresql://localhost:5432/geocoder')
engine = create_engine(DB_CONN)

sql_table = checkForTable(engine, args.name)

Expand Down
8 changes: 5 additions & 3 deletions loadAddresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import sqlalchemy as sa
from geocoder.data_loader import ETLThing
from geocoder.app_config import DB_CONN

class CookCountyETL(ETLThing):

Expand Down Expand Up @@ -194,7 +195,7 @@ class SuburbsETL(CookCountyETL):
cook_county_data_portal = 'https://datacatalog.cookcountyil.gov/api/geospatial/%s?method=export&format=Original'

if args.load_data:
engine = create_engine('postgresql://localhost:5432/geocoder')
engine = create_engine(DB_CONN)
connection = engine.connect()

chicago = ChicagoETL(connection, 'chicago_addresses')
Expand Down Expand Up @@ -223,7 +224,8 @@ class SuburbsETL(CookCountyETL):
import simplejson as json
import dedupe

engine = create_engine('postgresql://localhost:5432/geocoder')
from geocoder.app_config import DB_CONN
engine = create_engine(DB_CONN)

deduper = DatabaseGazetteer([{'field': 'complete_address', 'type': 'Address'}],
engine=engine)
Expand Down Expand Up @@ -255,7 +257,7 @@ class SuburbsETL(CookCountyETL):
if args.block:
from geocoder.deduper import StaticDatabaseGazetteer

engine = create_engine('postgresql://localhost:5432/geocoder')
engine = create_engine(DB_CONN)

with open('geocoder/data/dedupe.settings', 'rb') as sf:
deduper = StaticDatabaseGazetteer(sf, engine=engine)
Expand Down
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
numpy==1.9.2
dedupe==0.8.0.1.7
dedupe-variable-address==0.0.4
dedupe==1.4.15
dedupe-variable-address==0.0.7
Flask==0.10.1
psycopg2==2.6.1
csvkit==0.9.1
requests==2.7.0
simpledbf==0.2.6
pytz==2016.6.1
numpy==1.11.1