Skip to content

Create Calorie Tracking app w/ health integration#4142

Open
RKBoss6 wants to merge 92 commits intoespruino:masterfrom
RKBoss6:caloriesApp
Open

Create Calorie Tracking app w/ health integration#4142
RKBoss6 wants to merge 92 commits intoespruino:masterfrom
RKBoss6:caloriesApp

Conversation

@RKBoss6
Copy link
Copy Markdown
Contributor

@RKBoss6 RKBoss6 commented Jan 25, 2026

Creates an app for calorie tracking that resolves #4092, that counts calories burned in a day and splits it by BMR, Active, and total calories. Uses MyProfile to get user health data, and hooks onto health events for new data. Also modifies myprofile to use RHR readings as an additional piece of data, with its own measurement UI.

Check it out at my app loader

RKBoss6 and others added 30 commits January 23, 2026 19:09
Add metadata for Calorie Tracker application
Expanded the README to include the calorie calculation formula and its components, enhancing user understanding of the app's functionality.
Refactor logic for setting resting heart rate and round max heart rate calculation.
Added instructions for taking Resting Heart Rate (RHR) measurements, including tips for optimal conditions and app navigation.
@thyttan
Copy link
Copy Markdown
Collaborator

thyttan commented Feb 27, 2026

Should we try to get this one over the finish line? I'll probably have some time to look closer again sunday morning :)

@RKBoss6
Copy link
Copy Markdown
Contributor Author

RKBoss6 commented Feb 27, 2026

Yes, that sounds good! I won't have that much time to do it for a while, but I can take a look at it in bits and pieces and get it done gradually :)

@thyttan
Copy link
Copy Markdown
Collaborator

thyttan commented Feb 27, 2026

Ok, no stress 🙂

@RKBoss6
Copy link
Copy Markdown
Contributor Author

RKBoss6 commented Mar 3, 2026

@thyttan do you happen to have another smartwatch lying around that can track calories already? I want to compare the accuracy of the tracker, so I will wear both for a day and see the difference in calories, with an old garmin lying around. If you can, can you do the same? That way we can test for different ages, values, etc...

@thyttan
Copy link
Copy Markdown
Collaborator

thyttan commented Mar 3, 2026

Nope, don't have a Gramin or similar I'm afraid.

@RKBoss6
Copy link
Copy Markdown
Contributor Author

RKBoss6 commented Mar 3, 2026

Ok, no worries! I'll collect some data to see if it's accurate

Comment thread apps/calories/lib.js Outdated
Comment thread apps/calories/lib.js Outdated
throw new Error("Invalid or missing heart rate data");
}

// Age-adjusted MET values for better accuracy across age groups
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to read a source on age-adjusting metabolic rate values. Do you have one?

Copy link
Copy Markdown
Contributor Author

@RKBoss6 RKBoss6 Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm not sure - I ran it through AI to see if it would scale appropriately for different ages, and it told me this. I'm not sure whether it makes a difference, as I haven't tested this fully yet, but I'll get to testing hopefully soon.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. If you don't find a source backing it up I think we should pull it out and not have age affect the calculation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait to pull it out until after i've tested with a garmin, so if any formula changes need to be made, I'll do it all in one swoop :)

Copy link
Copy Markdown
Collaborator

@thyttan thyttan Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of changes are you thinking about doing if the Garmin and this app show very different values?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that by better you mean 'more like Garmin'. Which is probably an ok comparison given they have more resources to get it right. But at the same time they don't represent some perfect ground truth (which we'll never have of course).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm just going to leave this with the accuracy checks for another PR to improve this. It will take lots of time to change the formula entirely, and would rather change it with other accuracy improvements.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's ok for the most part. But I don't want to merge the age multiplier stuff if we don't have evidence backing it up. I may pull it out myself before merging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the age adjust functionality - I kept the age multiplier, so we can tweak/work on it more later without having to reconstruct the formula.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - but where have you learned about age adjusted metabolic rate?

@thyttan
Copy link
Copy Markdown
Collaborator

thyttan commented Mar 7, 2026

It seems the calories goal drop down notification will persist indefinitely if not dismissed. I think it would be good if it timed out after a minute or two, or even just 10 seconds. What do you think?

@thyttan
Copy link
Copy Markdown
Collaborator

thyttan commented Apr 21, 2026

@RKBoss6 Should we get this over the finish line? Since we spent a bit on time working on it it would feel nice 🙂

@RKBoss6
Copy link
Copy Markdown
Contributor Author

RKBoss6 commented Apr 21, 2026

Yes of course! I've been quite busy and haven't gotten time to test it with a baseline watch, so I think we save that for another day, and just get this app over the finish line! Thanks for putting up with this for so long @thyttan!

@RKBoss6
Copy link
Copy Markdown
Contributor Author

RKBoss6 commented Apr 21, 2026

It seems the calories goal drop down notification will persist indefinitely if not dismissed. I think it would be good if it timed out after a minute or two, or even just 10 seconds. What do you think?

I had based this on the health app, which afaict does the same thing - it feels nicer having it persistent until you dismiss it, showing it's read rather than you not knowing if it times out. Users can disable it in settings...

@RKBoss6
Copy link
Copy Markdown
Contributor Author

RKBoss6 commented Apr 22, 2026

Alright @thyttan , I think this is finally good to go! On my end it looks like I addressed all your comments and fixed them, so if it's good to you, we can get this merged!

@thyttan
Copy link
Copy Markdown
Collaborator

thyttan commented Apr 22, 2026

Awesome work! I'll take a look 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Burnt calories support?

3 participants