208 points · by brad0 · 9y ago · 105 comments
"ingredients": [
"600g pineapple, peeled, chopped"
]
This seems like a prime candidate for improvement; something like the following would seem to be more useful: "ingredients": [{
"ingredient": "pineapple",
"quantity": {
"value": 600
"unit": "g",
},
"preparation": [ "peeled", "chopped" ]
}]
Using this kind of data, I can imagine automated ordering, management of several planned recipes in conjunction, personalised timing estimations, etc. I think the whole field of cooking is ripe for some quality api-based disruption!Basically, there's just a lot of slush and room for experimentation in cooking. Think about making a stir fry— how many people would level off exact masses of different vegetables to combine in perfect proportion? Never! You toss in what looks good and that's that. As you gain confidence, this approach spreads out to cover marinades, sauces, salads, breads, baking, etc, etc. You're not looking at recipes because you intend to follow them exactly, but because you're trolling for ideas of new combinations, or new preparation methods, or whatever.
The prose is valuable, because that's where that subtlety is communicated. It's the author saying stuff like: "I know this sounds weird, but do X until Y and then gently add Z and you'll be surprised what a great flavour develops."
Authors like Mark Bittman and Deb Perelman are perfect examples of this. Sure, you might make the odd thing from them exactly as written, but that's not really why you're there. I think treating food preparation as equivalent to a Vagrantfile would really lose something along the way.
If you are just giving me a technique or idea then write the article that expresses that. The recipe should be precise but the real value comes from the prose.
The Joy of Cooking's waffle recipe suggests 1/2c butter, but says you can drop that to 1/4c or bump it to 1c depending on how decadently crisp you want the result to be.
Note also that a lot of times the variations are to account for some other inherent variation, like adjusting the sugar in a pie depending on how sweet your fruit is.
Maybe differs in a restaurant or business, but for home cooking thinking of recipes as precise seems absurd to me. Its 600g... a number that was clearly rounded, and I would bet they eyeballed the amount they wanted and then measured it. Theres too much imprecision in a home kitchen to pretend to be precise
Anyway, that's across white, part whole wheat, part rye, and includes all kinds of additives like bran, wheat germ, cheese, herbs, roasted garlic, even tossing in a pot of leftover porridge from breakfast. Basic bread is almost impossible to screw up.
That's a neat idea, though, in a different direction. If you could implement some kind of standard recipe API and build a business around being a broker for commercial kitchens, wherein a customer inputs a recipe that follows a certain schema and an address, and the commercial kitchens respond saying either "no, we can't make that - we don't have the necessary ingredients / we're cooking at capacity / etc." or "sure, here's how much time it would take and here's how much it would cost." You would lose economies of scale found in most commercial kitchens, but customers would gain much more freedom over what they're ordering compared to pick-from-a-list traditional menus. Users could also search for highly rated recipes from around the world and see if somebody local could make it for them etc.
I tried Blue Apron once. So boring.
[1] http://www.cookingforengineers.com/recipe/127/Shepherds-Pie-...
Also, a friend and I made enough of his Mac and Cheese[1] to serve 150 people at my wedding a couple years ago. Highly recommended.
1: http://www.cookingforengineers.com/recipe/230/Macaroni-and-C...
Disclaimer: I made it. :) Let me know your thoughts.
Recipepuppy.com
Foodpairing.ninja
You can see it here[1] for example, "Ingrédients / Nombre de personnes", lower in the right column.
[1] http://www.marmiton.org/recettes/recette_courgettes-farcies-...
It's designed as the backend to an NLP interface for describing your recent eating. A food selection composes those endpoints I mentioned; and a recipe is a preset group of food selections. I'm not sure if that's how it should be long-term or how recipe discovery will work, but the goal is an agent that you can talk to about your nutrition intake, food buying, and cooking.
Hell, if it can be improved to be usable enough and to partially replace a personal nutritionist, one might sell access to it one day.
I'm not that experienced with databases; so exposing the design might be unwise from a security perspective. I'm warm to the idea of open sourcing in the future though. I've only shared repo access with a few trusted engineers. If you think you might want to contribute, hmu ryan at terra dot farm.
It usually is though. Cooking times however don't tend to scale predictably (except for microwaves).
These are quite standardised unless you are using something like Australian tablespoons¹ (but then any American following that recipe would run into problems as well). The US customary cup and spoon measures were introduced exactly to solve the problem of measurement ambiguity in recipes! Nineteenth century cookbooks can be hard to follow because of the significant variation in the interpretation of smidgens, dashes, pinches, and (then) spoons and cups.
1: Are these really a thing? Any Australian care to chime in?
https://developers.google.com/search/docs/data-types/recipes
The biggest problem with it, imho, is the lack of a proper definition of ingredients. An ingredient is just a plain string containing the unit, amount and name and sometimes an extra note. Having a quadruple instead of a string would make this standard a lot more useful.
It's not clear to me what the best way to present the second part is.
I gave up on the project pretty quickly (now I'm really tempted to pick it up again), but you can definitely get 90% of the way there with 10% of the effort:
ingredients = [
'200g of heavily salted butter',
'six bottles of beer',
'50ml of clotted cream',
'plain brown flour',
'1 oz french cheese',
'8 large eggs',
'2kg of salted pork',
'a pinch of salt',
'a tablespoon of honey'
]
ingredients.map { |i| IngredientParser.parse i }
# => ["butter",
# "beer",
# "clotted cream",
# "flour",
# "cheese",
# "egg",
# "pork",
# "salt",
# "honey"]
https://github.com/cronin101/DataChef/blob/master/utils/ingr... require '../environment.rb'
require '../scrapers/bbc_good_food_scraper.rb'
recipe = Recipe.create source_uri: 'http://www.bbcgoodfood.com/recipes/vietnamese-caramel-trout'
recipe.update_using_scraper BBCGoodFoodScraper
puts recipe.title
puts recipe.description
puts recipe.ingredient_ids.inspect
recipe.ingredient_ids.each { |i| puts((Ingredient.find i).inspect) }
=begin
Vietnamese caramel trout
A caramel base balances out the hot and salty ingredients of this Asian-inspired one-pan fish dish for two
[56, 57, 58, 59, 60, 61, 62, 63, 64]
#<Ingredient id: 56, name: "caster sugar", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 57, name: "thai fish sauce", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 58, name: "red chilli", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 59, name: "ginger", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 60, name: "rainbow trout", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 61, name: "bok choi", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 62, name: "juice lemon", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 63, name: "coriander", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 64, name: "rice", recipe_frequency: 1, recipe_ids: [7]>
=endThat was my approach.
I can see the same issue arising with this tool.
You can't substitute a cup of dried tagliatelle (huge "balls of yarn") for a cup of risoni (rice-sized grains of pasta) and be happy after eating that meal. :)
"prepTime": {
"text": "15 minutes",
"iso": "PT15M",
"minutes": 15
}
Why are you triplicating the time periods? I would limit that to just the ISO 8601 value (PT15M) and let the UI choose the proper rendering of the value.Technically the project is interesting, but if you want to offer a commercial API you might run into copyright and fair use issues (as with any scraping tool). Not so much a problem for personal use, but expect angry letters from the major recipe websites for violating their terms of use (i.e., this is a threat to their business model).
1: Try this link: https://www.thespruce.com/peking-duck-recipe-694920 . You'll see a lot of garbage HTML and XML entities in the JSON that can be filtered and replaced fairly easily.
@brad0 : how did you manage that? Was thespruce.com in your targets?
What are your plans for the project? Will you be open sourcing the code on GitHub?
https://open.blogs.nytimes.com/2015/04/09/extracting-structu...
On scrapers specifically, cinc's recipe importer is decent, but mainly relies on structured meta data.
There's a lot of room to improve these tools though. Lots of complexity and edge cases with recipes :)
Happy to answer questions people have about this stuff.
[1] http://www.chefkoch.de/rezepte/565001154855998/Big-Kahuna-Bu...
example : https://yurielkaim.com/7-green-detox-juice-recipes/
fortunately it doesn't take seven pages to find the actual recipes but I still need to go to each individually and possibly be buried under the ad load. the worst sites spread out the recipes to their own seven pages and still require a link to the site holding the recipe
Is there a behind-the-scenes somewhere? Is this regex magic alone?
There may be ethical questions here, but there shouldn't be any legal concerns (IANAL, just a guy in the process of building a site in this space).