Skip to content

AlexAlgarate/Correct-Elevation-Strava

Repository files navigation

Correct elevation from Strava activities

Overview

This project addresses the issue of the malfunctioning barometric sensor in Garmin Fenix devices, causing inaccurate elevation data to be displayed (it's a widespread issue in the Garmin Fenix 3 range). By leveraging Strava's correction feature for elevation data, the project aims to provide a solution to this problem (as you can see in this example, many people have the same issue as me with older activities).

Strava's elevation correction process involves cross-referencing GPS data with their database of barometric data to ensure accurate elevation readings. Elevation data on Strava is smoothed and thresholds are set to maintain accuracy, particularly for activities recorded on devices without a barometric altimeter.

Functionality

The program automates the process of correcting elevation data on Strava for activities recorded with Garmin Fenix devices experiencing barometric sensor issues. It follows a set of steps outlined below:

1. Create a Strava API using the provided guide.

Image of Strava webpage where you can create the API


2. Fill in the required credentials (CLIENT_ID, SECRET_KEY, USER, PASSWORD) in a .env file.

Image of the .env file with the name of variables and theis example values


3. Setup virtual environment

  • Linux:
python3 -m venv .venv
source .venv/bin/activate
  • Windows:
python -m venv .venv
.venv\Scripts\activate

4. Install the project dependencies using PIP

pip install -r .\requirements.txt

The following steps are automated when running the program:

python ./main.py

1. Obtain an access token to make API requests to Strava.
2. Fetch activity IDs for running and cycling activities with 0 meters of elevation gain.
3. Utilize Selenium to automate the elevation correction process on Strava by logging in, navigating to the activity URLs, and initiating the correction process.

Additionally, it's worth mentioning that the program automatically handles token management. The access token, refresh token and expiration date are stored in the .env file. Upon subsequent use, the program will automatically retrieve the token, check for expiration, and generate a new one if necessary.

Example

  • Example of some running activities with elevation (corrected by Strava) and others with 0 meters of elevation that need to be corrected with the program

Image of Strava webpage displaying some sport activities


  • Example of an activity recorded by Garmin Fenix with 0 meters of elevation gain, requiring correction using Strava options.

Image of Strava webpage of one running activity with 0 meters of elevation gain


  • This is the menu options of each activity where various parameters can be edited, including the one we need, 'correct elevation'.

Image of the menu options of the running activity


  • When we click on the 'correct elevation' button, a popup window appears where we confirm the operation.

Image of the popup window where you can confirm the proccess


  • And this is the final result, an activity whose elevation has been corrected using Strava's databases.

Image of Strava webpage where the activity has been corrected


Conclusion

By automating the elevation correction process on Strava, users can ensure accurate elevation data for their activities, mitigating the impact of barometric sensor issues in Garmin Fenix devices. The project provides a practical solution for maintaining the integrity of elevation data in fitness tracking and analysis.

TODO

  • Test activity fetcher
  • Test filter activities
  • Test credentials
  • Test extract code
  • Test request credentials
  • Test get access token
  • Test refresh token
  • Test summary
  • Test strava activities
  • Test login strava
  • Test get oauth code
  • Test get latest activities

[ ] CI/CD Github Actions (launch Chrome browser) to correct elevation and running tests.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published