This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import csv | |
# select file to parse | |
list_directory = '/Users/ali/Documents/Roadtrippers/Hackday/May2021/' | |
csv_name = 'hackday_websites_to_parse.csv' | |
csv_path = list_directory + csv_name | |
#create list for imported data | |
l = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> Place.find(66539011).diffs | |
Place Load (1.8ms) SELECT "places".* FROM "places" WHERE "places"."enabled" = 't' AND "places"."id" = 66539011 LIMIT 1 | |
Diff Load (4.8ms) SELECT "diffs".* FROM "diffs" WHERE "diffs"."diffable_id" = 66539011 AND "diffs"."diffable_type" = 'Place' | |
=> #<ActiveRecord::Associations::CollectionProxy [ | |
#<Diff id: 3921064, diffable_id: 66539011, diffable_type: "Place", details: {"locations"=>{"changes"=>[{"id"=>[nil, 48405877], "loc"=>[nil, "POINT (-109.48819 38.64933)"], "city"=>[nil, "Moab"], "state"=>[nil, "UT"], "country"=>[nil, "USA"], "address1"=>[nil, "Moab Field Office"], "address2"=>[nil, "82 East Dogwood"], "place_id"=>[nil, 66539011], "postal_code"=>[nil, "84532"]}], "deleted"=>[]}}, created_at: "2019-06-24 13:28:25", updated_at: "2019-06-24 13:28:25", organization_id: 1000, action: "U", app_key_id: nil>, | |
#<Diff id: 3918026, diffable_id: 66539011, diffable_type: "Place", details: {"details"=>{"wifi"=>[nil, false], "chain"=>[nil, false], "accessible"=>[nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create local temp table sample_canonicals on commit preserve rows as | |
( | |
with canonicals as | |
( | |
select c.id as canonical_place_id, | |
count(distinct place_id) as places | |
from canonical_places c inner join place_mappings m on c.id = m.canonical_place_id | |
where enabled | |
group by c.id | |
order by random() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"total_results": 25, "results": [{"reviews_count": 3, "mapicon": "public", "sq_img": "https://d29ytkmnbun2ys.cloudfront.net/photos/4/8/4857/120249/sq/seawall-campground.jpg?v=1490799564", "place_visible": true, "iconcolor": "269f4f", "id": 4857, "address_line1": "668 Seawall Rd.", "title": "Seawall Campground", "is_touched": false, "place_title": "Acadia National Park", "cell": {"avg_sprint4g_signal": null, "avg_sprint_extended_signal": null, "avg_verizon4g_signal": null, "avg_sprint3g_signal": null, "avg_tmobile3g_signal": null, "avg_att4g_signal": 2, "avg_tmobile4g_signal": null, "avg_verizon3g_signal": null, "avg_att_extended_signal": null, "avg_att3g_signal": null, "avg_tmobile_extended_signal": null, "avg_verizon_extended_signal": null}, "stars": 3, "latitude": 44.240814, "is_verified": null, "price": "$$$", "phone1": "207.244.3600", "last_review_title": "30 minutes from more scenic part of Acadia National Park ", "distance_from_query": 3.3282922513262503, "slug": "seawall-campground", "star_rating": 1. |