This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Activity data download for personal use

Hi all,

it's about a year I use a Garmin device (Fenix 6s) to keep track of my workouts (mainly strength training), I produced a lot of data I want to analyze and I find a little awkward the way that data is available for personal use. 

I wrote an article on this in the form of an open letter to Garmin, I know I'm not the only one complaining about this but I hope someone at Garmin has the patience to read these words.

Here's the link at the article:

medium.com/.../open-letter-to-garmin-a1c846895ad6

Feel free to share, repost, comment If you agree

R

  • If you export all your data, you get a messy ZIP file, but there is a lot of interesting stuff in it. Daily summaries are available in JSON files named UDSFile_date_date. There are fields you never see in Garmin Connect, for example:

    • average stress level when sleeping/awake
    • minimum heart rate for the day
    • resting heart rate for the day and time when it was recorded (it can be during the evening sleep)

    There is also *summarizedActivities.json with stats for all your activities.

    For more detail, like every single measurement of the heart rate, FIT files could also be read (there is a Python parsing lib somewhere for that), but I didn't get into it yet.

    Here is a small script that converts some data from the UDSFile to CSV so it can be used in a spreadsheet. Usage: python parse.py UDS_x_y.json >output.csv

    import json
    import argparse
    
    parser = argparse.ArgumentParser()
    parser.add_argument("file")
    args = parser.parse_args()
    
    with open(args.file) as json_file:
        data = json.load(json_file)
        print('Date,,minHeartRate,restingHeartRate,allDayStress,sleepStress,awakeStress')
        for p in data:
            print('{},{},{},{},{},{}'.format(
                p['calendarDate']['date'],
                p['minHeartRate'],
                p['restingHeartRate'],
                p['allDayStress']['aggregatorList'][0]['averageStressLevel'],
                p['allDayStress']['aggregatorList'][2]['averageStressLevel'],
                p['allDayStress']['aggregatorList'][1]['averageStressLevel']))
                

  • Hi ,

    thank you for your reply, definitely I'll give a try to this export file, it seems to contain all the missing data. Unfortunately this makes the update procedure even worst, now I can call an API directly from Google Sheets in order to get the data and convert it in the Sheets format; downloading a zip file I have to manually convert (with your script or something similar), then I have to make a diff between the files and then load them in Google Sheets. It seems to be a lot of extra work...

    I hope Garmin will make available for the community a set of documented REST APIs returning JSON files

    Thanks again!

    Best,

    R

  • Sorry ,

    it doesn't seem to be that immediate, how can I download all my data and get the zip file?

    Thank you

    Best,

    R

  • I am trying this with my activity data. (using xxxgmail.com_0_summarizedActivities.json as it has a ton of data). I have used this as a guide. How do I define the JSON file in the script? (I renamed (shortened) so less likely to miss type). I pulled my (where do I need to place the JSON file? (I see no path statement). 

  • I have the Python script and the data file in the same folder, so I use no path. But the args.file argument also works with a path, I just tried:


    py parse.py c:\temp\UDSFile_2023-06-30_2023-10-08.json >x2.csv

  • I will give that a try. Thanks!