davidhealey / waistline

Libre calorie counter app for Android. Built with Cordova.
562 stars 66 forks source link

[Feature] Consider data from wearable devices #71

Open yarons opened 5 years ago

yarons commented 5 years ago

I have Mi Band 2 for example and if I could have my data it could be the closest to the real measurement of lost calories as possible.

davidhealey commented 5 years ago

Can't you just take the number it gives you and enter it into Waistline?

yarons commented 5 years ago

With apps like Gadgetbridge you don't even need to decipher the watch data, you can just communicate with this app and calculate this automatically.

I sure can do it manually but it would be super awesome to just configure it once and let the data flow without any user intervention.

davidhealey commented 5 years ago

Well I know nothing about fitness trackers or how to write apps for them, so I'll leave this request open for anyone else who wants to try and make this happen.

yarons commented 5 years ago

What about interfacing with external apps? The bug I referenced from is the equivalent from the Gadgetbridge side and there's also an idea about interfacing with OpenScale as well (to measure actual weight without sending the data to Xiaomi).

Would you like to interact with those guys and try to figure a way of working together on the collaborative data you can gather for the user? (They are super thrilled about your project :smile:)

davidhealey commented 5 years ago

If they have some kind of API I can pull data from that would be ok but since their app (OpenScale) is a native Android app and mine is a website pretending to be an app I'm not sure how much we could directly interface with each other. I'm also just working on this when I have free time as mobile app development is not really my thing, I just wanted a free calorie counter :)

yarons commented 5 years ago

They have CSV export but if we want something more automatic than that it will take some further adjustments to the system, Gadgetbridge also support data export. I think supporting their CSV format is good enough at that point, after it will be out there people will be more motivated to help in any way to make this integration more tight.

davidhealey commented 5 years ago

There are two things that will need to be tackled to get this working. Waistline doesn't have any CSV parser so that will need to be added, there's probably a library for it. Waistline also doesn't have access to any files outside of it's own little bubble, this is mainly for security, so some kind of file browser will need to be implemented.

yarons commented 5 years ago

I can ask and see because I think it's pretty trivial in terms of HTML5, I never implemented but it should be something like this: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file The browser interpreter should do the rest, now the only thing left is to add the permissions on the Android level and possibly parse the CSV :smile:

If there's anything you need from the guys at openScale or Gadgetbridge they seem pretty nice and willing to assist.

davidhealey commented 5 years ago

I'm not sure how the HTML5 browser is interpreted by Cordova but I'll try it out next time I'm tinkering with the code, it will be interesting to see what folders it allows access to and what permissions it reveals.

yarons commented 5 years ago

You're right, it's not super straight forward yet possible: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/

If you need my help I'll be glad to do whatever I can, thank you!

davidhealey commented 5 years ago

Along with this feature I'd like to implement a way to get data from MyFitnessPal into Waistline. This import feature will require a few days work and won't happen soon as I don't have the time but I'll get it done when I do have the time.

yarons commented 5 years ago

Giving the entire picture is a great goal because as we all know, health is a multidisciplinary effort :smile:

oliexdev commented 5 years ago

I am the maintainer of openScale @yarons open on https://github.com/oliexdev/openScale/issues/336 a new issue with the request to provide the openScale data to waistline or other 3rd party apps. I just wanted to let you know that I am wiling to support this. A simple content provider was just released in the latest openScale version 1.8.2. An example app how to grab the data via the openScale content provider was created by @erijo on https://github.com/erijo/openScale/tree/connector. If you have a question feel free to ask.

Tinsus commented 2 years ago

Maybe a new idea to solve the idea posted to get data from wearable devices: if the device data is somehow connected to Google Fit you could get e.g. step count, weight whatever you want from where. It also supports a REST-API (check out https://developers.google.com/fit/rest) this could be way less difficult than supporting every possible app on its own.

davidhealey commented 2 years ago

Maybe a new idea to solve the idea posted to get data from wearable devices: if the device data is somehow connected to Google Fit you could get e.g. step count, weight whatever you want from where. It also supports a REST-API (check out https://developers.google.com/fit/rest) this could be way less difficult than supporting every possible app on its own.

Does this require uploading user data to Google's servers?

Tinsus commented 2 years ago

Does this require uploading user data to Google's servers?

I did not work with this API, so I can only say what is in the docs. As I understand it (see https://developers.google.com/fit/rest/v1/datasets part: Get a dataset) you send a GET-request only containing your app's API-key, the information what data you want to get. I don't see a necessity to send users data (recorded data from the app itself) to Google. The user himself must authorize the app once to get the data. If you want to send users data, you need to send PATCH or POST-requests. (but that would be another feature).

So: I think it should be possible - but I have no practical experiences with that, so it needs to be tested.

Nitrousoxide commented 10 months ago

Integration with fitness tracking platforms would be nice it would enable you to theoretically auto-add additional calories to the budget on a given day based on the amount worked out. Chronometer does this. Provided this as @Tinsus said the only thing being sent to google/samsung's servers is the api-key and all the data parsing is done locally this doesn't have any privacy implications.