Due: Saturday March 2.
Submission link: http://crowdlab.soe.ucsc.edu/crowdrank4/submission/submit/6
In this homework, we will extend the multi-button application created in Homework 2 to communicate with a server.
The application must continuously maintain and update a location estimate.
You walk around, and switch on the Tagger app, which acquires your position, and downloads from the server a list of taggings, which it displays as a list sorted by distance from you. So you read, for instance,
(Yes, unfortunately, no tag filtering yet). As you walk around, every few seconds or so, those distance estimates are updated.
You come across a pothole, and you tag it by pressing the "Pothole" button on your phone (as in HW2, you have three buttons with labels on them, and one that leads you to a place where you can define a tag). This adds the pothole to your list, and also uploads it to the server.
Then, you come across a place selling roasted chestnuts, and you want to tag it. The tag "Chestnuts" is not labeling any of your buttons, so you press the "Other" button, you enter "Chestnut" as the label for a button, and once you go back to the original screen, the tag Chestnut and its coordinates have already been uploaded, and now "Chestnut" labels one of the three buttons.
Upon startup, and periodically when the location changes, the application must query the server and download a number of taggings that are close to the location of the user. To do so, you can use this server call:
URL: http://crowdlab.soe.ucsc.edu/tagstore/default/get_tags.json
Parameters:
lat_min
lat_max
lng_min
lng_max
n_taggings
token = "CMPS121_yehaa"
optional: username = ... (will cause only tags created by this username to be returned)
Return:
A json list of dictionaries with fields:
"lat"
"lng"
"tag"
"nick"
Sample output:
{"tags": [{"lat": 100.0, "nick": "--anonymous--", "lng": 120.0, "tag": "pothole"}, {"lat": 100.0, "nick": "eduardo", "lng": 120.0, "tag": "pothole"}]}
The tags can be displayed in the usual list format, from the closest, to the farthest away. You should at least display Distance, Bearing, Tag, and Nickname of the tagger.
Users should be able to add tags. This is done by pressing one of the tag buttons, as in Homework 2. You should add the tag to the local list on the phone (to confirm to the user that the tag has been added), and you should upload the tag using this server call:
URL: http://crowdlab.soe.ucsc.edu/tagstore/default/add_tagging.json
Parameters:
lat
lng
token = "CMPS121_yehaa"
user = (your username)
tag
Return: the id of the created tagging.
Sample output:
{"id": 7}
To check that the tag has been uploaded, you can look at the output of the call, or do a get_tags call using a lat/lng rectangle that includes the uploaded tag.
(this part is not required for this homework; I may put it back in one of the future ones)
Somewhere in a menu or setting button, users should be able to change their nickname:
URL: http://crowdlab.soe.ucsc.edu/tagstore/default/set_nickname.json
Parameters:
user = (your username)
nick = (your new nickname)
token = "CMPS121_yehaa"
Sample output:
{"nick": "PeterPan"}
When a user defines a new tag, it may be useful to have a list of tag names, with their popularity, e.g. to suggest what tags to use. Obtain the list of tags in use with:
URL: http://crowdlab.soe.ucsc.edu/tagstore/default/get_popular_tags.json
Parameters:
token = "CMPS121_yehaa"
Return: A JSON dictionary giving the popularity of the tags.
Sample output:
{"popular_tags": [{"cnt": 12, "name": "pothole"}, {"cnt": 2, "name": "firestation"}]}