Goodies have full support for templates, and we'd like to make sure all Goodies are using our full templates. We provided the "simple structured_answer" as a way to get them using basic templates before they had full template support and now the time has come to upgrade them all.
Change the returned structured_answer object (in one of the .pm files below) to match the new format, which specifies a template and the data
Nearly all of these Goodies should be able to use our simple text template and should return a structured_answer that looks like the one, returned by the PigLatin Goodie in PigLatin.pm.
structured_answer for a given query. Test the IA locally with DuckPAN to make sure it still looks good and the tests pass.
You can run the test file with duckpan test:
Example:
Anagram.pm => duckpan test Anagram
AspectRatio.pm => duckpan test AspectRatio
You can test the visual display using duckpan server. You'll want to try some of the queries in the test file and make sure the visuals look good. Ideally identical to how they currently look on the live site.
@GuiltyDolphin has made a great Pull Request that demonstrates the necessary changes for the Anagram Instant Answer:

When updating the test file, it will make things _much_ easier if you create a small function that generates a structured answer object. This way you won't need to manually type out the full structured answer we expect for each individual query.
@GuiltyDolphin has done this in the Anagram PR as well:


Some of these IAs may actually be offline right now and so you won't be able to trigger them on DuckDuckGo.com. Once you've made a Pull Request we will deploy it to beta.duckduckgo.com so you can view your changes in a production environment
Get coding and make a Pull Request.
Be sure to include the link to the related Instant Answer Page in your PR Comment. This is required for us to be able to deploy your PR to Beta and ultimately merge it. For example, the anagram PR links to https://duck.co/ia/view/anagram.
Also, make sure you mention this issue in your PR. That way we can keep track of all the PR's in here as well. Something like "Updates Anagram Goodie Re: #2767" is good.
Here's the list of IA's that need to be converted. If you'd like to work on one, please leave a comment letting everyone know, so we can avoid and duplicated efforts.
/cc @duckduckgo/community-leaders
@moollaza Calculator is done in #1927 :wink: I'll tick it off.
@duckduckgo/community-leaders I'd just like to add something to this (optional - but _please_ do it). During the conversion, make a function for creating the template in the tests. It is so difficult to wade through tests that define the structured answer _every_single_time_! See for example, this code, which lays out the tests in a fairly concise manner.
@moollaza I'll do Anagram, seeing as it's first.
@moollaza I'll do Anagram, seeing as it's first.
@GuiltyDolphin Thanks!
@moollaza I'll do CalcRoots too.
Oh, boy, this could be interesting :wink:
For all yea in @duckduckgo/duckduckhack-contributors, we've got a lot of these to get through. Anyone interested in taking one up?
Me! Where/how can I get started?
I have lots of free time at the office. Can I can take a few if I can get a handle on the first one.
@faustow @w2pc Heey!
Make sure you've got a passing familiarity with the docs first, make sure you check out the section on templates (that is what we are converting _to_).
If you look at #2769 and #2775, those show the general conversion we want to make (conversion to template, and update tests to easier to maintain format if possible).
If you get stuck at all just ping me on Slack or in your PR.
I have lots of free time at the office. Can I can take a few if I can get a handle on the first one.
@w2pc that'd be great! Thanks for helping out. Ping us on Slack if you need help :+1:
@faustow I've updated the description with some detailed instructions, let us know if that helps!
It does! Thanks a lot @moollaza
I would like to work on BirthStone.
Hi,
I'm working on EmailValidator.pm, and found a limitation on Goodie.pm (/home/codio/perl5/perls/perl-5.18.2/lib/site_perl/5.18.2/DDG/Test/Goodie.pm line: 65).
Current test can only handle Regex/-ANY- pattern for one dimension structured_answer. But the new template is two dimension. So tests use Regex/-ANY- will always fail.
Should we update Goodie.pm to handle multi-dimensional structured_answer?
@lamanh There is a PR for this already duckduckgo/duckduckgo#172. Hopefully that will enable regex matching arbitrarily deep.
I would like to work on Aspect Ratio.
I would like to work on Base please.
I will pick Average, Binary and Bitsum please.
I will pick BRT, CalendarConversion and CallingCodes please.
@Mylainos Hehe, thanks for all this! I imagine you're getting a pretty good feel for the available templates and options now, huh?
@GuiltyDolphin Oh yes! Now I know a lot of templates like 'text' and ... all the options that come with... I think I master the templates.
I will wait for BRT because of #2863
I will take Chars, CoffeeToWaterRatio and Coin please :)
Apparently CoffeeToWaterRatio have been already done here #2838 by @lamanh.
So for using regex when testing templates one should use Test::Deep ? It don't work for me...
Hey, I've done HexToASCII.pm in the pull above
I'll take Coin.pm as well if that's cool.
Thank you @dbech - that sounds great! I've updated the description.
I'm highly interested to work on FlipText.
I'd like to pick CoffeeToWaterRatio
hm, CoffeeToWaterRatio seems to be already done on open PR #2819.
Please assign CountryCodes, EmailValidator, and RandomNumber to me.
I'm working on ZappBrannigan.pm.
@NaveenKarippai I guess EmailValidator is being worked on, https://github.com/duckduckgo/zeroclickinfo-goodies/issues/2767#issuecomment-203883344
@rasikapohankar Thanks for the heads up! I'm bumping into duplicates/already-taken tasks pretty often.
@NaveenKarippai Yup, looks like SolarSystem doesn't need updating; thanks for pointing that out!
Please assign DaysBetween, Password, PercentOf and Pi to me.
@moollaza #3119 fixes the Sha Goodie.
@NaveenKarippai You're currently assigned to: DaysBetween, Password.pm, PercentOf.pm, Pi.pm
I can see that you're currently working on DaysBetween; do you mind if I unassign Password. PercentOf and Pi so someone else (probably myself) can quickly knock them out?
Thanks
@lamanh You're currently assigned to EmailValidator; I can see you started work on it already but hit some issues. Do you still want to be assigned to it?
@mintsoft no worries! please go ahead.
@lamanh Just FYI; I've got a PR in progress for Email Validator: https://github.com/duckduckgo/zeroclickinfo-goodies/issues/3163
@moollaza @mintsoft Just two more to go! We need to have a partaay once this is done :tada:
@mintsoft Thanks for doing so many of these - we'd still be a long way off if it weren't for you :heart:
Thanks to everyone else who's done one (or more) too; we really appreciate this community effort :dolphin:
@duckduckgo/community-leaders Time to partaay!
:tada: :balloon: :cake:
Most helpful comment
I would like to work on BirthStone.