Example #1
0
db_session.add_all(subway_delays)
db_session.commit()

#
# POINTS OF INTEREST (YELP)
#

# we do just the normal points of interest first, not groceries/parks/etc

os.chdir(os.path.join(data_base, 'yelp'))

points_of_interest = []

with open('yelp_all_processed.json', 'r') as f:
    dct = json.load(f)

for i, e in enumerate(dct):
    l = Location()
    l.name = e['name']
    l.rank = i + 1
    l.rating = e['rating']
    l.review_count = e['review_count']
    l.address = e['address'][0]
    l.categories = e['categories']
    l.geom = 'POINT ({:.8f} {:.8f})'.format(e['longitude'], e['latitude'])
    points_of_interest.append(l)

db_session.add_all(points_of_interest)
db_session.commit()
#
# POINTS OF INTEREST (YELP)
#

# we do just the normal points of interest first, not groceries/parks/etc

os.chdir(os.path.join(data_base, 'yelp'))

points_of_interest = []

with open('yelp_all_processed.json', 'r') as f:
	dct = json.load(f)

for i, e in enumerate(dct):
	l = Location()
	l.name = e['name']
	l.rank = i + 1
	l.rating = e['rating']
	l.review_count = e['review_count']
	l.address = e['address'][0]
	l.categories = e['categories']
	l.geom = 'POINT ({:.8f} {:.8f})'.format(e['longitude'], e['latitude'])
	points_of_interest.append(l)

db_session.add_all(points_of_interest)
db_session.commit()