Skip to content

Commit

Permalink
Issue mozilla-mobile#25: Add fn to write ta to db.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcomella committed Jan 31, 2017
1 parent bbe7bee commit 32665cc
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion scripts/prox_crosswalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"""
from __future__ import print_function

from app import util
from app import geo, util
from app.constants import _tablePrefix
from app.providers import tripadvisor as ta
from app.providers import yelp
from config import FIREBASE_CONFIG
from scripts import places_missing_provider_data as missing_data
import pyrebase

_CROSSWALK_PATH = _tablePrefix + 'crosswalk/'
Expand Down Expand Up @@ -177,3 +178,19 @@ def verify_yelp_ids_to_tripadvisor_ids(yelp_ids):

return {'not_missing_ta': not_missing_out,
'missing_ta': missing_out}


def write_places_missing_ta(center, radius_km):
# TODO: code clean up. log missing places? is this needed?
# TODO: atomic write?
place_id_missing_ta = missing_data.get_places_missing_provider_data(center, radius_km,
check_missing_ta=True, check_missing_wiki=False, check_missing_web=False)
yelp_ta_map = yelp_ids_to_tripadvisor_ids(place_id_missing_ta)
write_to_db(yelp_to_ta=yelp_ta_map)


def write_all_places_ta(center, radius_km):
# TODO: code clean up. Is this needed?
place_ids = geo.get_place_ids_in_radius(center, radius_km)
yelp_ta_map = yelp_ids_to_tripadvisor_ids(place_ids)
write_to_db(yelp_to_ta=yelp_ta_map)

0 comments on commit 32665cc

Please sign in to comment.