-
Notifications
You must be signed in to change notification settings - Fork 941
Conversation
* Use the Auxiliary Information Box to display the pokemon's stats * Don't display an image if the API doesn't return any sprites for the pokemon * JS refactoring
The IA now displays also a pokemon's description, chosen randomly between a given set. Since the description is served≈ by the API via a different endpoint (/description/{id}) a Pokemon::Description endpoint has been added
Thanks @AkA84! Can you please fill out the pull request template and drop it in this thread? https://github.com/duckduckgo/duckduckgo-documentation/blob/master/templates/pull_request_template.md |
Sure, will do! |
Ok added, now going through your code styleguide and amending bits here and there of the code to be sure it adheres to it |
Done, I also checked the IA with the browsers and devices that I have available at the moment |
many thanks! |
Hi, PokéAPI author here. I'm just commenting to say you've made my day 😂 |
@zekiel concerned about extra traffic hitting the servers - do you cache these queries at all? I should be able to handle quite a bit of traffic (already on 30k+ a day) |
Hey @phalt!
Haha I'm so glad to hear that! I didn't realize you were also responsible for swapi.co which I believe someone else is planning on integrating into an Instant Answer 👍
Yes, absolutely! We can cache this for as long as you'd like. Seeing as this stuff is pretty static we can increase the caching as much as you'd like. 1 week? 1 month? @AkA84 All that needs to be done is to set More details: https://duck.co/duckduckhack/spice_advanced_backend#caching |
@moollaza Any reasonable caching is fine. As I said - the tough little server I have this running on can take upwards of 30k hits a day with no problems, so scaling it a bit more shouldn't be too hard. If it get bad, who can I email? |
@phalt sounds good! If you need anything, feel free to email me: [email protected] |
Done!
@phalt I'm really happy to hear that! Since you're here 😄 a couple of things:
|
|
I am so glad that this is being added to Duckduckgo, but in the example(pokemon pikachu, bulbasaur pokemon) you have to add the word Pokemon. Is there any way that the word Pokemon could be made not mandatory?(all you have to do is search "pikachu" or "buizel") |
@kasarov55555 that is something that aimed at when I started working on the IA, but I wouldn't know how it worked if you didn't provide a static "hook" for the IA to be triggered with. At the same time I see that there is for example the Definition IA that although it lists a series of triggers, it still shows up if you simply write a word (for example it works with both "awesome definition" and "awesome") I'd really like the IA to be triggered by queries like "pikachu" or "pikachu stats", but being the first time I develop one I'd need the help from the DDG guys :) |
@AkA84 I've been following this PR and it looks awesome! Great to see the API owner is here too 👍
You could get this IA triggering on just a pokemon name "pikachu" however that would require maintaining a list of all known names and slurping that for use as triggers. An example is the Airlines IA which uses a list of known Airline in a text file The only issues I see with doing this is the maintainability, e.g if more pokemon are created the list needs updating. I've also noticed there seems to be an internal IA using the "Pokemon Encyclopedia" as a source which is triggered by name https://duckduckgo.com/?q=Buizel&ia=about |
@MrChrisW thanks!
As you said I don't think it's very maintainable and the list of pokemon is quite long! Also, if you need to manually amend a list, where's the fun in that 😄 I'm still curious about how the Dictionary IA works, because it seems to be triggered even without any static trigger in the query!
Mmm this is not good, I see a bit of overlapping here :-/ |
Exactly! Best to let the API handle the updating 😉
I'm guessing that's due to internal triggers configured by DDG, specificity these triggers may detect if a dictionary link is returned in the SERP and then the Dictionary IA is called. (I'm just guessing)
Not to worry, I'm sure @moollaza will know what to do! 😃 |
# Triggers | ||
triggers startend => "pokemon"; | ||
|
||
spice to => 'http://pokeapi.co/api/v1/pokemon/$1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a /
at the end of $1
because http://pokeapi.co/api/v1/pokemon/pikachu redirects to it. We can't handle redirects in production machines unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Done. I've also added a bit of padding so that the image has a bit of room and doesn't end up too close to the border
Well actually this is how it's shown by default by the infobox, it's just how the DDG built-in template works, so I assume that it's implemented like this in another IA at least? I would like to keep the Evolves into line in the infobox if possible as I think it belongs there at this point (for now I moved it at the top of the list so the misalignment doesn't happen in the middle of it). One possible solution would be to make visible by default the little arrow that you get when hovering over the link, and that would solve the alignment problem and also it would make more obvious to the user that that's actually a link. But I'd need also @moollaza approval for that I think since it's overriding the default behaviour. Something like this: What do you think? Thanks! |
@AkA84 unfortunately, that would break our conventions. Currently, for our info pane, we have IAs that: --but never both. But here's another suggestion: what if we put the type inside the info pane, and move the evolution grouping into the byline? So, in your example, it might look like: What do you think? PS: Oh, one more thing -- I think we can disable the self-linking in the title. |
@abeyang ok i moved things around as suggested! One thing though about the image: I added a bit of padding around it because of the background colour, but now it doesn't look good on mobile as on smaller screens the image has a fixed height I wanted to take a look at how things are done in the IAs you put screenshot of before but with none of them I managed to get the result on the right column, I just see the image full-width. Could you help me with this?
I'm not sure how to do this, the link is applied automatically it seems |
@AkA84 I just found out that you can automatically produce the white background/border for an image if you set It also seems to handle mobile images better: |
@moollaza oh that's great, I'll try it out as soon as I can thanks! Was this documented somewhere? |
@AkA84 sadly not -- I wasn't even aware of that one! Don't worry though, we're going to be doing a big overhaul of the docs. So soon nothing will be a mystery any more! |
Looks good! /cc @moollaza |
[Instant Answer] Pokemon info
Oh my GOSH does this work now? :) |
@phalt apparently it's live https://duckduckgo.com/?q=pikachu+pokemon&ia=pokedex ! 😄 |
@AkA84 Woo! |
@AkA84 you beat me to it! It went live today 👍 Thanks again for taking the time to contribute! We really appreciate it. Feel free to stick around and comment/help on other PR's & Issues or even submit more Instant Answers! |
I've seen an uptick in hits (now around 100k a day, was at around 40k) and the server is handling it just fine :) |
@phalt that's awesome -- I'm wondering if we're severely over triggering now though. I just realized we're not checking to see if the remainder is only a single word -- we should probably do that so we don't send you API request for irrelevant queries like "pokemon movie release date" All Pokemon names are a single word right? i.e. if the remainder has a space in it, we can bail? /cc @AkA84 |
@moollaza Yes, no spaces. Single word. |
@moollaza any news on when the IA will be back live? Is there anything i can do on my end? |
Sorry for the delay. It will be live again with the next deploy, that should be some time this week! |
What does your Instant Answer do?
It provides basic information and stats about a given pokemon
What problem does your Instant Answer solve (Why is it better than organic links)?
At a glance the user gets:
I think that's a good amount of information that the user gets before he/she even clicks any of the search results
What is the data source for your Instant Answer? (Provide a link if possible)
http://pokeapi.co/
According to the API author, API V1 should get deprecated this year and replaced by V2 (source). "Deprecated" in this case just means that the V1 will be rendered stable and it won't receive any more updates. I haven't found any information about the new API, but nothing prevents the IA to use V1 for now and then upgrade to V2 once it's out
Why did you choose this data source?
It's a nice, RESTful, widely used API
Are there any other alternative (better) data sources?
I kinda quickly settled on pokeapi since it seemed pretty good, but as far as I can tell I haven't found a decent competitor for it
What are some example queries that trigger this Instant Answer?
pokemon pikachu, bulbasaur pokemon
Which communities will this Instant Answer be especially useful for? (gamers, book lovers, etc)
Pokemon lovers!
Is this Instant Answer connected to a DuckDuckHack Instant Answer idea?
https://duck.co/ideas/idea/4921/pok-mon-info
Which existing Instant Answers will this one supersede/overlap with?
None, as far as I know
Are you having any problems? Do you need our help with anything?
record
template, but I couldn't figure out how to have it render a non-escaped string, which is necessary to have the link to the pokemon's evolution (i know aboutHandlebars.SafeString
method but it doesn't seem to work as I suspect it's not something that the template expect to receive). I thought it would be cool thing to have since it allows the user to jumps back and forth different pokemon's evolutions, so for now I recreated therecord
mark-up while waiting to get some feedback from you.cw
wrapper is supposed to also get an.has-aux
class to prevent it, but I'm not sure how to add thatWhere did you hear about DuckDuckHack? (For first time contributors)
It popped up in conversation about privacy issues, and I found it quite interesting. It wasn't though until recently that I found out about your IA, and I'm really fascinated by the concept
What does the Instant Answer look like? (Provide a screenshot for new or updated Instant Answers)
Checklist
Please place an 'X' where appropriate.