nutrimetrics


Namenutrimetrics JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryAnalyzes nutrients found in foods and user-defined meal plans.
upload_time2023-04-06 23:37:00
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Thomas Civeit <thomas@civeit.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords analysis calculator calorie counter diet food meal nutrient nutrition tracker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NutriMetrics

NutriMetrics is a Python package that analyzes nutrients found in foods and user-defined meal plans.
Nutrient profile data can be imported from USDA's FoodData Central or manually entered by users.
The package tracks 60+ nutrients including fats, proteins, carbs, all minerals and vitamins.
It comes with 100+ nutrient profiles found in common food and a few sample meal plans.
User-defined meal plans consist of a set of meals, each of which consists of a set of foods
with a specified amount. Analysis reports are generated in Excel workbooks.

[![PyPI - Version](https://img.shields.io/pypi/v/nutrimetrics.svg)](https://pypi.org/project/nutrimetrics)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nutrimetrics.svg)](https://pypi.org/project/nutrimetrics)

![Report Screenshot](https://github.com/tomcv/nutrimetrics/blob/main/report.png?raw=true)

-----

**Table of Contents**

- [Quick Start](#quick-start)
- [Installation](#installation)
- [Commands](#commands)
- [License](#license)

## Quick Start

Run the commands:
```console
$ pip install nutrimetrics
$ nutrimetrics-init
$ nutrimetrics-analyze ~/.nutrimetrics/samples/bryan_johnson.json
```
Which will generate the corresponding `bryan_johnson.xlsx` Excel workbook in the working directory.

The package includes 3 sample meal plans:

1. `bryan_johnson.json`: a vegan meal plan estimated from Bryan Johnson's [blueprint](https://blueprint.bryanjohnson.co/).
2. `eric_berg.json`: a low-carb ketogenic meal plan estimated from Eric Berg's [eating routine](https://www.youtube.com/watch?v=EhZK_MUPxrc).
3. `michael_b_jordan.json`: Michael B. Jordan's high-protein meal plan [to get fit](https://www.mensjournal.com/health-fitness/how-michael-b-jordan-got-fit-for-creed-20151120) for 'Creed'.

## Installation

### PyPI

The easiest way to get NutriMetrics is to use pip:
```console
$ pip install nutrimetrics
```
That will install the `nutrimetrics` package along with all the required dependencies.
Pip will also install a few commands (described below) to the package's bin directory.

### From Source

Alternatively you can install the latest NutriMetrics codebase from the git repo:
```console
$ git clone https://github.com/tomcv/nutrimetrics.git
$ cd nutrimetrics
$ hatch build
```
The package's [pyproject.toml](pyproject.toml) project file is configured for [hatch](https://github.com/pypa/hatch).

## Commands

The package includes 3 commands:

- `nutrimetrics-init` initializes user's configuration
- `nutrimetrics-analyze` generates analysis report for a specified meal plan
- `nutrimetrics-import` imports nutrient profile data from USDA's FoodData Central

### Configuration

All configuration parameters are set in `~/.nutrimetrics/config.json`.
The default configuration is created  when running the `nutrimetrics-init` command.
The only parameter that you may have to change is the API key used to access FoodData Central
when importing data.

### Analysis Report

Reports are generated by running the `nutrimetrics-analyze` command:
```console
$ nutrimetrics-analyze ~/.nutrimetrics/samples/meal_plan.json 
```
Which will generate the corresponding `meal_plan.xlsx` Excel workbook in the working directory.
The report includes the amount of each nutrient as well as some statistical data,
including the energy distribution, the energy/protein/fat target, and the percentage of the
Dietary Reference Intakes (DRI) for all minerals and vitamins. The report consists of 3 spreadsheets:

1. The 'Meals' spreadsheet describes each meal of the meal plan.
2. The 'Target' spreadsheet displays the calculated target for the given body mass and activity.
3. The 'Foods' spreadsheet describes all known foods, defined in the `~/.nutrimetrics/foods/` directory. 

A meal plan is defined in a JSON file like this:
```json
{
  "name": "Simple Meal Plan",
  "unit": "g",
  "target": {
    "body_mass": 75400.0,
    "body_fat_percent": 15.0,
    "activity_factor": 1.4,  // in [1.2, 1.6] range based on activity
    "protein_factor": 1.8,  // minimum protein intake in [1.5, 2.3] range
    "fat_factor": 0.8  // minimum fat intake 0.7 or larger
  },
  "dietary_reference_intakes": "rda-male", // (ear-male, ear-female, rda-male, rda-female)
  "meals": [
    {
      "name": "Breakfast [7AM]",
      "foods": [
        {"food": "Oat Rolled", "amount": 40},
        {"food": "Blueberry", "amount": 80}
      ]
    },
    {
      "name": "Dinner [7PM]",
      "foods": [
        {"food": "Chicken Breast", "amount": 150},
        {"food": "Cauliflower", "amount": 100},
        {"food": "Olive Oil", "amount": 13}
      ]
    }
  ]
}
```
The `food` value must be one of the food's name defined in the `~/.nutrimetrics/foods/` directory.

The Dietary Reference Intakes (DRI) included in the package are the Recommended Dietary Allowance (RDA)
and the Estimated Average Requirement (EAR) for male and female. Users can add their own requirement profiles
in the `~/.nutrimetrics/dri/` directory.

### Nutrient Profile Data

The package comes with 100+ nutrient profiles of common food. However, new data can be added by importing
nutrient profiles  from USDA's FoodData Central (FDC). The `nutrimetrics-import` command reads a JSON file
that lists all foods names and FDC IDs to be imported, looking like this:

```json
{
  "foods": [
    {"fdc_id": 170567,  "name": "Almond"},
    {"fdc_id": 170178,  "name": "Macadamia Nut"},
    {"fdc_id": 170187,  "name": "Walnut"}
  ]
}
```

The package provides a sample `~/.nutrimetrics/samples/foods.json` file you can use.
Before running the command you must edit `~/.nutrimetrics/config.json` to specify your own `api_key`
(that you can get it [here](https://fdc.nal.usda.gov/api-guide.html) for free).

```console
$ nutrimetrics-import ~/.nutrimetrics/samples/foods.json 
```
Will download and generate all JSON files in `~/.nutrimetrics/foods/` for each specified food.

Alternatively you can create your own JSON files by specifying the amount of each nutrient for a given food.
All amounts are specified in grams. Nutrients that are not listed are set to zero by default. 

## License

`nutrimetrics` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "nutrimetrics",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "analysis,calculator,calorie,counter,diet,food,meal,nutrient,nutrition,tracker",
    "author": "",
    "author_email": "Thomas Civeit <thomas@civeit.com>",
    "download_url": "https://files.pythonhosted.org/packages/c7/d5/90c1ac9549998638b60bc363dc6e5e5bca7f5a24827d2fb1f76ddfc9c0b5/nutrimetrics-1.0.0.tar.gz",
    "platform": null,
    "description": "# NutriMetrics\n\nNutriMetrics is a Python package that analyzes nutrients found in foods and user-defined meal plans.\nNutrient profile data can be imported from USDA's FoodData Central or manually entered by users.\nThe package tracks 60+ nutrients including fats, proteins, carbs, all minerals and vitamins.\nIt comes with 100+ nutrient profiles found in common food and a few sample meal plans.\nUser-defined meal plans consist of a set of meals, each of which consists of a set of foods\nwith a specified amount. Analysis reports are generated in Excel workbooks.\n\n[![PyPI - Version](https://img.shields.io/pypi/v/nutrimetrics.svg)](https://pypi.org/project/nutrimetrics)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nutrimetrics.svg)](https://pypi.org/project/nutrimetrics)\n\n![Report Screenshot](https://github.com/tomcv/nutrimetrics/blob/main/report.png?raw=true)\n\n-----\n\n**Table of Contents**\n\n- [Quick Start](#quick-start)\n- [Installation](#installation)\n- [Commands](#commands)\n- [License](#license)\n\n## Quick Start\n\nRun the commands:\n```console\n$ pip install nutrimetrics\n$ nutrimetrics-init\n$ nutrimetrics-analyze ~/.nutrimetrics/samples/bryan_johnson.json\n```\nWhich will generate the corresponding `bryan_johnson.xlsx` Excel workbook in the working directory.\n\nThe package includes 3 sample meal plans:\n\n1. `bryan_johnson.json`: a vegan meal plan estimated from Bryan Johnson's [blueprint](https://blueprint.bryanjohnson.co/).\n2. `eric_berg.json`: a low-carb ketogenic meal plan estimated from Eric Berg's [eating routine](https://www.youtube.com/watch?v=EhZK_MUPxrc).\n3. `michael_b_jordan.json`: Michael B. Jordan's high-protein meal plan [to get fit](https://www.mensjournal.com/health-fitness/how-michael-b-jordan-got-fit-for-creed-20151120) for 'Creed'.\n\n## Installation\n\n### PyPI\n\nThe easiest way to get NutriMetrics is to use pip:\n```console\n$ pip install nutrimetrics\n```\nThat will install the `nutrimetrics` package along with all the required dependencies.\nPip will also install a few commands (described below) to the package's bin directory.\n\n### From Source\n\nAlternatively you can install the latest NutriMetrics codebase from the git repo:\n```console\n$ git clone https://github.com/tomcv/nutrimetrics.git\n$ cd nutrimetrics\n$ hatch build\n```\nThe package's [pyproject.toml](pyproject.toml) project file is configured for [hatch](https://github.com/pypa/hatch).\n\n## Commands\n\nThe package includes 3 commands:\n\n- `nutrimetrics-init` initializes user's configuration\n- `nutrimetrics-analyze` generates analysis report for a specified meal plan\n- `nutrimetrics-import` imports nutrient profile data from USDA's FoodData Central\n\n### Configuration\n\nAll configuration parameters are set in `~/.nutrimetrics/config.json`.\nThe default configuration is created  when running the `nutrimetrics-init` command.\nThe only parameter that you may have to change is the API key used to access FoodData Central\nwhen importing data.\n\n### Analysis Report\n\nReports are generated by running the `nutrimetrics-analyze` command:\n```console\n$ nutrimetrics-analyze ~/.nutrimetrics/samples/meal_plan.json \n```\nWhich will generate the corresponding `meal_plan.xlsx` Excel workbook in the working directory.\nThe report includes the amount of each nutrient as well as some statistical data,\nincluding the energy distribution, the energy/protein/fat target, and the percentage of the\nDietary Reference Intakes (DRI) for all minerals and vitamins. The report consists of 3 spreadsheets:\n\n1. The 'Meals' spreadsheet describes each meal of the meal plan.\n2. The 'Target' spreadsheet displays the calculated target for the given body mass and activity.\n3. The 'Foods' spreadsheet describes all known foods, defined in the `~/.nutrimetrics/foods/` directory. \n\nA meal plan is defined in a JSON file like this:\n```json\n{\n  \"name\": \"Simple Meal Plan\",\n  \"unit\": \"g\",\n  \"target\": {\n    \"body_mass\": 75400.0,\n    \"body_fat_percent\": 15.0,\n    \"activity_factor\": 1.4,  // in [1.2, 1.6] range based on activity\n    \"protein_factor\": 1.8,  // minimum protein intake in [1.5, 2.3] range\n    \"fat_factor\": 0.8  // minimum fat intake 0.7 or larger\n  },\n  \"dietary_reference_intakes\": \"rda-male\", // (ear-male, ear-female, rda-male, rda-female)\n  \"meals\": [\n    {\n      \"name\": \"Breakfast [7AM]\",\n      \"foods\": [\n        {\"food\": \"Oat Rolled\", \"amount\": 40},\n        {\"food\": \"Blueberry\", \"amount\": 80}\n      ]\n    },\n    {\n      \"name\": \"Dinner [7PM]\",\n      \"foods\": [\n        {\"food\": \"Chicken Breast\", \"amount\": 150},\n        {\"food\": \"Cauliflower\", \"amount\": 100},\n        {\"food\": \"Olive Oil\", \"amount\": 13}\n      ]\n    }\n  ]\n}\n```\nThe `food` value must be one of the food's name defined in the `~/.nutrimetrics/foods/` directory.\n\nThe Dietary Reference Intakes (DRI) included in the package are the Recommended Dietary Allowance (RDA)\nand the Estimated Average Requirement (EAR) for male and female. Users can add their own requirement profiles\nin the `~/.nutrimetrics/dri/` directory.\n\n### Nutrient Profile Data\n\nThe package comes with 100+ nutrient profiles of common food. However, new data can be added by importing\nnutrient profiles  from USDA's FoodData Central (FDC). The `nutrimetrics-import` command reads a JSON file\nthat lists all foods names and FDC IDs to be imported, looking like this:\n\n```json\n{\n  \"foods\": [\n    {\"fdc_id\": 170567,  \"name\": \"Almond\"},\n    {\"fdc_id\": 170178,  \"name\": \"Macadamia Nut\"},\n    {\"fdc_id\": 170187,  \"name\": \"Walnut\"}\n  ]\n}\n```\n\nThe package provides a sample `~/.nutrimetrics/samples/foods.json` file you can use.\nBefore running the command you must edit `~/.nutrimetrics/config.json` to specify your own `api_key`\n(that you can get it [here](https://fdc.nal.usda.gov/api-guide.html) for free).\n\n```console\n$ nutrimetrics-import ~/.nutrimetrics/samples/foods.json \n```\nWill download and generate all JSON files in `~/.nutrimetrics/foods/` for each specified food.\n\nAlternatively you can create your own JSON files by specifying the amount of each nutrient for a given food.\nAll amounts are specified in grams. Nutrients that are not listed are set to zero by default. \n\n## License\n\n`nutrimetrics` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Thomas Civeit <thomas@civeit.com>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Analyzes nutrients found in foods and user-defined meal plans.",
    "version": "1.0.0",
    "split_keywords": [
        "analysis",
        "calculator",
        "calorie",
        "counter",
        "diet",
        "food",
        "meal",
        "nutrient",
        "nutrition",
        "tracker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd35d93108872ba23892573548ab6c130bc60ea45a03dc7aa3e7b2e6fbf7d313",
                "md5": "0b9850ca911a225112d779642ab6d88b",
                "sha256": "54c5ba82a65c4a0209a42a569baaa2f32d9c23ffe7b381a425ba2f69735e0d96"
            },
            "downloads": -1,
            "filename": "nutrimetrics-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b9850ca911a225112d779642ab6d88b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 139711,
            "upload_time": "2023-04-06T23:36:58",
            "upload_time_iso_8601": "2023-04-06T23:36:58.541910Z",
            "url": "https://files.pythonhosted.org/packages/dd/35/d93108872ba23892573548ab6c130bc60ea45a03dc7aa3e7b2e6fbf7d313/nutrimetrics-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c7d590c1ac9549998638b60bc363dc6e5e5bca7f5a24827d2fb1f76ddfc9c0b5",
                "md5": "8461922588022d80a65985d96afbbd9e",
                "sha256": "43643bcf09652bd30f95f933ce31094c272017c1fd5a9a10051f1cff0bdc0e22"
            },
            "downloads": -1,
            "filename": "nutrimetrics-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8461922588022d80a65985d96afbbd9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 255308,
            "upload_time": "2023-04-06T23:37:00",
            "upload_time_iso_8601": "2023-04-06T23:37:00.966564Z",
            "url": "https://files.pythonhosted.org/packages/c7/d5/90c1ac9549998638b60bc363dc6e5e5bca7f5a24827d2fb1f76ddfc9c0b5/nutrimetrics-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-06 23:37:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "nutrimetrics"
}
        
Elapsed time: 0.06028s