2.6. Using summary reports to see information about an entire buffer

So far, all the reports you have seen print one report for each food. For instance, the names report prints the name of each food in the buffer, and the nuts report prints one nuts report for each food in the buffer.

Sometimes you will want to know information about an entire buffer, rather than about each food in the buffer. Two reports provide information about the entire buffer: sum and groups.

2.6.1. Using the sum report

The sum report prints information about the sum of all nutrients of every food in the buffer. Like nuts reports, it uses nutrient lists to determine which nutrients appear in the report and which goals to use. It looks almost identical to the nuts report, with one difference: it has only three columns, rather than four. The first column shows the nutrient name; the second shows the nutrient amount; and the third shows the amount's percentage of a goal defined in the nutrient list.

As with the reports we discussed earlier, you may combine summary reports with other reports, as the next example demonstrates by combining a traits report and a sum report. When you combine summary reports and food reports, the summary reports are always shown last.

Example 2.16. Using the sum report

$ pantry --name Bananas --print traits-blank-sum master
Cereals ready-to-eat, KELLOGG'S, CORN FLAKES With Real Bananas
Group: Breakfast Cereals
100 g (100g)

Bananas, dehydrated, or banana powder
Group: Fruits and Fruit Juices
100 g (100g)

Bananas, raw
Group: Fruits and Fruit Juices
Refuse: 36 percent Skin
100 g (100g)

SUM:
Nutrient                  Amount         %G    
-----------------------------------------------------
Calories                  852  kcal       43    
Total Fat                 11   g          17    
Saturated Fat             8    g          42    
Cholesterol               0    mg         0     
Sodium                    456  mg         19    
Total Carbohydrate        195  g          65    
Dietary Fiber             15   g          60    
Sugars                    85   g          NA    
Protein                   8    g          16    
Vitamin A                 1983 IU         40    
Vitamin C                 43   mg         71    
Calcium                   56   mg         6     
Iron                      7    mg         41    

As with nuts reports, you use nutrient lists to determine which nutrients are shown in the sum report, and what the goals are.

Example 2.17. Using the --nutrient-list option with the sum report

$ pantry --name Bananas --print traits-blank-sum --nutrient-list short \
> master
Cereals ready-to-eat, KELLOGG'S, CORN FLAKES With Real Bananas
Group: Breakfast Cereals
100 g (100g)

Bananas, dehydrated, or banana powder
Group: Fruits and Fruit Juices
100 g (100g)

Bananas, raw
Group: Fruits and Fruit Juices
Refuse: 36 percent Skin
100 g (100g)

SUM:
Nutrient                  Amount         %G    
-----------------------------------------------------
Calories                  852  kcal       NA    
Total Fat                 11   g          NA    
Total Carbohydrate        195  g          NA    
Protein                   8    g          NA    

2.6.2. Using the groups report

The other summary report is the groups report. It prints a list of all the groups in the buffer, the number of foods in each, and the total number of foods and groups. For instance, you can run the following example to see how many groupsa and foods are in the master file. Remember that if you do not specify any search options, pantry copies all foods from the files you specify into the buffer, which is why this example shows you all the groups in the master file.

Example 2.18. How many groups are in the master file?

$ pantry --print groups master
  Group                               No. of Foods
------------------------------------------------------------
  Baby Foods                              289
  Baked Products                          488
  Beef Products                           783
  Beverages                               266
  Breakfast Cereals                       427
  Cereal Grains and Pasta                 169
  Dairy and Egg Products                  216
  Ethnic Foods                            132
  Fast Foods                              310
  Fats and Oils                           239
  Finfish and Shellfish Products          255
  Fruits and Fruit Juices                 314
  Lamb, Veal, and Game Products           343
  Legumes and Legume Products             234
  Meals, Entrees, and Sidedishes           99
  Nut and Seed Products                   128
  Pork Products                           294
  Poultry Products                        346
  Sausages and Luncheon Meats             232
  Snacks                                  131
  Soups, Sauces, and Gravies              399
  Spices and Herbs                         60
  Sweets                                  351
  Vegetables and Vegetable Products       789
------------------------------------------------------------
                                         7294 foods total
                                           24 groups total