Skip to main content

Round nutritional values for federal compliance.

Project description

Code style: black pre-commit.ci status build PyPI

round-nutrition

A lightweight Python package to round nutritional values for federal compliance with FDA and NDC regulations.

Example

>>> a, b = Main(), Vitamin()
>>> print([a.tot_carb('0.8 g'), b.vitamin_k('125.5mcg')])
['less than 1 g', '126 mcg']
>>> print(a.tot_carb('0.8 g', minimal=True))
'<1 g'

Setup

First, install the package with:

$ pip install round-nutrition

Then, import the module with the desired nutrient(s):

from round_nutrition import Main # Vitamin, Mineral, Other

Usage

All subnutrient methods take in an integer or string argument of quantity.

          Main                    Vitamin                  Mineral                  Other
      added_sugars*           biotin                      calcium                  choline
      calories                folate                      chromium
      cholesterol*            niacin                      copper
      dietary_fiber*          pantothenic_acid            iodine
      insoluble_fiber*        riboflavin                  iron
      mono_fat*               thiamine                    magnesium
      other_carb*             vitamin_a                   manganese
      poly_fat*               vitamin_b12                 molybdenum
      potassium               vitamin_b6                  potassium
      protein*                vitamin_c                   phosphorus
      sat_fat*                vitamin_d                   selenium
      sodium                  vitamin_e                   zinc
      soluble_fiber*          vitamin_k
      sugar_alcohol*
      tot_carb*
      tot_fat*
      tot_sugars*
      trans_fat*

*Some functions have an additional boolean argument of minimal that can be set to True for a cleaner user interface implementation. By default, this parameter is set to False.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

round-nutrition-1.0.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

round_nutrition-1.0.4-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file round-nutrition-1.0.4.tar.gz.

File metadata

  • Download URL: round-nutrition-1.0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for round-nutrition-1.0.4.tar.gz
Algorithm Hash digest
SHA256 73246d75688793db557e8d1a144f069eeb6c6ffbbc8c8dfa7c0e893775b18f96
MD5 c2dcaaa954abe76c535c51f43ebd33dc
BLAKE2b-256 31a29fa49614dd055aeeeea891c27a2458b182fa218ae9d3064ad85f74ef03b8

See more details on using hashes here.

File details

Details for the file round_nutrition-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for round_nutrition-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dbd3543b40203703ebc65709b20190361743ffd36a7355098ef619cc063970eb
MD5 371f6bdd15c88ee1a032374c6c56ee08
BLAKE2b-256 531835068bbf74d0573ebedebd7eef7a5cbca03cb34c4eca62bb64fca0142bb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page