How to cook with logic
In answer to Craig Cmehil’s call for community contributions you can sink your teeth into, I whipped up a souffle of possibilities.
- Always look for standard code first, before writing anything.
- Before that, look for standard data structures.
After a few minutes googling, I discovered a PC program called MealMaster, which started 20 years ago, and found there is a huge number of recipes online using the supported data format. I also found a cool blog post from a few years back, called Cooking and software efficiency. I am going to look more at the data side of the equation than the coding side.
The Meal-Master™ program, which I admit I had never used until yesterday, was distributed as shareware up until 1998, when it was converted to freeware. I found the central distribution site still up and running here:
Why do I think is this important to answer Craig’s challenge? Well, because the recipe file format is documented, and that makes reinventing the wheel unnecessary. I can remember typing recipes into computers way back when, so let’s not make people use a new format. Today being the anniversary of the discovery of the Rosetta Stone (as mentioned in the Writer’s Almanac for July 19, 2009), let’s build on the past.
The file format:
| MMMMM—– Recipe via Meal-Master ™ v8.06
Title: Crockpot Home Style Chunky Applesauce
Yield: 4 Servings
10 Cooking apples diced
1/2 c Water
3/4 c Sugar
Cinnamon to taste
In crock-pot combine apples & water. Cover & cook on low for 4-6 hrs
or until apples are very soft. Add sugar & cook on low another 30 min.
Sprinkle with cinnamon at serv. time. Makes 4 cups. For smooth>puree
my $mm = MealMaster->new();
Title: INDIAN LENTIL & VEGETABLE STEW (MJEDDRAH)
Categories: East/orient, Stews, Vegetables
Yield: 4 Servings
3 c Water
8 oz Dried lentils (1 1/4C)
2 md Potatoes, peel, 1-in cubes
1 md Onion, chopped
1 Stalk celery, chopped
2 Cloves garlic, fine chop
1 tb Finely snipped parsley
1 tb Instant beef bouillon
1 ts Salt
1 ts Ground cumin
2 md Zucchini, 1/2-in slices
Directions: Lentils come in a rainbow of colors: red, yellow, orange, green and
brown. Choose any of them for this vegetable stew.
Heat water and lentils to boiling in Dutch oven. Reduce heat. Cover
and cook until lentils are almost tender, about 30 minutes. Stir in
potatoes, onion, celery, garlic, parsley, bouillon, salt and cumin.
Cover and cook until potatoes are tender, about 20 minutes. Stir in
zucchini. Cover and cook until zucchini is tender, 10 to 15 minutes.
Serve with lemon wedges.
by: Jim Spath
The data format
A typical recipe in my house was written on a 3-inch by 5-inch index card, and stored in a file box. I inherited the one my Aunt Shirley had, which included family recipes that she typed up for clarity. Looking at one of these indicates there might be “data normalization” issues of units, weights/measures, and calorie or other health information. The AnyMeal API page goes into detail, such as:
- Metric unit of measure
- ml milliliter …
- US unit of measure
- fl fluid ounce …
Our cool “Rosetta” recipe code should convert among units, and give reasonable approximations, like 1 cup = 250 ml, not 236.5882365 or something.
My Grandmother’s recipe for dumplings (“Meal” was her nickname; Amelia was her full name).
Needless to say, it is assumed here you would know how to make gravy, as there is nothing else on the card!
The API documentation includes “an ABNF grammar of the Mealmaster format” that should help you lean ABAPers out there build some data dictionary structures to start the community stone soup.
Places for recipes
As there are a lot of places to find recipes, our code should be able to take a URL and slurp the data from it, even if it’s ZIP compressed. Here are a few places you might look over the menus:
An SAP community code version should link to online videos, still images, and more. The footnote format of Menu-Master is vague, but that should not stop us from extending the standard, as long as we’re careful not to stomp through the kitchen and have the cake collapse.