Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Reborn IA: Drinks #2191

Merged
merged 9 commits into from Oct 22, 2015
Merged

Reborn IA: Drinks #2191

merged 9 commits into from Oct 22, 2015

Conversation

ozdemirburak
Copy link
Collaborator

What does your Instant Answer do?
Shows cocktail recipes.

What problem does your Instant Answer solve (Why is it better than organic links)?
Makes easier to access cocktail recipes

What is the data source for your Instant Answer? (Provide a link if possible)
TheCocktailDB

Why did you choose this data source?
It was mentioned in the issue #2184, thus stable enough.

Are there any other alternative (better) data sources?
Nope, as far as I know

What are some example queries that trigger this Instant Answer?
how to make a white russian drink, mojito, ingredients of margarita, red eye cocktail

Which communities will this Instant Answer be especially useful for? (gamers, book lovers, etc)
People who love to drink

Is this Instant Answer connected to a DuckDuckHack Instant Answer idea?
https://duck.co/ideas/idea/5129/cocktail-recipes

Which existing Instant Answers will this one supersede/overlap with?
Recipes and maybe Wikipedia as this IA uses list of available drinks within the API for the triggers.

Are you having any problems? Do you need our help with anything?
Nope

What are the terms of use for the API? Will DuckDuckGo need specific authorization (e.g. an API key)? Are there any costs associated with API usage?
No, as far as I know, however within the link, developer mentions about something that makes me feel not sure:

NOTE: If you have a finished project, you will need an API key, please PM me or post in this thread.

What does the Instant Answer look like? (Provide a screenshot for new or updated Instant Answers)
drinks-instant-answer

Checklist

Please place an 'X' where appropriate.

[X] Added metadata and attribution information
[X] Wrote test file and added to t/ directory
[X] Verified that instant answer adheres to design guidelines (https://duck.co/duckduckhack/design_styleguide)
[X] Verified that instant answer adheres to code styleguide (https://duck.co/duckduckhack/code_styleguide)
[] Tested cross-browser compatibility

    Please let us know which browsers/devices you've tested on:
    - Ubuntu 14.04
        [] Google Chrome
        [X] Firefox
        [] Opera
        [] IE 10

    - Windows 8
        [] Google Chrome
        [] Firefox
        [] Opera
        [] IE 10

    - Windows 7
        [] Google Chrome
        [] Firefox
        [] Opera
        [] IE 8
        [] IE 9
        [] IE 10

    - Windows XP
        [] IE 8

    - Mac OSX
        [] Google Chrome
        [] Firefox
        [] Opera
        [] Safari

    - iOS (iPhone)
        [] Safari Mobile
        [] Google Chrome
        [] Opera

    - iOS (iPad)
        [] Safari Mobile
        [] Google Chrome
        [] Opera

    - Android
        [] Firefox
        [] Native Browser
        [] Google Chrome
        [] Opera

IA Page: https://duck.co/ia/view/drinks

# Handle statement
handle query_lc => sub {
my $query = $_;
my @stop_words = ("a", "an", "are", "being", "cocktail", "drink", "for", "how", "in", "ingredient", "ingredients", "is", "make", "making", "mix", "mixing", "needed", "of", "that", "to", "used", "what", "within");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's define this array outside the handle -- no need to re-define it each time the handle executes

@moollaza
Copy link
Member

@ozdemirburak thanks a lot for doing this, and for doing an awesome jobs as well 👍

I've left some feedback for improvements. Visually this is great, I just think we need to reign in the triggering.

Once things are updated please let us know by leaving a comment, so we can review this again. If you have any questions, feel free to ask them here!

@moollaza
Copy link
Member

@Razze can you _please_ put me in touch with the API maintainer? I don't really want to signup for the Kodi forum, but couldn't find him online elsewhere. Would love to get an API key from him!

@ozdemirburak
Copy link
Collaborator Author

@moollaza updated as per your comments.


env.ddg_spice_drinks = function(api_result){

if (!api_result || api_result.error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if drinks is null:

screen shot 2015-09-28 at 4 57 03 pm

@ozdemirburak
Copy link
Collaborator Author

@jagtalon thanks for pointing them out, updated.

@moollaza
Copy link
Member

@ozdemirburak this is looking great. Apologies for the delay. It's now deployed and testable on Beta^ -- Looks like we're having an issue with Beta right now, but I'll put it on my dev machine...

I think for these drinks: https://github.com/ozdemirburak/zeroclickinfo-spice/blob/master/share/spice/drinks/drinks.txt#L17-#L26 we should remove the preceeding a and strip and leading \ba\b from the candidate drink name so it works for all drinks?

Spice.add({
id: 'drinks',
data: drink,
name: "Drinks",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this to Recipes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed this 👍

@daxtheduck daxtheduck deployed to beta.duckduckgo.com October 22, 2015 22:12 Active
@moollaza
Copy link
Member

@ozdemirburak this LGTM 👍

Thanks a lot for contributing (we really appreciate it 😃). We invite you to stick around and comment/help on other PR's & Issues or even submit an Instant Answer!

moollaza added a commit that referenced this pull request Oct 22, 2015
@moollaza moollaza merged commit 2728c95 into duckduckgo:master Oct 22, 2015
@ozdemirburak
Copy link
Collaborator Author

@moollaza Thanks, I've opened an another pull request for improvements.

@zag2me
Copy link

zag2me commented Oct 23, 2015

Awesome work guys, happy to help!

Oh I also run TheAudioDB.com, TheLogoDB.com and TheSportsDB.com if you want some other data sources ;) Also hoping to write a recipe site at some point for food things.

Zag - TheCocktailDB.com

@moollaza
Copy link
Member

Thanks, I've opened an another pull request for improvements.

@ozdemirburak excellent, thanks!

Oh I also run TheAudioDB.com, TheLogoDB.com and TheSportsDB.com if you want some other data sources ;) Also hoping to write a recipe site at some point for food things.

Hey @zag2me great to meet you, and thanks a lot for creating TheCocktailDB! It's awesome to see you have some other API's available!

We could potentially use TheLogoDB to help users search for TV Channel logos (or potentially to supplement other IAs).

Regarding Audio, we have a few different IA's, mostly from LastFM, but we've been looking for alternatives, or more complete sources. It seems like currently MusicBrainz may be the best choice, but we haven't built anything yet.

Regarding Sports, we currently use SportsRadar to provide our existing NFL and MLB IAs (and we have more in the works), but there may yet be a use for that data as well!

Similarly, we currently use Yummly for recipe search, but there may be a niche in the recipe query space that could be handled by another API.

@moollaza
Copy link
Member

@ozdemirburak @zag2me congrats! It's live: https://duckduckgo.com/?q=how+to+mix+a+tom+collins&ia=recipes

Thanks again for taking the time to contribute! We really appreciate it. Feel free to stick around and comment/help on other PR's, tackle open issues or even submit more Instant Answers!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants