Skip to main content

A simple CLI timer to calculate fasting zones.

Project description

🍞 🍏 🥩 Food Diary

PyPi flake8 Code style: black License: MIT

This script calculates approximate number of calories, proteins, fats & carbohydrates which I consume during a day.

Of course, I'm aware that there are countless tools to solve the task, on smartphones especially. Furthermore, I've tried to use many of them, but gave up eventually. Some of them lose my data without a reason, some have terrible UI, and almost each one dreams of selling me a paid subscription. Gosh, I just need one simple function!

So I decide:

Fine, I'll do it myself

☺ Installation

pip install foodlog 

🤔 How to use it?

There are two YAML files: catalog.yaml which contains food you used to consume and journal.yaml which contains products you have eaten.

Let's imagine that today is March 27, and you have eaten two apples for a lunch. If it's first time you eat an apple, you open catalog.yaml and write something like:

apple: 
  calories: 54
  protein:  0.4
  fat:      0.4
  carbs:    9.8

Then you open journal.yaml and write the name of food you just added to the catalog and its weights in grams:

2022-04-27:

- apple: 114
- apple: 129

First line here is a current date in the YYYY-MM-DD format. The journal may consist of many of them. For example:

2022-04-26:
  
- apple: 120  
- bread: 403
- pizza: 356

2022-04-27:

- apple: 114
- apple: 129

Having catalog & journal both filled, it's possible to see how many calories and macronutrients you've consumed. Run this in a working directory:

foodlog

For instance, script output may look like this:

FOOD                   CALORIES        PROTEIN         FAT             CARBS           GRAMS          

peremech               539             22              31              45              198            
fish in batter         500             49              23              21              250            
ham                    361             54              13              9               361            
apples                 262             2               2               48              485            
yogurt                 228             11              9               26              190            
peach                  131             3               0               32              285            
watermelon             126             3               1               29              502            
sweet corn             82              3               0               18              163            
drinking water         0               0               0               0               800            

TOTAL                  2229            147             79              228                            

Balance today                          32%             17%             50%                            
Target ranges                          45%             25%             30%                            

Daily calorie intake is 1803 kcal; excess is 426!

Body weight dynamic:
- yesterday    109.1
- today        109.1

You can find all configurable parameters of the script (calories limit, target ranges of macronutrients etc.) in the profile.yaml file.

🧐 How can I take water I consume into account?

There are no calories & macronutrients in water. Consequently, you can add a record like this one to your catalog.yaml file:

h2o:
  calories: 0
  protein:  0
  fat:      0
  carbs:    0
water: h2o

From this point, you can use these identifiers like other ones in your journal.yaml file. The script still shows you how much water you consume in the GRAMS column of daily statistics; for instance:

FOOD                   CALORIES        PROTEIN         FAT             CARBS           GRAMS

apples                 157             1               1               28              290
ham                    103             11              4               6               124
water                  0               0               0               0               800

There is no balance value for a day, but you are free to decide what is your norm.

By the way, you may use this method to control your intake of other products which have no calories. Coffee, for instance.

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

foodlog-0.2.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

foodlog-0.2.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file foodlog-0.2.0.tar.gz.

File metadata

  • Download URL: foodlog-0.2.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for foodlog-0.2.0.tar.gz
Algorithm Hash digest
SHA256 35b6661bce58ae25db3f10d8c0862425108b7852f04dc594e973e3e6c277b7fd
MD5 331278aeebfcb154f64c52de1221e364
BLAKE2b-256 8c542a6ea12d7c83d0193da82624c0d728b8ea84f93071759bf6a7dc251d184a

See more details on using hashes here.

File details

Details for the file foodlog-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: foodlog-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for foodlog-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c9f8386173956594224f8f82fd8a7002d8adc4180cfdbdf51660549d9309b24
MD5 e95f9c492527abbf847c4e3e4a38eb41
BLAKE2b-256 92aa4c592dc122b29d279eef557bb95bd42f382a06d845fea18f729612356ba8

See more details on using hashes here.

Supported by

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