|
@@ -4,6 +4,17 @@ from .auth_utils import refresh_access_token
|
|
from .models import UserModel, Location
|
|
from .models import UserModel, Location
|
|
|
|
|
|
|
|
|
|
|
|
+def get_all_location_ids():
|
|
|
|
+ locations = Location.objects.only('location_id')
|
|
|
|
+ ids = [loc.location_id for loc in locations]
|
|
|
|
+ '''
|
|
|
|
+ There is a location which we don't need to add into database.
|
|
|
|
+ It is a Medical Billing Service, That's why it is nothing to do with review.
|
|
|
|
+ '''
|
|
|
|
+ ids.remove('5397588228065547694')
|
|
|
|
+ return ids
|
|
|
|
+
|
|
|
|
+
|
|
def populate_locations():
|
|
def populate_locations():
|
|
access_token, _ = refresh_access_token()
|
|
access_token, _ = refresh_access_token()
|
|
user = User.objects.get(username='admin@ercare')
|
|
user = User.objects.get(username='admin@ercare')
|
|
@@ -18,6 +29,9 @@ def populate_locations():
|
|
for loc in locations:
|
|
for loc in locations:
|
|
# loc['name'] = 'accounts/103266181421855655295/locations/8916258876770296726'
|
|
# loc['name'] = 'accounts/103266181421855655295/locations/8916258876770296726'
|
|
loc_id = loc['name'].split('/')[-1]
|
|
loc_id = loc['name'].split('/')[-1]
|
|
|
|
+ location_ids = get_all_location_ids()
|
|
|
|
+ if loc_id in location_ids:
|
|
|
|
+ continue
|
|
loc_name = loc['locationName']
|
|
loc_name = loc['locationName']
|
|
loc_website = loc['websiteUrl']
|
|
loc_website = loc['websiteUrl']
|
|
loc_display = loc['primaryCategory']['displayName']
|
|
loc_display = loc['primaryCategory']['displayName']
|