Hacker News new | ask | show | jobs
by vajenetehais 2924 days ago
We (with the wife) automated menu for the week and the shopping list. A database store all recipes (ingredients, time taken...) and the menu composer chose semi-randomly* into the list.

* : Menu composer takes into account :

- in season vegetables,

- number of reutilisation of the ingredient,

- number of reutilisation of the meal,

- expiration of the ingredients (vegetables can expire rather quickly)

- various parameters (if it is a busy week or not, number of days you want to cook...)

It's really a relief. No need to decide what to cook after work : it's already decided, and you know you have the right ingredients. Time spend for the shopping is very small.

I want to be able to plug that into an online shopping website, but as always, websites don't display there API so i'm trying to hack into it... (and people still talk about API economy...)

5 comments

> It's really a relief. No need to decide what to cook after work : it's already decided, and you know you have the right ingredients. Time spend for the shopping is very small.

Nice. I'm using Google Keep for now, and there's probably a much better solution already -- but what I really want is a way to organize my shopping list the way the grocery store is organized so I can zip through it.

Ideally, this would require some collaboration with the store to get the exact layout. But a generic (vegetables first, breads 2nd, canned goods 3rd, ..., milk & dairy last. would also help tremendously.

This is really fascinating :)

I'd love to use the same system. Is it open source?

I love this idea, and had also thought of similar automation. I think with nuturional values data, you could get a great system going.

Ill be happy to start an open source project with a few peeps if their interested as well?

Catch me on github https://github.com/Alfanhui

+1 Would also like to know the inner workings, a general hint to the approach taken would already be awesome
i got a sql database :

Recipes table : it tooks some months to fill it with our choices (prefered recipes) and add attributes to that : cold/warm meal, difficulty, time taken, kind of meal (junk, bistrot, classical, exotic...), does it scale (x0.5, x2, x4...).

ingredient_table : each receipe got ingredients. Every kind of ingredrients are on a separate table.

product_table : it is there i display what you can buy from stores : 6/12/24 eggs bundle, 250/500g butter

Then it starts to be ugly, cause there is constraints : loose and hard. Timetable is a hard constraint (i don't want to cook monday evening), so it will be double ration one of the day before, Season is a hard constraint (you buy vegetables when they are in season) Tastes are a hard constraint : you decides what kind of meal you want to eat during the weak

With that you get available recipes and a timetable for cooking and quantity to cook.

Price is a lose constraint, leftovers are a lose constraint, time spent cooking is a lose constraint (could be a hard, if you have enough recipes, but as i like cooking, it's no matter for me)

After, i enumerate all possibilities and each one get a score based on lose constraints : you can use a simple weighted average, exponentially weighted average... You tweak coefs to prefer a nice price or a little time spent and then it's done. Usually a chose randomly between the ten best solutions.

I got enough recipes to cover all hard constraints. I avoid lot of problems doing a big enumeration for all possibilities (it takes a couple of minutes at my scale for 200 recipes), also, hard constraints are pretty easy to deal with, it could be a lot more complicated if user become picky on meals. I'm no coder so i don't know any design pattern or anything that could help me to design a better algo. But, as far as i know, when you can't evaluate all possibilities you have to go the optimization road.

Answers to questions : - Yeah, there is this website : https://fr-en.openfoodfacts.org/ (broken TLS it seems) that could be used to pull data on ingredients, - I don't have plan to open-source it : it's pretty hacky, ugly and probably defy any coding rule (except 4 space ident PEP8). it's not even packeged (i've never done that before...)

+1 Please open source it, even if it is not ready for production
I've been wanting to do this for ages and link it with the USDA's nutritinal database but I just haven't had the time.

Is there any way to get hold of what you've done?

Sounds very cool. It could also take local supermarket promotions into account.
people would buy this.
Unfortunately not. Or maybe I was selling it wrong. :) I had designed something exactly like this.

I posted it to HN a few months ago to crickets. I might be reviving it soon-ish.