User's reviews or ratings to OpenStreetMap objects? - google-places-api

I have downloaded an OpenStreetMap data. This data contain useful information like spatial coordinates and the textual description of many objects. For example, the hotel Park Hyatt at coordinates (25.2435938, 55.3328381) is a spatial object stored in OpenStreetMap dataset.
I have to associate the spatial object (i.e. Park Hyatt) to a user review. It can be a user evaluation (i.e. "good" or "bad") or a user rating (like 5/10).
So, I am looking for a public dataset with user reviews/ratings of places stored in OpenStreetMap.
Until now, I have found the Google Places API. I can solve my problem using it, but it has access limits. I will need some time to obtain all ratings I need. So, I am wondering if already exists any dataset with user ratings to OpenStreetMap Objects.

Related

Storing contents/references of the graph nodes on a graph db

I am building a social network natured web app. there are a number of related entitites like publishers, users, publications, posts, comments; with relations like subscribe, like, share, comment, friend, follow, work, author. Also as usual there is content of some of the entities lie contents of publications, posts, comments.
Publications and Posts are similar and just like classical social posts with more than one text or one media files. And Publications, Posts, and Comments will be ever increasing and will reach high numbers.
I plan to use Cayley db maybe dependence on Postgresql.
My so far complete tuples describing relations of entitites are so:
publisher -publish- publication
user -subscribe- publisher
user -comment- publication
user -like- publication
user -share- publication
user -post- post
user -friend- user
user -comment- post
user -like- post
user -share- post
publisher -follow- publisher
user -work- publisher
user -author- publication
The question is:
Where to store my posts/comments, which have also content such as one to many text fields and media files, and will be liked, shared, and commented by users?
Should I store posts/comments in graph database, if so should I store content or store only a reference and store content in another database, table or document? Regarding quantities of these entities will reach large numbers.
Stumbled upon this open question and thought I try to answer it for future reference.
And of course it totally depends on your implementation and the requirements.
Comments you can store in Cayley, but I would leave images/video or other media out of it. Just store a URI to the specific resource or an UUID for the object in another datastore.
Also for comments; you could store the UUID/ID for the comment in your graphdb and store the actual comment in Postgres or even in a file on disk (just as an example).
I personally prefer to keep my graphdb as small as possible and store actual content in a different storage.

RethinkDB query OrderBy distances between central point and subtable of locations

I'm fairly new to RethinkDB and am trying to solve a thorny problem.
I have a database that currently consists of two kinds of account, customers and technicians. I want to write a query that will produce a table of technicians, ordered by their distance to a given customer. The technician and customer accounts each have coordinate location attributes, and the technicians have a service area attribute in the form of a roughly circular polygon of coordinates.
For example, a query that returns a table of technicians whose service area overlaps the location of a given customer looks like this:
r.db('database').table('Account')
.filter(r.row('location')('coverage').intersects(r.db('database')
.table('Account').get("6aab8bbc-a49f-4a9d-80cc-88c95d0bae8d")
.getField('location').getField('point')))
From here I want to order the resulting subtable of technicians by their distance to the customer they're overlapping.
It's hard to work on this without a sample dataset so I can play around. I'm using my imagination.
Your Account table stores both of customer and technician
Technician document has field location.coverage
By using intersect, you can returns a list of technician who the coverage locations includes customer location.
To order it, we can pass a function into orderBy command. With each of technican, we get their point field using distance command, return that distance number, and using that to order.
r.db('database').table('Account')
.filter(
r.row('location')('coverage')
.intersects(
r.db('database').table('Account').get("6aab8bbc-a49f-4a9d-80cc-88c95d0bae8d")('location')('point')
)
)
.orderBy(function(technician) {
return technician('location')('point')
.distance(r.db('database').table('Account').get("6aab8bbc-a49f-4a9d-80cc-88c95d0bae8d")('location')('point'))
})
I hope it helps. If not, let's post some sample data here and we can try figure it out together.

Google Places API Attributes

I'm trying to determine if the Google Places API is suitable for a restaurant review website I'm working on (disclaimer: I'm not a developer so please excuse my lack of knowledge here).
Specifically, looking at https://developers.google.com/places/documentation/details for support, I'm trying to determine if the Places API includes the following restaurant-specific attributes in its database that we could query: cuisine type (i.e. Indian, Brunch, American) and/or neighborhood (i.e. Marina, Mission, Financial District). As an example in Layman's terms, if we were to use the Google Places API, would users on our site be able to search for Indian restaurants in the Financial District and see restaurants that meet that criteria?
Thanks,
Jaydon
You'd have to make a search using the 'type' restaurant and enter in the search the term indian, as for the location you could use a radius
In layman's terms yes you can, but the neighborhood would be determinated from one central location in a radius format (wouldn't fallow the specific outline of the actual neighborhood) and the type of food would have to be included in the search terms, you could automatically add that, in other words, you can ask the end user to specify the cuisine he is looking for (multi choice) that way you add that cuisine automatically within the search terms.

Solving the location-based app data problem

I'm trying to build a very simple location-based app and I have all of these services at my disposal (Foursquare API, SimpleGeo, Google Places, etc). All seem to provide me a list of venues (bars, coffee shops, stores, etc) near a given longitude latitude. This is great but once the users see the venues, they will be able to write reviews about each venue (for example). Now, what do I do with this data?
User ID (users for my app)
Venue Name (retrieved from Foursquare API)
Longitude, Latitude
Foursquare Venue ID
Review
Do I store this in my database? What happens if the venue name changes on the Foursquare servers? If I don't store this in my database, I'd have to do a lookup to retrieve the venue name and details every single time I want to return a list of reviews in the area. Can someone offer some advice on how to conceptually design a venue-based location app. Thanks.
Store the essential 3rd party info in your database but treat it as a cache. Have a background task that checks for updates every few minutes, days, or weeks depending on the likelyhood & severity of changes. In between updates the user may get stale data but hey, that's life... at least they got it fast. In doing your updates, don't update everything at once or you'll run quickly into API throttling limits.

MongoDB GridFS one-to-one query effeciency in Ruby

I'm using MongoDB w/ Sinatra for an iPhone app.
I have a users MongoDB collection and a picture GridFS collection. Each user has one picture, so, initially, I just set the ObjectId for the picture to be the same as the corresponding user. That made it easy to, given the user's ObjectId, get the picture of that user with just one query. Then, I was planning to store the MD5 hash of the picture in the user object so that the iPhone would know to download the picture only if the MD5 hash had changed. This would work, but I had to modify the Grid Ruby class to get the MD5
But then, Kyle Banker suggested that I just store the picture_id, instead of the MD5, in the user object. But, if I do that, given a user ObjectId, I'd have to first query the picture_id from the user, and then query the picture (2 queries). Is there a way, in one query, to get the picture given a user's ObjectId? Reading up on GridFS indexes, I think there's a way to store the user's ObjectId in the meta data of the picture and then set an index on that field. That way, I could do it in one query. If that's correct, what's the code look like to do that in Ruby?
Alas, should I even bother? I could just as easily use the picture_id to query the picture, which is what I'll do for now, but it'd also be nice, from a syntactical perspective, to be able to query the picture (in one indexed/fast query) by the user_id. Kinda like Facebook's graph api lets you do, e.g., http://graph.facebook.com/mattdipasquale/picture.
Sure. Like you suggest, just store the user_id somewhere in the picture's file object, and build an an index on that field.

Resources