Skip to main content

🍞 🍏 🥩 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.

Metadata

Release files for foodlog 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foodlog 0.2.1
File Size Uploaded Provenance Actions
foodlog-0.2.1.tar.gz 10.9 kB Without provenance Details for foodlog-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for foodlog 0.2.1
File Interpreter ABI Platform Actions
foodlog-0.2.1-py3-none-any.whl Python 3 none any Details for foodlog-0.2.1-py3-none-any.whl

Total release size: 21.9 kB

Release files / foodlog-0.2.1.tar.gz

Download URL foodlog-0.2.1.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2b6491b70dd9231a1a74f2dda675e9cbab1fc333e789228f68ac176630d90ed
BLAKE2b-256 checksum
How to use checksums
d3c962a57440e2eb6755ad0ce835f54727484df44668f9313ba114f4230638a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / foodlog-0.2.1-py3-none-any.whl

Download URL foodlog-0.2.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
618fe51acbf8990d3f7004be404d33e6128cb0bda668242fbaf2065b39c17509
BLAKE2b-256 checksum
How to use checksums
c0c5a3c8ab361dc16780fb78d66b49acf14ebd7bb9d2f6d14e17df8c898d57d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for foodlog 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page