Open lpierron opened 4 months ago
To help, I wrote a little program to get the VO2Max on my Garmin Connect account with garth
:
vo2max.py.zip
Partial result of running VO2max.py
:
-------------------- api.get_max_metrics('2024-07-31') --------------------
[
{
"userId": 50448457,
"generic": {
"calendarDate": "2024-07-31",
"vo2MaxPreciseValue": 38.0,
"vo2MaxValue": 38.0,
"fitnessAge": 52,
"fitnessAgeDescription": null,
"maxMetCategory": 0
},
"cycling": null,
"heatAltitudeAcclimation": null
}
]
---------------------------------------------------------------------------
-------------------- api.get_max_metrics('2024-08-01') --------------------
[]
I found the problem and solution.
Since May 2024, Garmin JSON activity files do not export some fields with a null
value like avgVerticalOscillation
.
So in this program, the variable avg_vertical_oscillation
is set to None
and an exception occurs at line #119:
https://github.com/tcgoetz/GarminDB/blob/e52ebc2f7f1e92d4607d718af5db961ffedea2f9/garmindb/garmin_json_data.py#L108-L123
So I suggest to modify _get_field_obj
in idbutils/json_file_processor.py
:
https://github.com/tcgoetz/utilities/blob/5ce3f712f34818cddf5327cd827a480989ff6940/idbutils/json_file_processor.py#L79-L84
and replacing by:
def _get_field_obj(self, json, fieldname, format_func):
try:
data = json[fieldname]
return format_func(data)
except KeyError as e:
self.logger.debug("JSON %s not found in %r, setting to `0`: %s", fieldname, json, e)
return format_func(0)
No more VO2_max in
steps_activities
table since 2024-05-23Open
garmin_activities
database with sqlite3.Log example:
You can see that all
running
andwalking
activities since 2024-05-23 have noVO2_Max
data.