Git Product home page Git Product logo

strava-stats's Introduction

Strava Stats

This project is under active development.

Strava is a popular social network where runners and cyclists can upload and compare data from their activities. This project allows a user to download their own running data from Strava's API and to calculate and view additional statistics. It is inspired by the Strava Wind Analysis for cyclists.

Features

  • Strava OAuth authentication
  • Calculate adjusted running paces that take account of temperature and humidity using historical weather data from the DarkSky API
  • Calculate VDOT based on race performances and view estimates of equivalent race results
  • Detect anomalous activities

Screenshots

jpg jpg jpg jpg

Usage

Setup the configuration file (config.yml) as follows:

client_id: YOUR_CLIENT_ID
client_secret: YOUR_CLIENT_SECRET
darksky_api_key: YOUR_DARKSKY_API_KEY
redis_port: 6379
redis_password: YOUR_REDIS_PASSWORD

This project uses Redis to track the progress of the downloading of data from the Strava API. To download data you must have redis installed and the Redis server running. You can download Redis from the website and start the server by running:

$ ./redis-stable/src/redis-server

To start the flask app run:

$ python run.py

Go to localhost:5000 on your web browser

DarkSky API

This app uses the DarkSky API to gather historical weather data. You will need to sign up to the API to get a key to put in the config.yml file as shown above. Note that you can get 1,000 API calls for free each day from the DarkSky API. You must pay for additional calls beyond this limit by signing up on the API's website.

strava-stats's People

Contributors

dependabot[bot] avatar reidy-p avatar

Stargazers

 avatar  avatar

Watchers

 avatar

strava-stats's Issues

Richer data types

It may be possible to use richer python types for quantities rather than the simple string or numeric values that the Strava API returns or the simple quantities that stravalib returns

Improve vdot calculation performance

When estimating the vdot values based on race data, we use a for loop to iterate over each value in the races DataFrame. This is fine if there are few races but is not performant if there are many races to loop over. It would be good to find a way to make this more efficient.

@app.route("/vdot")
def vdot():
results = db.session.query(Activity).order_by(Activity.hadley_score.desc())
races = pd.DataFrame([row.__dict__ for row in results])
posts = []
for r in races.to_dict(orient='records'):
(r['vdot'], r['equivs']) = calculate_vdot(r['distance_metres'], r['moving_time'])
posts.append(r)
return render_template('races.html', posts=posts)

Privacy Tools

Some ideas for tools to check your privacy on Strava:

  • Find all public activities
  • Check the marked start and end points of your runs to see if they could reveal where you live (example for cyclists)
  • Bulk updates on the visibility of activities (e.g., from public to followers-only)
  • How does the activity map look to my followers or to the public when I have a privacy zone?

Replicate GAP

Strava recently announced that Grade Adjusted Pace (GAP) will no longer be available for free users and will only be available to subscribers. It might be possible to create a rough version of this metric for free using the blog post describing it.

Effect of wind speed on performance

We get wind speed data from the DarkSky API but we do not try to estimate the impact on performance and running speed. This is difficult because the direction of the wind and the runner matters for the impact on performance.

Improved location with Google Maps API

The current location data is quite general (e.g., Dublin, Ireland). It might be possible to use the Google Maps API together with the latitude and longitude data to get more descriptive location descriptions.

Vulnerable Segments

Find nearby segments that might be vulnerable (e.g., relatively slow pace for that distance)

Improve styling of tables

Areas for improvement:

  • Allow the table to take up more space on the page to fit in all columns without scrolling across

Format of pace data

The pace data in the tables are in the format of minutes per km but show the seconds as a decimal rather than the actual seconds (e.g., 4.5 mins per km instead of 4 minutes and 30 seconds per km)

Migrate from DarkSky to alternative weather API

The DarkSky API which is used to get historical weather data is being shut down by the end of 2021 and is not accepting any new signups.

Research alternative APIs that can provide historical weather data at an affordable price.

Allow weather data to be empty

At the moment, the data for an activity is not downloaded if the DarkSky request fails. But some of the stats don't necessarily need weather data to be interesting. So it should be possible to download activity data without weather data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.