cyberjunky / python-garminconnect

Python 3 API wrapper for Garmin Connect to get activity statistics
MIT License
963 stars 149 forks source link

Stress data empty before May 1st #222

Open GandalftheProgrammer opened 2 months ago

GandalftheProgrammer commented 2 months ago

I'm not sure if I'm missing something here, but somehow the API only gives me all day stress data from May 1st this year, where Garmin Connect is showing stress graphs before that date. The issue seems to be present both with get_stress_data and get_all_day_stress. Does anyone knows why this happens and know how to access daily stress data before this period?

psdupvi commented 1 month ago

I'm running into this issue too. I also tried the GraphQL Endpoint I've looked at in #207 and #210, but this same limitation seems to apply there -- still no data over four months old (or rather, from more than four months before the start of this month, e.g., we now have June, July, August, September, October)

However, it's actually occurring on the website too:

image

For me, it's now empty before June 1st. Today being October 4th, that implies they only show the last four months now by default, or something like that.

I then have to click "Reload", which POST request to https://connect.garmin.com/wellness-service/wellness/epoch/request/2024-04-04, and then the data appears.

Once I submitted that Reload, the data shows up in my API and on my webpage.

It seems they've made a change under the hood to not show super old data -- maybe they transitioned it to a different storage facility (e.g., AWS Glacier or something)

You might be able to get away with automatically querying an endpoint like the one above then querying the other endpoint, but that might piss Garmin off, so use it with caution.

As an aside, I strongly recommend using all the endpoints to download your data and save it yourself every day. I've done this for about 3 years now, and the total storage is pretty small. It's well worth it for things like this, or if Garmin ever shuts down (possible in the long run!)

GandalftheProgrammer commented 1 month ago

Yeah you're right, I noticed the same, clicking 'load graph' somehow releases data for that specific date, for which you have to wait a bit longer and for which there's limited requests, like 25-30 per day. Also, it only stays available for 1 week. I'm modeling my fitness as a function of (amongst others) daily recovery by analyzing deep sleep stress data on the day before each run. I'm not a seasoned programmer, actually it's a miracle that with some friends help I managed to get python with this api wrapper going. So I didn't know how to query an endpoint like you mentioned in python (I tried it with help of chatGPT but no luck). So I just went clicking on 'load graphs' for those specific days, waiting a day to get new budget and doing it over again, and I managed to get the relevant stress data for those days out. And indeed, I'm now all saving it to a accumulating csv.

I was wondering, as general programming is not my expertise, coding in Matlab and data analysis/modeling is. Is there interest in somehow contributing my data analysis on fitness on multiple variables? For example, Garmin (at least my watch) doesn't give you proper measurements for your fitness, only how often, long and hard you run. And then gives a -shitty- interpretation of VO2 max, which doesn't change much, as well as crap like fitness age.

I now made a multivariable analysis between fitness (I measure it in meters/heartbeat of comparable runs after 18 minutes) and:

and I correct for:

To give you something like the figure below. In that way you can start investigating how your different trainings, wellness, recoveries etc are influencing your fitness. So you can clearly see your improvement and work on it!

image

psdupvi commented 1 month ago

Disclaimer: I'm not the maintainer, so this is just my opinion

It seems like the main point of this package is to help get data in and out, without worrying so much about analyzing the data. Pretty much every method is just extracting or adding data to/from Garmin. Personally, I think what you've done is pretty interesting, and I'd love to see how it works/apply it to myself (I do some similar stuff on my own). However, I'd recommend creating a separate repo where you make it available, and reference that it depends on this package.

I think the About on the Readme for this package suggests a similar scope:

This package allows you to request garmin device, activity and health data from your Garmin Connect account. See https://connect.garmin.com/

That said, someone did recently add an example gear tracker as a separate file, so it could be interesting to add an "Example Usages" folder with some of the stuff people have built on this. However, the gear tracker is basically just one function, so it's pretty lightweight, whereas I'm guessing yours is a bit more involved (and also pretty neat!)

Again, that's my personal opinion, and I am not the maintainer of this package, just a contributor

cyberjunky commented 1 week ago

@psdupvi @GandalftheProgrammer I noticed an increase in PR's and variety of use cases for my project, I won't mind to dedicate a folder and/or README/wiki to describing more examples.