Autocomplete v Nearby Search? - google-places-api

I am building an app that will require extensive use of the autocomplete function and have currently implemented under Nearby Search. I recently learned however that this is the priciest option given its high cost + associated Contact and Atmospheric data imposed costs.
I am therefore looking for a good option to get relevant autocomplete search results based on the users location without the need for 'Nearby search'. I care about the UX and thus want to avoid people scrolling too much to find a place near them. The only field I need is name & potentially address.
I tried Nearby search, if I understand correctly this is the only way to get autocomplete predictions based on where you physically are located - I have now learned that this is too expensive however

Autocomplete and Nearby Search are entirely different operations and APIs, you can combine both to build a user-friendly experience but they each play a very different role.
Place Autocomplete provide predictions of places based on the user's input, i.e. characters the enter into an input field. These predictions can be biased, even restricted, to a small area around the user's location, to increase the chances that they will represent places near to the user. Depending on whether places far away from the user are acceptable or useful, or not, you can use one or the other:
locationbias if predictions far away are acceptable and useful, e.g. a user searching for a place that is not necessaraly where they are, or in situations where the user location is either not available or not very precise, e.g.
user wants to find a place to go to
user location is obtained from geolocating their IP address
user location is obtained from geolocating their cell towers
locationrestriction if only very nearby predictions are acceptable and user location is known to be very precise (e.g. GPS or other high-precision sources). This would make sense in mobile applications when the user location is provided (by the phone's OS) with a small radius (e.g. under 100 m.) and the user really just wants to find places that describe where they are now. Even then, beware that some places can be bigger than you'd expect, e.g. airports include runways.
Note on billing: Place Autocomplete can be free under specific conditions: when your application implements session tokens and there is a Place Details request at the end of the session, in which case Place Details is billed and Autocomplete is not. However, even if your application implements session tokens, each time a user doesn't pick a prediction, Autocomplete is billed as a session without Details. And in the simpler case, if your application does not implement session tokens, all Autocomplete is billed as per-request (and Place Details is billed separately, on top of that).
Nearby Search can provide nearby places (and can rankby=distance) based on only the user's location and without user's input. This can be used to show an initial list of places (e.g. the nearest 5 places) even before the user starts typing. There a few caveats:
results depends heavily on the user location being very precise
results will only include establishment places, i.e. business, parks, transit stations
If you'd want addresses instead of businesses, you could use reverse geocoding instead of Nearby Search, with the caveat that this can return results that are near/ish and don't necessarily represent the exact place where the user is at. This is more useful when you want to find addresses around a location; they may include the actual address of that location, but that is not guaranted.

Related

Laravel/MySQL implementing recommendation/collab filtering system

I’ve created a script that lists articles, and register when the user skips or clicks on the link. I want to show the user further links based on what they’ve already shown interest in.
Each link has associated categories, keywords and authors. So I have some texture to the data. And of course other users who’ll be clicking on links.
My thought was to use openCF, but wondering if it’ll be fast enough eg find current ratings -> send current user ratings -> fetch from MySQL.
Is there a better way to do this than MySQL without relying on a 3rd party API (like say Recombee or AWS)?
I’ve tried recombee in the past, and the results are good, but end up with duplication and unnecessary cost.

Parse SDK - similarTo type of query

I have an app in iOS and android and I'm getting the user's location in both of them! With CoreLocation for iOS and Google Maps in android... After the location retrieval, we apply reverse geocoding, to get the locality out of them... Once we do, we perform equalTo queries to find photos of a specific location...
The thing is, there are occasions where the locality of iOS, is slightly different to android's! For example, "Palaiochori" in iOS and "Paleochori" in android! Observe that two letters are different!
So, whereas the location is the same in both devices, the equalTo query will obviously fail!
What I want to know, is if there is any way to create a type of query, where we don't check for equality. Instead, we check for similarity!
Notice, that we do use cloud code, so any server-side solution is acceptable and preferred!!
Clearly the location name can not guarantee uniqueness. Two possible solutions:
Ensure consistency of your database
Store a GeoPoint for these locations. When you already have Palaiochori in your database and a user finds himself in Paleochori, before saving a new object, run a whereNear() query to see if you have near places for that location.
If you have results within a reasonable radius, ask the user: Do you mean <list of near places>? The user will likely recognize the place with a similar name, and tap on it. This way you avoid duplication.
Use a consistent location database
As soon as you have lat/lng, you could use Google Places API to ask for places near that location. Google will return a Place object with a unique placeId that you can store in your database. The id is guaranteed to remain the same and can be used for your queries reliably.

irrelevant messages

i am thinking of making a website..
bt how can i make sure that when a user who is asking some question is nt using any abusive language or the message is totally subject oriented..
i m nt talking about spams..i know about captcha and all..
what i am asking is how can i keep an eye on human activity[in this case the messages sent] and at the same time providing the user his complete privacy!
One word... manually.
They're on the web, they already don't have complete privacy.
Offer the community the means to police themselves, whether by explicitly appointing moderators (like most bulletin boards), allowing them to decide who they can and cannot see (like social media sites), or collaborative moderation (like here).
You can set up a system where comments/posts must be approved by a moderator before being allowed to be posted. I believe Wordpress can do this.
There are curse-word filtering libraries available in most languages, usually complete with the ability to customize the words that are filtered out.
In order to filter spam, there are things like bayesian spam filters which attempt to determine whether a message is spam based on keywords in the response. This really isn't something you would want to attempt to do yourself.
Another thing to look at is Markov Chains. They are designed to generate strings of seemingly valid text based on the probability that any given word is followed by any other particular word. Using a reverse process you can attempt to determine if a string of text is valid by checking whether the words used are following by other "on-topic" words.
This would be very difficult as well.
In order to keep the privacy of the users, you could use combinations of these three tests to create a threshold. That is, you will examine no messages unless they reach a high curse/spam/off-topic score. At that point, those messages will be manually checked to see if they are appropriate.
There currently is no way to have a 100% automated process that won't block valid messages and let invalid ones through.
how can i keep an eye on human activity
Your answer lies here. I don't quite understand what you're getting at about privacy though.

Tuftian design for usernames display

I'm working on a website with a major social networking component.
I want the short username display (1 icon (maybe 2) + a styled username) to indicate:
presence (active, idle, away, offline) - font weight
avatar (autogen or uploaded) - 16x16px prefixed icon
explicit relationship to current user (followee, follower, mutual friend, FOAF, none) - hue?
implicit relationship to current user (scalar based on level of interaction) - saturation?
predicted match (multiscalar based on AI) - replaces avatar icon?
More info and details will be in a tooltip. This core part will be displayed all over the place (think e.g. the styling of usernames in StackOverflow comments, not in post signatures), and therefore needs to be compact and elegant. It doesn't need to show these data perfectly - that's what the tooltip is for - but it should give at least a subtle indication.
"Explicit relationship" means Facebook/Twitter-type "friending". This is more a permissions thing than a real "relationship" one per se.
One security feature it gives is to help prevent someone from trying to fool you with a username that looks similar to one of your friends' - you'll notice that they are implicitly colored as unrelated to you. Explicit status also affects what actions are available in the tooltip (e.g. you can't friend a friend, or poke a non-friend).
"Implicit relationship" means e.g. the difference between the 2 people you talk to all the time, the 10 you have regular contact with, the 50 you listed as your "friend" but never talk to, and the 50 you don't (yet) list as your "friend" but have talked to.
"Predicted liking" is the output of a very complex backend AI, à la OKCupid's "match score"; its purpose is to gently nudge you towards talking to people you'll probably like more. In the zero-knowledge-about-you case, it reduces to a Slashdot-style "objective" karma rating. I may also want to display some semi-categorical hints, like whether the AI thinks you'll find this person 'funny' vs 'interesting'.
How can I indicate indicate the things above in a maximally graceful way?
It might not be a good idea to show so many things at once in the small amount of space you will probably allocate to the display of the username. I think, at best you can show 3-4 things at once without confusing the user. More than that, and the user will be confused as to what is what. The task of remembering will defeat all usability aspects.
Another way to show all the stuff would be using a popup-like thing, but even that is not a good idea for the amount of information that you want to show :( I think you will probably be better off if you can simplify the problem so that you end up with fewer variables.

International Phone and Address Data?

I guess this is a multi-part question. I am building a membership site and want to have the accounts as international as possible.
What is the best way to collect phone numbers on a form that allows for international numbers? I'm not worried about storing them, just collection and validation. What I have now is a drop down with a country list that will add the country code, and then the number itself with validation for us/can/uk based on the country code, and then the extension. These will be stored as strings in 3 fields for cc/number/ext Does anyone have a better, solid solution for this, or perhaps seen one in action anywhere?
Ditto for addresses. What is the best way to go? Address/City/State/Zip/Country or just lines? I would like to be able to sort by these, so a single text field isn't a very good solution, though it is the most flexible.
This is also important because we may be sending actual mail to our members. I am put in mind of a few members I've had for other services that had addresses in countries I had never heard of, that even the woman at the post office couldn't tell if they were formatted correctly.
I want to have geodata in the db, at least country/state, for things like populating a state dropdown after selecting a country, field standardization, etc. Does anyone know of a great database that can be used as the geodata base of an app?
Phone number validation - I'm not sure if I'd spend a lot of time on this. Numbering schemes change quite often (for example, during the time I lived in the UK, the phone numbers for London area codes changed at least once, with another change shortly before I moved there) and in Germany it is (or at least used to be) quite common to increase the number of available phone numbers on a given exchange by taking an old number and tacking an extra digit or two at the end. So any assumption about a given phone number format will change and you'll end up playing catch-up. If you insist on splitting the phone number into international/area code/main number you'll probably find that this is a very country-specific way of representing the information so you'll need an input mask pretty much for every country and specific validation rules. Not to mention that in places like Germany, an area code can have between two and four digits etc...
Regarding postal addresses, the most important suggestion I have is to ensure that you can accept non-numeric post/zip codes, otherwise you won't be able to handle addresses in Canada and the UK (and possibly other places). This is a bit of a hobby horse of mine as I've had a few issues with websites in other countries that simply refused to let me put in a non-numeric post code and I had to resort to faxing over my address information as I couldn't fill in the online application form. In my book that's bad karma if you allow international customers....
Also, assuming the existence of certain parts of the address (state/county, for example) and requiring them is usually more of a headache than it's worth. I'd be tempted to offer the standard house number + street (combine them, different languages put the house number in different places so separating them out is not a good idea IMHO unless you know how to reassemble them correctly, plus sometimes you'll end up with a house name instead of a number), town and zip/post code, possibly with an optional county/state field. If you want to be really helpful to you international audience, offer a free-form, single text entry field for those addresses that don't conform to our "standard" assumptions of how an address looks. And please make them big enough so people with quite long addresses don't run out of space...
There is an international standard for telephone numbers, but it leaves a lot of breathing room. Separators are not mandatory, but are restricted to space, period, and hyphen. Round brackets (aka parentheses) are to be put around digits which are optional depending on where you are dialling from. For example, the area code is optional in some areas. I would provide a text field and let the user enter their number however they want.
For addresses, provide lots of fields and don't restrict too much. House numbers sometimes contain letters. Road types are sometimes written in full, and other times abbreviated. (St = Street, Ave = Avenue, etc.) I would provide drop-downs where possible (state/province), but allow freeform input when you don't have a list. When the user is entering their address, it's ok to validate for security risks, but you might want to leave geographical validation until later. For example, if the user enters a postal code of T8N 4E3 and selects Ontario as their province, the address is not valid because the given postal code is for Alberta. Display a friendly message to the user letting them know that they need to correct their address or contact you if it's correct (possible bug in your code).
Address - just remember not everywhere you got states and ZIP codes. and if you got ZIP codes they can be in diffrent format ([0-9]{2}-[0-9]{3} here). (edit: usually postal address with 2 address lines, city, state (optional), zip code (optional) and country is ok).
So is with geodata - you can make sequential dropdowns with states and cities but guess you won't cover every city. Why not show a piece of google maps and allow the users to click there to mark their position?

Resources