Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
/ autochef Public archive

Commit 371096e

Browse files
committed
Roadmap and small fixes
1 parent d27cac8 commit 371096e

File tree

5 files changed

+96
-0
lines changed

5 files changed

+96
-0
lines changed

api/recipes/cucumber_salad.pl

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
serves(cucumber_salad, 1).
44
difficulty(cucumber_salad, 1).
55

6+
tag(X, vegetarian) :- tag(X, vegan).
67
% tag(recipe, keyword).
78
tag(cucumber_salad, vegan).
89
tag(cucumber_salad, vegetarian).
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
% properties
2+
meal(tagliatelle_tomato_basil).
3+
serves(tagliatelle_tomato_basil, 2).
4+
difficulty(tagliatelle_tomato_basil, 2).
5+
6+
% tag(recipe, keyword).
7+
tag(tagliatelle_tomato_basil, vegan).
8+
tag(tagliatelle_tomato_basil, vegetarian).
9+
tag(tagliatelle_tomato_basil, italian).
10+
11+
% ingredient(recipe, ingredient, [unit, quantity]).
12+
ingredient(tagliatelle_tomato_basil, olive_oil, [tablespoon, 2]).
13+
ingredient(tagliatelle_tomato_basil, cherry_tomato, [gram, 250]).
14+
ingredient(tagliatelle_tomato_basil, garlic, [clove, 1]).
15+
ingredient(tagliatelle_tomato_basil, tagliatelle, [gram, 250]).
16+
ingredient(tagliatelle_tomato_basil, basil, [leaf, 6]).
17+
18+
% step(recipe, output, [requirements], [[utensils]], [duration, quantity]).
19+
step(tagliatelle_tomato_basil, cherry_tomato_oil, [garlic_oil, cherry_tomato], [], [minutes, 3]).
20+
step(tagliatelle_tomato_basil, cooked_cherry_tomato_oil, [cherry_tomato_oil], [], [minutes, 5]).
21+
step(tagliatelle_tomato_basil, cherry_tomato_sauce, [cooked_cherry_tomato_oil, garlic], [], [minutes, 10]).
22+
step(tagliatelle_tomato_basil, cooked_tagliatelle, [tagliatelle], [], [minutes, 8]).
23+
step(tagliatelle_tomato_basil, tagliatelle_tomato_basil, [cherry_tomato_sauce, cooked_tagliatelle, basil, ground_pepper], [], [minutes, 1]).
24+
25+
% instructions(language, country, ingredient, text).
26+
instructions(en, _, cherry_tomato_oil, '').
27+
instructions(en, _, cooked_cherry_tomato_oil, '').
28+
instructions(en, _, cherry_tomato_sauce, '').
29+
instructions(en, _, cooked_tagliatelle, '').
30+
instructions(en, _, tagliatelle_tomato_basil, '').
31+
32+
% title(language, country, ingredient, text).
33+
title(en, _, cherry_tomato_sauce, 'Cherry Tomato Sauce').
34+
title(en, _, cooked_tagliatelle, 'Fresh Tagliatelle').
35+
title(en, _, tagliatelle_tomato_basil, 'Tagiatelle with Sweet Tomato and Basil Sauce').
36+
37+
% extra(recipe, extras).
38+
extra(tagliatelle_tomato_basil, salt).
39+
extra(tagliatelle_tomato_basil, sugar).
40+
41+
% reusable(recipe, output).
42+
reusable(tagliatelle_tomato_basil, tagliatelle_tomato_basil, [days, 2]).

api/rules.pl

+36
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,39 @@
3030
prerequisite_ingredients(Request, T, OptimalT),
3131
append(OptimalSubIngredients, OptimalT, Combined),
3232
!.
33+
34+
%- Service: User Recipe Options
35+
% Output: Recipes
36+
meals_possible(Request, Meals) :-
37+
findall(Meal, (meal(Meal), possible(Request, Meal)), Meals).
38+
39+
% Private: Determine if a user can make a given ingredient
40+
possible(Request, Ingredient) :-
41+
stocked(Request, Ingredient, _).
42+
possible(Request, Recipe) :-
43+
step(_, Recipe, Prerequisites, _, _),
44+
findall(Ingredient, (member(Ingredient, Prerequisites), possible(Request, Ingredient)), Prerequisites).
45+
46+
%- Service: User Recipe Display
47+
% Output: Prerequisites, Steps
48+
meal_display(Request, Meal, Prerequisites, Tree) :-
49+
meal(Meal),
50+
step(Meal, Meal, Ingredients, _, _),
51+
prerequisites(Request, Meal, Ingredients, Prerequisites, Tree).
52+
53+
% Private: Find the best choice of ingredients to prepare a recipe
54+
prerequisites(_, _, [], [], []).
55+
prerequisites(Request, Parent, [H|T], [H|P], [H|Tree]) :-
56+
stocked(Request, H, _),
57+
prerequisites(Request, Parent, T, P, Tree).
58+
prerequisites(Request, Parent, [H|T], [H|P], [H|Tree]) :-
59+
product(H),
60+
not(possible(Request, H)),
61+
prerequisites(Request, Parent, T, P, Tree).
62+
prerequisites(Request, Parent, [H|T], Concat, [Parent|[Trees]]) :-
63+
step(_, H, P, _, _),
64+
prerequisites(Request, H, P, LP, LT),
65+
prerequisites(Request, H, T, RP, RT),
66+
append(LP, RP, Concat),
67+
append(LT, RT, Trees),
68+
!.

api/service.pl

+6
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@
6363
rows([H|T]) -->
6464
html(tr([td(H)])),
6565
rows(T).
66+
67+
:- assert(stocked(_, cucumber, 1)).
68+
:- assert(stocked(_, salt, 1)).
69+
:- assert(stocked(_, pepper, 1)).
70+
:- assert(stocked(_, seasoned_rice_vinegar, 1)).
71+
:- assert(stocked(_, water, 1)).

doc/roadmap

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
autochef roadmap
2+
===
3+
4+
20100424 - initial recipe load
5+
20100424 - recipe suggestion service complete
6+
7+
20100424 - recipe service calls
8+
20100426 - javascript layer to use recipe service json
9+
10+
20100426 - replace login system with facebook connect
11+
20100428 - persist recipes against facebook ids

0 commit comments

Comments
 (0)