Giter Club home page Giter Club logo

dietrecommender.jl's Introduction

DietRecommender.jl

Create a diet with minimum calorie intake while fulfilling all recommended micro- and macro-nutrients. Using USDA's food composition database and linear programming, it finds a personalized diet given your age, sex, weight, and food preference. You can exclude specific foods or complete food categories. It is also possible to exclude nutrients from constraints.

It makes sure that your intake of the following nutrients is within the recommended range while minimizing calories: Calcium, Carbohydrate, Choline, Copper, Fluoride, Folate, Histidine, Iron, Isoleucine, Leucine, Lysine, Magnesium, Manganese, Methionine+cysteine, Niacin, Pantothenic Acid, Phenylalanine+tyrosine, Phosphorus, Potassium, Protein, Riboflavin, Selenium, Sodium, Thiamin, Threonine, Total Fiber, Tryptophan, Valine, Vitamin A, B6, B12, C, D, E, K, and Zinc.

Currently, the minimum calories of a diet that fulfills all recommended nutrients is much more than the recommended calorie intake. I am not sure why this happens. Possibly it is a result of recommended daily intake values, which cannot be fulfilled without taking too much calories. I welcome any comments about this issue.

Example

using DietRecommender

your_age = 22
your_sex = "male"
your_weight = 70 # in kilograms

diet_ids, diet_names, diet_amounts, m, status, objval, yval = get_diet(your_age, your_sex, your_weight)
Optimization status: LOCALLY_SOLVED 

Calorie intake: 5054 

Your recommended diet per day:


1. Egg, yolk, dried: 2.454 grams
2. Raisins, seedless: 1514.629 grams
3. Asparagus, cooked, boiled, drained: 232.107 grams
4. Spinach, cooked, boiled, drained, without salt: 109.184 grams
5. Asparagus, cooked, boiled, drained, with salt: 152.499 grams
6. Carrots, cooked, boiled, drained, with salt: 199.236 grams
7. Mushrooms, shiitake, cooked, with salt: 14.097 grams
8. Spinach, cooked, boiled, drained, with salt: 87.436 grams
9. Mushrooms, brown, italian, or crimini, exposed to ultraviolet light, raw: 45.555 grams
10. Crustaceans, shrimp, mixed species, cooked, breaded and fried: 104.196 grams
11. Mollusks, oyster, eastern, wild, cooked, dry heat: 49.396 grams

Installation

Type the following in a Julia REPL.

] add https://github.com/kavir1698/DietRecommender.jl

dietrecommender.jl's People

Contributors

kavir1698 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

littun

dietrecommender.jl's Issues

Querying data Error

I keep getting this error. I tried to open the file vs code points to edit it, but it seems its readonly and is a package.

::ERROR::

julia> include("./main.jl")

Querying the database...
ERROR: LoadError: ArgumentError: syntax df[column] is not supported use df[!, column] instead Stacktrace:
[1] getindex(#unused#::DataFrames.DataFrame, #unused#::Int64) @ DataFrames C:\Users\kamva\.julia\packages\DataFrames\LteEl\src\abstractdataframe
\abstractdataframe.jl:2448 [2] apply_updates(food_des::DataFrames.DataFrame, nut_data::DataFrames.DataFrame, updatedir::String) @ Main.DietRecommender C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects
\DietRecommender.jl\src\get_data.jl:97 [3] allnutdata(; data_folder::String, dri_file::String, updatedir::String) @ Main.DietRecommender C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects
\DietRecommender.jl\src\get_data.jl:203 [4] loaddata(your_age::Int64, your_sex::String, your_weight::Int64; only_groups::Vector{Int64}) @ Main.DietRecommender C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects
\DietRecommender.jl\src\get_data.jl:333 [5] get_diet(your_age::Int64, your_sex::String, your_weight::Int64; only_groups::Vector{Int64}, exclude_food::Vector{String}, excluded_nutrients::Vector{Any}) @ Main.DietRecommender C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects
\DietRecommender.jl\src\return_diet.jl:79 [6] get_diet(your_age::Int64, your_sex::String, your_weight::Int64) @ Main.DietRecommender C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects\DietRecommender.jl
\src\return_diet.jl:76 [7] top-level scope @ C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects\DietRecommender.jl\main.jl:8
[8] include(fname::String) @ Base.MainInclude .\client.jl:476
[9] top-level scope @ REPL[1]:1
in expression starting at C:\Users\kamva\Desktop\DEV WORKSPACES\SCHOOL DEV\test_projects\DietRecommender.jl\main.jl:8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.