We want to be able to show stats about a user's preferences. Maybe we can start with showing favorite and least favorite tags. To implement this, we should do the following:
- Add an endpoint the server for getting stats. For instance
/instagram/stats. All it should do is get the instagram username from the request, call hungryai.something(instagramUsername), and then res.send() the result
- Add a library function to
services/hungryai.js. For instance getStats(instagramUsername), and it'll return a json of a couple stats.
- First get the user associated with that
instagramUsername from Mongo using User.findOne
- Then get all the reviews associated with that from Mongo using using
Review.find
- Then for each review, get all the tags associated with
review.image using GoogleImageTags.findOne. Check models/Tag.js to see what that return value will look like
- For all the tags you get from steps 4+5, return the top 10 with the highest average ratings and the bottom 10 with the lowest average ratings
We want to be able to show stats about a user's preferences. Maybe we can start with showing favorite and least favorite tags. To implement this, we should do the following:
/instagram/stats. All it should do is get the instagram username from the request, callhungryai.something(instagramUsername), and thenres.send()the resultservices/hungryai.js. For instancegetStats(instagramUsername), and it'll return a json of a couple stats.instagramUsernamefrom Mongo usingUser.findOneReview.findreview.imageusingGoogleImageTags.findOne. Checkmodels/Tag.jsto see what that return value will look like