Black Lives Matter. Please consider donating to Black Girls Code today.

Dash Fitness Analytics - Looking for contributors!

Hey Dash fam!

Proud to announce I’ve reached a milestone with my first multi-page dash app! (and first python app at all for the record).

Most of my python experience has been quick one-off business use case scripts and what started out as a simple idea to get some analytics behind my fitness data quickly spun out of control, feeding my fitness tech-toy addiction, to end up with fit.ly (fitness + plotly).

Several friends and community members asked I share the code so they too can have some awesome dash charts for their data, however I need some help to get it ‘production’ ready. My idea is to share this with everyone so they can self host it (and choose whether or not to deploy or just use via localhost). Additionally, it currently only leverages the data services I use, so once all the core code is cleaned up, I’d love to start maintaining this and including new sources/charts/functionalities. For the endurance athlete enthusiasts out there, I’ve recreated several chart types which are only available in paid versions of other apps (i.e. power curve, fitness performance management chart, etc.)

I’m thinking in its final state, users could just download via docker-compose and everything is already set up…although this is where I’d love some thoughts from those who have experience deploying applications (or at least for this manner, getting code in a state where users can self deploy).

However before we get there…I’ll say it again, this was my first python project - and I am entirely self-taught in all things computer related, so there are several areas for the code to be improved. Dash has also come a long way since I first started building this out (~2 years ago), so there are a lot of new functionalities I believe which formerly required a lot more code that can be cleaned up (i.e. plotly express).

It does work and I’ve been using on my personal home server (making great fitness gains I might add), however I was hoping there are some other fitness junkies out there who may be interested and would like to contribute. I’ve posted the current state here:

Here’s some images of what the dashboards look like:

Right now it grabs data from the following on a cron schedule every hour, so the dashboard is always up to date when you view it:

  • Strava
  • Withings
  • Peloton
  • Stryd
  • Oura
  • Fitbod (csv uploaded to nextcloud)

You’ll notice this is also my first github project - so also looking to learn not only how to improve my coding skills, but also work on a project with others :slight_smile:

4 Likes

so awesome! i’ve got a polar heart rate / gps monitor that id love to plugin to something like this :smiley:

would you mind adding a ‘plotly-dash’ tag to your github repo? that’ll make it a little more discoverable.

thanks for sharing all of this, this is a very impressive first project!

Glad you’re interested! I personally don’t have a polar device but they seem to have an api that can be leveraged with oauth2…definitely need someone to take a look at how I’m currently doing the oauth dance though as I wrote it all out manually and feel there must be an easier way…

In regards to tagging the repo, how exactly should I go about doing that? Creating a release with that tag name? (Sorry brand new to using github the real way)

Would also love your ideas on other areas I could be leveraging dash in a more efficient way. For example right now a lot of the callbacks return a function which then builds the layout (divs) with charts in them as opposed to the layout being set with the graphs initially and then just updating the figures…not really sure if this is the right way to do it

Ah, I guess the term is “topics” actually. It’s done just through the GitHub Repo UI.

Ah you mean “topics”, updated!

Hey, this is awesome! I first saw this on the GC google group, I’m totally impressed. Like you, I just started learning python and messing around with bike data, it’s a fun learning exercise. I’ve been developing a PMC using django, using bokeh right now, but I do like Dash a lot as well (I just haven’t figured out how to use it in Django). Keep it up!

Thanks!

Yeah I actually considered Django as well - but started of with dash, and since dash is on flask decided to go the flask route… Of course, after diving in I did happen to find this repo which may help you out if you’re sticking to django:

Over the next few days I’m going to try and working on cleaning up this code to a point where people can start to pull it and load their own data in. As of right now, I’m converting everything over to slapdash, so its actually a flask app with dash inside, as opposed to the otherway around which is how dash ships.

Good luck and feel free to snag any of my code for your project!

This is totally impressive. I am interested in knowing how you created a multipage section

I actually did it all manually with some guidance from the dash references documentation in multi page apps, check out the index.py callback.

That being said, a much more streamlined approach would be to check out slapdash:

I’m actually in the process of converting the entire app to run off this and rebuilding everything in dash bootstrap components and with bootstrap css so it’ll be much easier to keep building this out and allow others to contribute.

Hoping to have a massive code commit in the next few days