Calories & Carbs & Fiber, Oh My

655 views
Skip to first unread message

Mark S.

unread,
Apr 10, 2018, 7:24:31 PM4/10/18
to TiddlyWiki
 I was looking at the Keto diet, and noticing how complex it was to keep track of multiple factors.

This is a mini-application to allow a user to keep track of calories, carbs, and fiber. It could be easily extended to keep track of other metrics like fats or vitamins.

Be sure to make a backup of your tiddlywiki before trying. You will need a copy of Evan Balster's formula's plugin (link is included in documentation). Then drag and drop the JSON into your app. Save and reload.

After loading, you can read how to use it by looking at tiddler "Calorie Counter". I only included a handful of the food items I've set up, but I could include more if there turns out to be a demand.

This app needed a couple of aggregation formulas in addition to Evan's original plugin set. If there was a way to do that without my own aggregation formulae, I would be interested to learn of it.


Have fun

-- Mark
CalorieCounter2018-04-10.json

Morgaine O'Herne

unread,
Apr 11, 2018, 9:30:17 AM4/11/18
to TiddlyWiki
Two members of my family are on low-carb diets due to Diabetes.  This will come in handy. Thanks!

@TiddlyTweeter

unread,
May 5, 2018, 10:58:12 AM5/5/18
to TiddlyWiki
Ciao Mark S.

That is good! I would appreciate any further data you have.

FYI, I practice Keto most by fasting twice a year. But am interested in maintaining a Keto diet in-between fasts, which is really not easy. I mostly worry about vitamins & trace elements.

Josiah

Mark S.

unread,
May 5, 2018, 12:48:16 PM5/5/18
to TiddlyWiki
It can easily be expanded to track whatever vitamins you're concerned with. The main thing is doing the research for each food, and then recalibrating it for whatever metric you tend to use. So, for instance, I'm interested in Potassium, but I would have to go back and research each food for K, which is a bit time consuming.

My concern about distributing my whole kit of foods (about 20 now I think) is whether the dietary info is copyrighted. You might think that actual facts can't be copyrighted, but I'm not so sure since one source may say an banana is 89 calories and another 90 calories. One source may have bumped its number to make it distinguished from competitors. There's probably more than +/- 3 calories difference in a lot of foods. These kinds of "purposeful" errors are how map companies track violators. Buying my own bomb calorimeter is somewhat impractical.

Since the last release, I've added a recipe calculator so you can calculate the value of dishes you prepare yourself (like breads and cookies). I should put everything together to make another release.

-- Mark

@TiddlyTweeter

unread,
May 5, 2018, 2:02:53 PM5/5/18
to TiddlyWiki
On Keto. Its a bit of an odd field. I'd think the whole thing should be simple forensics. But i'm often left not knowing what is what.

On doing actual fasting I feel on firmer ground.

Alfonso Arciniega

unread,
May 9, 2018, 11:07:41 AM5/9/18
to TiddlyWiki
The best nutrition database and tools for low-carb diets I found, and actually use them myself, are at https://www.atkins.com. You have to sign up (free) before you can use it though. Though not exactly the same, Atkins diet is based on the same principles of Ketogenic diet. I read the science at https://www.ketogenic-diet-resource.com, but use the easy tools at https://www.atkins.com.

However, if you sign up, the Terms of Use include the following:

No Commercial Reuse of Content
You agree not to reproduce, duplicate, copy, sell, trade, resell or exploit for any commercial purposes any material or Content of any kind You see, download or otherwise access on any of Ours Sites.

and

ANI's Proprietary Rights
You acknowledge and agree that Content contained in or information presented to You through the Sites is protected by copyrights, trademarks, service marks, patents or other proprietary rights and laws. Except as expressly permitted by applicable law or as authorized by Us or the applicable licensor, in writing, You agree not to modify, sell, distribute, transmit, broadcast, or create derivative works based on such Content, in whole or in part, for any commercial use or for any other purpose whatsoever.

Alfonso

Mark S.

unread,
May 9, 2018, 11:30:33 AM5/9/18
to TiddlyWiki
Certainly they want to protect their explanatory information. But they probably obtained caloric info from sources that were already in the public domain.

Like, if I publish the atomic weight of water on my copyrighted web site, I can't prevent other people from using the atomic weight of water in their published works UNLESS there is something special about my water (The Martha Stewart edition). That's my thinking.

There is a government database of 7000 items that are in the public domain, so maybe that would be a better start.

Thanks!
-- Mark

@TiddlyTweeter

unread,
May 9, 2018, 12:00:17 PM5/9/18
to TiddlyWiki
IMO the whole thing they doing trying to "protect" data is a bid for making it look like "grappling with Sisyphus" ... the two tricks ...

1 - you stole it because we said you couldn't enter the site and re-publish data ...

2 - we changed our values by 1.3 so we can spot you

In neither case do I think they have a stick of celery to stand on. Its basically intimidation. I guess if they had stats  for rhubarb grown on the moon they could make some kinda cases for special data.

J.

Mark S.

unread,
May 9, 2018, 1:23:45 PM5/9/18
to TiddlyWiki

I suppose I could do a reboot, pulling in stats from the USDA and expanding the nutrients. Except they seem to have too many:

Energy
Protein
Total lipid (fat)
Carbohydrate, by difference
Fiber, total dietary
Sugars, total
Calcium, Ca
Iron, Fe
Magnesium, Mg
Phosphorus, P
Potassium, K
Sodium, Na
Zinc, Zn
Vitamin C, total ascorbic acid
Thiamin
Riboflavin
Niacin
Vitamin B-6
Folate, DFE
Vitamin B-12
Vitamin A, RAE
Vitamin A, IU
Vitamin E (alpha-tocopherol)
Vitamin D (D2 + D3)
Vitamin D
Vitamin K (phylloquinone)
Fatty acids, total saturated
Fatty acids, total monounsaturated
Fatty acids, total polyunsaturated
Fatty acids, total trans
Cholesterol
Caffeine

I don't think many people need to track their daily intake of Vitamin C. You'll be happy to learn that broccoli has no caffeine.

Which Vits/mineral are worth it?

It would obviously take a bit of work.

-- Mark
































@TiddlyTweeter

unread,
May 9, 2018, 2:10:48 PM5/9/18
to TiddlyWiki
Big part of the problem is no one agrees. And there are a zillion diets.

Its probably easier to define the functional purpose of the selection rather than get into a complexity too far (Like the Christopher Robin Wednesday Diet).

For instance, Keto diets do need to know the proportions of protein, carbohydrates & fats in each common food. AND, for managing that diet, some indicator of the vitamins and minerals of each common food (but those don't need to be exact, just indicative).

Other diets, like the Carbohydrate Specific Diet (for those with celiac disease) need something quite different.

Unless you are pitching for "The All For Every Wo/Man Award" I'd go for your own focus of interest.

Heats the urn.
Josiah

Alfonso Arciniega

unread,
May 10, 2018, 5:27:41 PM5/10/18
to TiddlyWiki

Mark,

You may already know this: There's a service that pulls data from the web and lets you work on it: https://www.import.io/

Alfonso

Mark S.

unread,
May 10, 2018, 6:11:11 PM5/10/18
to TiddlyWiki

At $299 a month, I think I'll give it a pass. ;-)

In the case of the USDA data, it's all there in easily accessible form. It's just a matter of picking out the right items (not name brand items), massaging the data, and converting to Tiddler form. Also, not all the entries have the same nutrients, complicating things.

Boy, I wish I had known there was a market for web-scraping back when I still had the skills.

-- Mark

Mark S.

unread,
May 18, 2018, 11:35:58 AM5/18/18
to TiddlyWiki
Here's a TW nutrient database based on 8787 values from the USDA. It includes most of the minerals and vitamins, but omits "nutrients" like caffeine, starch, and alcohol. You can drag and drop foods into the calorie tracker app. Some of the entries are a bit arcane, but if you've been hankering for acorn stew or Alaskan Ice cream (fish with shortening) then here's the place to start. Keep in mind the following considerations:

Disclaimer:


The user must assume all responsibility for the use and accuracy of this data and it's transformations. No guarantee is made in regard to this data nor to the Calorie/Fiber mini-app.


Data taken from:

  • U.S. Department of Agriculture, Agricultural Research Service. 20xx. USDA National Nutrient Database for Standard Reference, Release . Nutrient Data Laboratory Home Page, http://www.ars.usda.gov/nutrientdata
  • U.S. Department of Agriculture, Agricultural Research Service. 20xx. USDA Branded Food Products Database . Nutrient Data Laboratory Home Page, http://ndb.nal.usda.gov

Caveats:


Each food item entry was pulled from the abbreviated nutrients file available at the USDA. The original quantities were stated in terms of 100 grams of food, but have been divided by 100 to give values per gram.


Each food item is meant to use grams as the input quantity, but the output units for each sub nutrient (vitamins, calories, etc.) varies by nutrient and follows the norms for that nutrient. That is, calories are in Kcal, fiber is in grams, potassium in mg, and folates in micrograms.


Before using a food item, be sure that it has been given a reasonable field-name value. The values were created based on the original titles. With 8700 entries there may be duplicates or other anomalies. The field-name values must conform to the naming conventions of TiddlyWiki fields, or they will not work.


This is just data. It doesn't include the app (see the other post in this thread). Having 8700 entries results in a very slow TW page, and you are unlikely to need all the foods unless you're having a really big party or, perhaps, a royal wedding.

There could be errors. It is up the user to assume all responsibility for the accuracy and quality of the results (e.g. don't blame me for that extra 10 pounds you put on).

Data at: http://nutrition-database.tiddlyspot.com/

-- Mark

@TiddlyTweeter

unread,
May 18, 2018, 1:06:15 PM5/18/18
to TiddlyWiki
Whoah!

Seriously useful.

I don't find it that slow. I'll write more when I used it with Tracker.

FWIW, I would revise this post to include a direct link to a working Tracker TW too so the user does not have to  backtrack the thread to find what you talking about.

Very best wishes
Josiah

Mark S.

unread,
May 21, 2018, 11:36:37 AM5/21/18
to tiddl...@googlegroups.com

Yes, I'll need to do that. But since there only seems to be 3 people interested in this topic, I figured I could continue working on improvements. I have a long/short form feature to make the display more manageable and I want to have it configurable so you can pick and track say 5 given nutrients.

I imagine people that are really serious about nutrient tracking has some app already that counts your steps, knows when you've been sleeping, and if you're naughty or nice.

The TW nutrient database forced my hand because it was too large to load into guugle.

-- Mark

@TiddlyTweeter

unread,
May 21, 2018, 2:16:34 PM5/21/18
to TiddlyWiki
Mark S. wrote:
Yes, I'll need to do that. But since there only seems to be 3 people interested in this topic, I figured I could continue working on improvements. I have a long/short form feature to make the display more manageable and I want to have it configurable so you can pick and track say 5 given nutrients.

Sounds really good.

FYI I tend to TRACK what I do on the soma thing on paper. I PLAN on computer.

The resource you enabled is really handy being in a TW because I can cut and select and edit to my interests. Having a humongous database of food values to draw on in a TW format is brilliant. I use data for planning & defining aims.

Tracking I mainly do on paper because its much easier to have that next to the bread board.

BTW, there are only 3 people here, and 30 of them are PMario.

Thanks
Josiah

Mark S.

unread,
May 21, 2018, 5:27:42 PM5/21/18
to TiddlyWiki

Tracking I mainly do on paper because its much easier to have that next to the bread board.

I often track on paper or a whiteboard. However, working out the results of the tracking is pretty tedious without *something* to massage the numbers.


The resource you enabled is really handy being in a TW because I can cut and select and edit to my interests. Having a humongous database of food values to draw on in a TW format is brilliant. I use data for planning & defining aims.

 Just updated adding in iron and riboflavin that somehow got left out (hey, there's like 44 nutrients!).


BTW, there are only 3 people here, and 30 of them are PMario.

What? Has he been cloning around?

-- Mark

Mark S.

unread,
May 26, 2018, 1:06:35 PM5/26/18
to TiddlyWiki
Presenting, Carbo Commander. Take command of your carbs! And other stuff.

http://carbocommander.tiddlyspot.com/

You can now track multiple nutrients* if you can find the data for them.

-- Mark

*(tested up to 6 -- range setting for up to 20 if you make the "save" tiddlers)

@TiddlyTweeter

unread,
May 26, 2018, 3:22:11 PM5/26/18
to TiddlyWiki
Great bit of work. I need study it more to know how to get the best from it.

Life is such there is always a small crack in the system :-)


Great stuff
Thank-you
Josiah
Auto Generated Inline Image 1

Mark S.

unread,
May 26, 2018, 3:59:03 PM5/26/18
to TiddlyWiki
Some of the captions were mangled to reduce space.

-- Mangled

Mark S.

unread,
May 26, 2018, 11:46:21 PM5/26/18
to TiddlyWiki
Oops. You may have been wondering where the configuration menu was. It is supposed to appear at the bottom of the opening documentation, but was lost due to a last minute name tweak. Now restored.

Sorry for the inconvenience ...
-- Mark

@TiddlyTweeter

unread,
May 27, 2018, 7:53:18 AM5/27/18
to TiddlyWiki
Suddenly it makes a lot more sense :-)

arun babu

unread,
Mar 6, 2021, 6:47:24 AM3/6/21
to TiddlyWiki
@Mark

Is it possible to make a dashboard in CarboCommander using dynamic tables in shiraz plug in or using TiddlyTables to view the DayLog of nutrient intake say for the last 30 days. 
I was planning to use Carbo Commander together with Odin's recipe plug in and a task manager plug in.

Zaphod Beeblebrox

unread,
Mar 6, 2021, 12:41:04 PM3/6/21
to TiddlyWiki
Hiya, Mark, et al (not taking into account any users actually named 'Al' :-P ) :)

I bookmarked this thread waaaay back in the long ago when it first appeared, meaning to delve into it in depth later and mine its goodness, but, alas, much H2O has passed beneath the proverbial span since then, and my TW skills (what there were of them, anyway) have dimmed and waned to the point that I forget how to use most parts of the darned thing...

In terms that a 3-year-old might understand, how do I download, assemble and use the Carbo Commander and its accompanying data, in a local file on my computer?

I can't figure out what to drag/drop to an empty TW to recreate what you have at TiddlySpot.

Also, while I have your ear, Mark, would I be correct in assuming that this 'application' would afford me the opportunity to add in my own items (thinking brand-name foods that I purchase), and enter in the nutritional information for each, and be able to sort, track, etc. on that data?

Really I'm most interested in 1) Carbohydrates, 2) Sodium, 3) Fat and 4) Protein in each item.

Don't get old, folks...

--Zaphod

Mark S.

unread,
Mar 6, 2021, 3:18:09 PM3/6/21
to TiddlyWiki
Wow. It's been almost 3 years without any interest. 2021 must be the year of Salt and Rice.
 
In terms that a 3-year-old might understand, how do I download, assemble and use the Carbo Commander and its accompanying data, in a local file on my computer?

Wah! Wha! Goo-goo bah wah!


I can't figure out what to drag/drop to an empty TW to recreate what you have at TiddlySpot.


Be sure to have a backup of your TW file. You need to drag over Evan Balster's spreadsheet plugin from the plugins. And you need to drag over:

DayLog ViewTemplate
FoodItem ViewTemplate
CarboConfig

If you want my pre-configured set of foods, you need to find something tagged with "FoodItem" and drag the tag to your file.

Also, while I have your ear, Mark, would I be correct in assuming that this 'application' would afford me the opportunity to add in my own items (thinking brand-name foods that I purchase), and enter in the nutritional information for each, and be able to sort, track, etc. on that data?


You can certainly set up your own foods. Whether you can do the things you want depends exactly on what you're thinking of. At the moment it just does what is presented -- allows you to keep a log of (theoretically) 20 nutrients. It tallies up the totals for your chosen nutrients on any given day. It presents the first nutrient in detail. You can copy an existing item, modify it (especially the "field" value). Then add that field name to your daily log fields at the bottom of your daily log tiddler. Inside the CarboConfig tiddler you can set how many nutrients to calculate, and which ones.

To facilitate the process of adding new foods, there is an existing database of 8000 items modified for CarboCommander over at:


It will take several seconds to load. Type into the search box some key term (e.g. "kellog", "banana", ) and you'll find dozens (hundreds?) of hits. Navigate to one that's close to what you want. Then drag and drop into your working TW file. Edit to suit your needs.
 
Really I'm most interested in 1) Carbohydrates, 2) Sodium, 3) Fat and 4) Protein in each item.

Carbs, Sodium, and Protein are fields that are already represented in the food database. For Fat, you'll either have to create your own field,  or use the more specific  FA Mono, FA Saturated, FA Poly which was how the USDA database represented the nutrients.

This was all built using Evan Balster's math formulae. Now there are enough math tools inside TW to do it without them. I guess if I was doing it now I'd use those instead, because I recall having to do a lot of tricky wikifying to get Evan's tools to work with this data.

Don't get old, folks...

Too late.

TiddlyTweeter

unread,
Mar 8, 2021, 10:35:53 AM3/8/21
to TiddlyWiki
Dear Mark 2018

Did it work?

Just asking for Outcome Fetishist.

TT 

Mark S.

unread,
Mar 8, 2021, 12:25:01 PM3/8/21
to TiddlyWiki
I lost significant weight which I had put on due to other stress factors. A little vague about how much weight because my initial scale was a junkyard collectors item. I learned what 2000 calories looked like, and what I needed to do to adjust my diet in terms of calories and fiber.

Other conclusions: (1) No one eating more than one fast meal a day can stay under their calorie requirements. (2) Most people with a Western diet are eating half the fiber they need every day. (3)  Unless you eat nothing but green leafy vegetables, you can't meet your DV of potassium.

A lot of people go on diets, lose weight, and then go back to the diet where they put on weight in the first place. Ideally, you find out how to make and purchase foods where you stay inside your ideal weight (or at least orbit it). And you learn how to make and enjoy foods that you might have once eschewed, so that you meet fiber requirements without maxing out calorie requirements. 

TiddlyTweeter

unread,
Mar 9, 2021, 4:15:26 AM3/9/21
to TiddlyWiki
Thanks Mark S. for the detailed reply. Most interesting!
TT

scot

unread,
Mar 10, 2021, 1:43:27 PM3/10/21
to TiddlyWiki
@ morgain...

Hi,
I think you may find these links useful.




The book, Life Without Diabetes by Professor Roy Taylor contains a rapid weight loss diet which really works and can in some cases reverse type 2 diabetes. I tried the diet and have lost just over 2 stones in just nine weeks.

Regards
Scot

Re: Two members of my family are on low-carb diets due to Diabetes.  This will come in handy. Thanks!

arun babu

unread,
Mar 17, 2021, 1:37:07 AM3/17/21
to tiddl...@googlegroups.com
@Mark,

Is there any way to add the values of the total amount  of calories and other nutrients consumed in a particular day into the fields of that particular day tiddlers tagged with DayLog. Currently it’s shown via view template in that day’s tiddlers. 

My use case - I need a table for showing   consumption of nutrients for each day tagged with DayLog and also in a tiddlers for each month. I was able to make such a dynamic table using Shiraz plug in. But I had to fill in the values calculated using formula plug in and currently shown via view template of the tiddlers tagged with DayLog into its fields manually.

My question is there any way to get those values added into the fields of tiddlers with DayLog tag automatically (instead of me adding it manually)

Thanks 
Arun 



--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d5d62596-df90-433c-8de0-4d481bb1da6dn%40googlegroups.com.

Mark S.

unread,
Mar 17, 2021, 5:05:16 PM3/17/21
to TiddlyWiki
Apparently I gave the wrong advice about my own code <sigh>.

You need to drag over everything tagged with "CalCarbs". My question is whether it still works under v23 or if security provisions will block the aggregator.

Mark S.

unread,
Mar 17, 2021, 5:06:57 PM3/17/21
to TiddlyWiki
I think my solution would be to add a button after each of the totals that would allow you to save the number into a field in the current tiddler. I know this may mean hitting four buttons on each tiddler, but the exercise is good for you!

arun babu

unread,
Mar 17, 2021, 6:14:44 PM3/17/21
to tiddl...@googlegroups.com
@Mark

Can you guide on how to add that button

Mark S.

unread,
Mar 18, 2021, 2:00:41 PM3/18/21
to TiddlyWiki
At its new but maybe temporary home at https://carbocommander.tiddlyhost.com/ , there is now a "save" button after each nutrient total. Click the "save" and the nutrient quantity will be saved in a field with structure

acc-<nutrient>

Hopefully this will allow you to adapt it to dynamic tables.

arun babu

unread,
Mar 18, 2021, 4:09:14 PM3/18/21
to tiddl...@googlegroups.com
Thank you Mark for this update. It works fine and will definitely help to avoid copy pasting those values into the fields. 

Thanks again. 
Arun.



Zaphod Beeblebrox

unread,
Mar 19, 2021, 6:53:25 PM3/19/21
to TiddlyWiki
Thank You so much for the reply, Mark! :)
Have downloaded everything and assimilated it into a local TW - Appears to be functioning. Now I just have to figure out how to actually USE it as I want to.

In terms that a 3-year-old might understand...

Wah! Wha! Goo-goo bah wah!

Still a bit above my head, but I ran it through Google Translate and was able to get the general gist of what you were saying :-P

Thanks again :)

--Zaphod
Reply all
Reply to author
Forward
0 new messages