cobalt-uoft / cobalt

Open data APIs for interfacing with public information from the University of Toronto.
https://cobalt.qas.im
MIT License
98 stars 20 forks source link

Resurrect the Food API and implement the endpoints #22

Closed qasim closed 8 years ago

qasim commented 8 years ago

https://github.com/cobalt-uoft/cobalt/tree/master/api/food is where the food API is located. It was abandoned.

It doesn't have a scraper, but map.utoronto.ca is your best friend to implement one at https://github.com/cobalt-uoft/uoft-scrapers/issues/15.

kashav commented 8 years ago

Scrapers are ready to be used.

I've also started work on the endpoints here. Datasets are currently not available for the food json so I'm using this. Import the collection with:

mongoimport --db cobalt --collection foods --file ./path/to/food.json 
qasim commented 8 years ago

Sweet! We will ship 0.4.0 after cobalt-uoft/uoft-scrapers@0.2.0 is shipped, at that point the scrapers will be active for food in the MongoDB collection called food (no s).

kashav commented 8 years ago

I was originally using food, but whenever I tried accessing the endpoint, it'd create a new collection named foods.

I think it's something that Mongoose does automatically.

kashav commented 8 years ago

It looks like we can override that by setting our own name:

new Schema({..}, { collection: 'food' })

http://stackoverflow.com/questions/10547118/why-does-mongoose-always-add-an-s-to-the-end-of-my-collection-name

qasim commented 8 years ago

Hmmmmmm.... maybe we should have it as foods then, just to stay consistent. My bad.

kashav commented 8 years ago

The food endpoints are nearly complete, including filter (this one may need to be revised). The initial documentation is done as well.

I also had to change the scraper a bit so that tags were all lowercase (i'll make a PR when it's finalized). Here's the updated food data for testing.

qasim commented 8 years ago

Submit a PR when you're ready, also a few examples of how to use the filter endpoint. Then we can go over if it's ideal or can be tweaked. Everything's looking good! I'll be busy this week so 0.4.0 probably won't be out the door for another few days (since I still have to finish up that textbook scraper).

qasim commented 8 years ago

Merged #47. Once you've made a PR for the documentation, I will merge it when 0.4.0 ships.