Skip to main content

A simple CLI timer to calculate fasting zones.

Project description

🍞 🍏 🥩 Food Diary

PyPi pylint 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.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

foodlog-0.2.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: foodlog-0.2.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for foodlog-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a2b6491b70dd9231a1a74f2dda675e9cbab1fc333e789228f68ac176630d90ed
MD5 cd0b59b6b73dfb063397f60d1b64ce26
BLAKE2b-256 d3c962a57440e2eb6755ad0ce835f54727484df44668f9313ba114f4230638a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: foodlog-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for foodlog-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 618fe51acbf8990d3f7004be404d33e6128cb0bda668242fbaf2065b39c17509
MD5 043cbf91af8aa4b81b0c4a41a39d8f01
BLAKE2b-256 c0c5a3c8ab361dc16780fb78d66b49acf14ebd7bb9d2f6d14e17df8c898d57d4

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