Пример #1
0
def get_meal(name_list, groupings=['elements', 'vitamins', 'energy',
                                      'sugars', 'amino_acids', 'other',
                                      'composition']):
    """ Takes a list of food names (strings) and returns a Meal object of
        those foods.
        """
    meal = Meal(groupings)
    for name in name_list:
        food = get_food_with_name(name)
        meal.add(food)
    return meal
Пример #2
0
def make_daily_max(groupings):
    assert type(groupings) == list
    daily_max = Meal(groupings)
    if 'elements' in groupings:
        daily_max.elements['Sodium, Na'] =  (2300. / 3.)
        daily_max.elements['Phosphorus, P'] =  (4000. / 3.)
        daily_max.elements['Manganese, Mn'] =  (211. / 3.)
        daily_max.elements['Iron, Fe'] =  (45. / 3.)
        daily_max.elements['Potassium, K'] = 999999. ## 999999.=no upper limit
        daily_max.elements['Fluoride, F'] = None #10.  having troubles
        daily_max.elements['Selenium, Se'] = None #.4 having troubles, units off?
        daily_max.elements['Magnesium, Mg'] = 999999.
        daily_max.elements['Zinc, Zn'] =  (40. / 3.)
        daily_max.elements['Copper, Cu'] =  (10. / 3.)
        daily_max.elements['Calcium, Ca'] =  (2500. / 3.)
    if 'vitamins' in groupings:
        daily_max.vitamins['Niacin'] =  (35. / 3.)
        daily_max.vitamins['Thiamin'] = 999999. 
        daily_max.vitamins['Vitamin B-6'] =   (100. / 3.)
        daily_max.vitamins['Pantothenic acid'] = 999999.
        daily_max.vitamins['Vitamin C, total ascorbic acid'] = (2000. / 3.)
        daily_max.vitamins['Vitamin A, IU'] =  (3. / 3.)
        daily_max.vitamins['Vitamin E (alpha-tocopherol)'] = (1000. / 3.)
        daily_max.vitamins['Vitamin D'] =  (.05 / 3.)
        daily_max.vitamins['Folate, total'] =  (1. / 3.)
        daily_max.vitamins['Vitamin B-12'] = 999999.
        daily_max.vitamins['Vitamin K (phylloquinone)'] = 999999. 
    return daily_max
Пример #3
0
def make_daily_min(groupings):
    # not complete
    assert type(groupings) == list
    daily_min = Meal(groupings)
    if 'elements' in groupings:
        daily_min.elements['Sodium, Na'] =  (1500. / 3.)
        daily_min.elements['Phosphorus, P'] =  (700. / 3.)
        daily_min.elements['Manganese, Mn'] =  (2.3 / 3.)
        daily_min.elements['Iron, Fe'] =  (8. / 3.)
        daily_min.elements['Potassium, K'] =  (4700. / 3.)
        daily_min.elements['Fluoride, F'] = None #4. having troubles
        daily_min.elements['Selenium, Se'] = None #.055 having troubles...
        daily_min.elements['Magnesium, Mg'] =  (420. / 3.)
        daily_min.elements['Zinc, Zn'] =  (11. / 3.)
        daily_min.elements['Copper, Cu'] =  (.9 / 3.)
        daily_min.elements['Calcium, Ca'] =  (1000. / 3.)
    if 'vitamins' in groupings:
        daily_min.vitamins['Niacin'] =  (16. / 3.)
        daily_min.vitamins['Thiamin'] =  (1.2 / 3.)
        daily_min.vitamins['Vitamin B-6'] = None ## instead of zero?
        daily_min.vitamins['Pantothenic acid'] =  (5. / 3.)
        daily_min.vitamins['Vitamin C, total ascorbic acid'] = (90. / 3.)
        daily_min.vitamins['Vitamin A, IU'] =  (.9 / 3.)
        daily_min.vitamins['Vitamin E (alpha-tocopherol)'] = (15. / 3.)
        daily_min.vitamins['Vitamin D'] =  (.015 / 3.)
        daily_min.vitamins['Folate, total'] =  (.4 / 3.)
        daily_min.vitamins['Vitamin B-12'] =  (.0024 / 3.)
        daily_min.vitamins['Vitamin K (phylloquinone)'] = (.12 / 3.)
    if 'amino_acids' in groupings:
        # assumed to be per 100kg, source for Proof Of Concept from
        # http://en.wikipedia.org/wiki/Essential_amino_acid#Recommended_daily_amounts
        # Methionine+Cysteine and Phenylalanine+Tyrosine were broken up,
        # although they are substitutes for eachother.  These are in a sense
        # dummy values!!!
        daily_min.amino_acids['Lysine'] =  (3000 / 3.)
        daily_min.amino_acids['Phenylalanine'] =  (1250 / 3.)
        daily_min.amino_acids['Leucine'] =  (3900 / 3.)
        daily_min.amino_acids['Methionine'] =  (750 / 3.)
        daily_min.amino_acids['Histidine'] =  (1000 / 3.)
        daily_min.amino_acids['Valine'] =  (2600 / 3.)
        daily_min.amino_acids['Tryptophan'] =  (400 / 3.)
        daily_min.amino_acids['Isoleucine'] =  (2000 / 3.)
        daily_min.amino_acids['Threonine'] =  (1500 / 3.)
        daily_min.amino_acids['Cystine'] =  (750 / 3.)
        daily_min.amino_acids['Tyrosine'] =  (1250 / 3.)
        daily_min.amino_acids['Hydroxyproline'] =  (5 / 3.)
    return daily_min