Bestra / three-c-beer-cagematch

A web service that pulls ranking data for Ohio breweries from beeradvocate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beer as a (web) service


WAT

This site ranks beers from the 3Cs, Columbus, CLeveland, and Cincinatti via their www.beeradvocate.com ratings. It serves the data out as an array of json objects.

Beers are ranked according to their average rating and the number of votes for each beer.

Usage

You can send a GET request to three-c-brewery-cagematch.herokuapp.com/beers

You'll get back a JSON array with the beer's ranking and the beer's properties. Some of the fields are self-explanatory but here are a few:

rank
This is the weighted rating of the beer. Compared to the beer's average rating it will likely be slightly lower.
beer.rAvg
The average rating for the beer on beeradvocate.
beer.votes
The number of ratings that the beer has been given. rAvg and votes both contribute to the beer's weighted rating.
beer.abv
The beer's alchohol by volume percentaage. Beeradvocate lists many beers' abv as "?", and in that case the abv will be 0.0

There are a few parameters you can specify in order to cull the data and also change the rankings.

cities
An array of city names. If left blank beers from all three Cs are ranked and output. /beers?cities[]=Columbus&cities[]=cleveland
will return beers from just Columbus and Cleveland.
style
A string to filter beer style names by. Style is case sensitive, so if you want IPAs, use /beers?style=IPA
You can find a list of styles on beeradvocate to search from. Your search string will be converted into a regular expression, so match away!
limit
Trims the rankings to the specified number of entries./beers?limit=5 returns the top 5 ranked beers specified.

Specifiying styles and cities will change how the beers are ranked. The cagematch uses the same ranking formula as beeradvocate's top 250 beers, but recalculates the mean list ranking based on the pool of beers that the search comes up with. Thus, you'll see a different ranked score for the same beer in different contexts. The limit simply returns less data after the rankings are calculated.

Details

Results per brewery are cached daily to avoid hitting beeradvocate too much. The Brewery index for each city is always scraped in real-time, though. If there's a network problem you just won't see data for a particular city or brewery. Beeradvocate can get pretty slow at times so be patient and try back later if you're not getting any results.

An Example

I want to see the top ranked beer from IPAs or stouts made in Cleveland and Columbus.

For the given query http://three-c-beer-cagematch.herokuapp.com/beers?cities[]=Columbus&cities[]=cleveland&style=(Stout)|(IPA)&limit=1

[
  {
  "rank":4.353502603069769,
  "beer":{
    "name":"Columbus Bodhi DIPA",
    "style_name":"American Double / Imperial IPA",
    "abv":8.0,
    "rAvg":4.48,
    "votes":327,
    "profile_url":"http://www.beeradvocate.com/beer/profile/341/53187",
    "style_url":"http://www.beeradvocate.com/beer/style/140",
    "brewery_name":"Columbus Brewing Company",
    "city_name":"Columbus"}
  }
]

About

A web service that pulls ranking data for Ohio breweries from beeradvocate


Languages

Language:Ruby 95.7%Language:CSS 2.2%Language:JavaScript 1.8%Language:CoffeeScript 0.3%