Chapter 3. Using Pantry: practical examples

Table of Contents

3.1. Finding nutrient amounts
3.2. Keeping a food diary
3.3. Organizing your foods into files
3.3.1. A quick file
3.3.2. Organizing diary files

Now that you know all the basic Pantry options, you're ready to combine them and put them to use! This chapter will show you how.

3.1. Finding nutrient amounts

Often you will wish to know the nutrient makeup of a particular food. Suppose for example that you want to know how many calories are in a fresh apple. You figure that master already has such a food, but you don't know exactly what it would be. So first you search for apple to see what comes up.

Example 3.1. Searching for apples

$ pantry --ignore-case --name apple --print names master
Babyfood, fruit, bananas and pineapple with tapioca, junior
Cereals, QUAKER, Instant Oatmeal, NUTRITION FOR WOMEN, Apple Spice, dry
Fast foods, burrito, with fruit (apple or cherry)
Babyfood, fruit, applesauce and apricots, strained
Cereals ready-to-eat, GENERAL MILLS, OATMEAL CRISP, APPLE CINNAMON
HEALTHY CHOICE Country Roasted Turkey w/Cranberry Apple Sauce, Green Beans & Carrot Blend
Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, heavy syrup, solids and liquids
Pineapple, canned, water pack, solids and liquids
PEPPERIDGE FARM Apple Turnovers, frozen, ready to bake
Cereals ready-to-eat, KELLOGG, KELLOGG'S APPLE CINNAMON SQUARES MINI-WHEATS
Babyfood, fruit, bananas with apples and pears, strained
Apples, dried, sulfured, stewed, with added sugar
Cereals, QUAKER,Instant Oatmeal, apples and cinnamon, prepared with boiling water
Fruit cocktail, (peach and pineapple and pear and grape and cherry), canned, extra light syrup, solids and liquids
Cereals ready-to-eat, KELLOGG, KELLOGG'S APPLE JACKS
[ trimmed to save space ]

It turns out that this search returns 163 results. There must be a way to narrow this down. Well, many foods will have the word "Apple" in their name, including many foods that are not even fruits (desserts, for example). A good way to narrow your results is to use the --group option:

Example 3.2. Searching for apples, with the --group option

$ pantry --ignore-case --name apple --group fruits --print names master
Pineapple juice, canned, unsweetened, with added ascorbic acid
Apples, raw, without skin, cooked, microwave
Applesauce, canned, unsweetened, with added ascorbic acid
Sugar-apples, (sweetsop), raw
Apple juice, canned or bottled, unsweetened, with added ascorbic acid
Pineapple, canned, juice pack, solids and liquids
Apples, canned, sweetened, sliced, drained, heated
Crabapples, raw
Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, water pack, solids and liquids
Apples, frozen, unsweetened, unheated
Applesauce, canned, unsweetened, without added ascorbic acid
Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, heavy syrup, solids and liquids
Pineapple, raw, all varieties
Pineapple, canned, water pack, solids and liquids
Applesauce, canned, sweetened, with salt
[ trimmed to save space ]

That is still a lot more than we are looking for, including a bunch of things that merely have "Apple" in their name. What if we use a regular expression to limit the results only to foods whose name trait begins with apple?

Example 3.3. Searching for apples using a regular expression

$ pantry --ignore-case --name ^apple --group fruits --print names master
Apples, raw, without skin, cooked, microwave
Apple juice, canned or bottled, unsweetened, with added ascorbic acid
Apples, canned, sweetened, sliced, drained, heated
Apples, frozen, unsweetened, unheated
Applesauce, canned, unsweetened, without added ascorbic acid
Applesauce, canned, sweetened, with salt
Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water without added ascorbic acid
Apples, dried, sulfured, stewed, with added sugar
Apple juice, canned or bottled, unsweetened, without added ascorbic acid
Apples, dried, sulfured, uncooked
Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid
Apples, canned, sweetened, sliced, drained, unheated
Apple juice, frozen concentrate, unsweetened, undiluted, without added ascorbic acid
Apples, raw, with skin
Apples, frozen, unsweetened, heated
Apples, raw, without skin
Apples, dehydrated (low moisture), sulfured, uncooked
Apples, dried, sulfured, stewed, without added sugar
Applesauce, canned, sweetened, without salt
Apples, raw, without skin, cooked, boiled
Applesauce, canned, unsweetened, with added ascorbic acid
Apples, dehydrated (low moisture), sulfured, stewed
Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water, with added ascorbic acid

That buffer is manageable enough to scan to see what we are looking for. Looks like Apples, raw, with skin is what we are looking for. We want to know how many calories are in an apple. To do that, first we need to see what units are available for Apples, raw, with skin:

Example 3.4. Available units for an apple

$ pantry --name "Apples, raw, with skin" --print names-units \
> master
Apples, raw, with skin
   cup, quartered or chopped
   large (3-1/4" dia) (approx 2 per lb)
   NLEA serving
   medium (2-3/4" dia) (approx 3 per lb)
   cup slices
   small (2-1/2" dia) (approx 4 per lb)

Notice how we combined the names and units reports rather than using just a units report. This is a good idea because otherwise, your report might actually contain results for more than one food, but you would not know this if you used only a units report.

Finally, we use the change options to take the apple from the master file, change it to the characteristics we're interested in, and print a report:

Example 3.5. How many calories are in an apple?

$ pantry --name "Apples, raw, with skin" --c-unit large \
> --c-qty 1 --print traits-nuts master
Apples, raw, with skin
Group: Fruits and Fruit Juices
Refuse: 8 percent Core and stem
1 large (3-1/4" dia) (approx 2 per lb) (212g)
Nutrient                  Amount         %G     %TOT  
-------------------------------------------------------
Calories                  110  kcal       6      100   
Total Fat                 0    g          1      100   
Saturated Fat             0    g          0      100   
Cholesterol               0    mg         0      0     
Sodium                    2    mg         0      100   
Total Carbohydrate        29   g          10     100   
Dietary Fiber             5    g          20     100   
Sugars                    22   g          NA     100   
Protein                   1    g          1      100   
Vitamin A                 114  IU         2      100   
Vitamin C                 10   mg         16     100   
Calcium                   13   mg         1      100   
Iron                      0    mg         1      100