# Coding nerds unite

**URL:** <https://www.trainerroad.com/forum/t/coding-nerds-unite/30505>\
**Category:** Uncategorized\
**Created:** [February 25, 2020, 2:16pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505 "2020-02-25T14:16:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 25, 2020, 2:16pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/1 "2020-02-25T14:16:56Z")

</div>

Not sure how much traction this will gain, but here goes! So I’ve been messing around with Python this year just for fun and to learn something new (the last time I coded was in a Java semester course back in 1999 lol).

For a noob, I’m doing ok with some basic tasks, basically extracting data from my strava (primarily using stravalib) and being able to load fit files for analysis (using fitparse) and then using a visualization tool like bokeh or dash to graph it out (I even have the foundations of a DC Rainmaker style analysis tool with overlaid power files).

I’ve also been messing around with Django as a way to make all of this more web-based. Basically, I’m reinventing the wheel here since there are so many options to upload and analyze ride data out there! But it’s a learning exercise and maybe by doing this then maybe I can get into doing some more advanced things with data.

Anyhow, I know there are some other coders around here, and was curious if any would be interested in participating in sharing code snippets and solve stuff in relation to using bike data.

Here a couple of resources I’ve used to get myself going, my challenge now making the transition of these concepts into Django:

[http://johannesjacob.com/analyze-your-cycling-data-python/](http://johannesjacob.com/analyze-your-cycling-data-python/)

[http://johannesjacob.com/2019/03/20/build-your-own-performance-management-chart-python/](http://johannesjacob.com/2019/03/20/build-your-own-performance-management-chart-python/)

[https://pythonhosted.org/stravalib/](https://pythonhosted.org/stravalib/)

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/jpowers/32/35855_2.png) [@jpowers](https://www.trainerroad.com/forum/u/jpowers)\
**Post date:** [February 25, 2020, 2:48pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/2 "2020-02-25T14:48:47Z")

</div>

> [@hubcyclist](#):
>
> Anyhow, I know there are some other coders around here, and was curious if any would be interested in participating in sharing code snippets and solve stuff in relation to using bike data.

Usually this is followed by a link to your project on GitHub. 🙂

---

<div class="post-metadata">

**Author:** ![Captain\_Doughnutman](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/captain_doughnutman/32/7694_2.png) [@Captain\_Doughnutman](https://www.trainerroad.com/forum/u/Captain_Doughnutman)\
**Post date:** [February 25, 2020, 2:49pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/3 "2020-02-25T14:49:42Z")

</div>

Dear coding nerds,

Please create an app for the following:

> [@New TR logo on forum](https://www.trainerroad.com/forumt/new-tr-logo-on-forum/30321/4):
>
> Like a decade ago, the Nike+ running app had a “power song” feature where it would play your designated song when you hit a button. I’ve wanted that feature back forever. It was great!

Thanks!

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 25, 2020, 3:01pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/4 "2020-02-25T15:01:19Z")

</div>

I’m pretty new to github, is there a way to make a public github where people can just freely add stuff?

mainly asking to do something as a central repository for folks rather than people going here and there for this sort of thing

---

<div class="post-metadata">

**Author:** ![pcort](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/pcort/32/153913_2.png) [@pcort](https://www.trainerroad.com/forum/u/pcort)\
**Post date:** [February 25, 2020, 3:05pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/5 "2020-02-25T15:05:54Z")

</div>

when you create a repo it’ll allow you to set it as a public repo.

 ![Screen Shot 2020-02-25 at 10.04.51 AM](https://global.discourse-cdn.com/trainerroad/original/3X/f/3/f388646f179644acda9be4e7fde8aaf5948005f2.png)

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 25, 2020, 3:10pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/6 "2020-02-25T15:10:28Z")

</div>

Cool, here we go, feel free to add

> **[GitHub - pgp80/cycling-coders: For anyone working with cycling data files...](https://github.com/pgp80/cycling-coders)**
>
> For anyone working with cycling data files (Strava, FIT, etc.) - GitHub - pgp80/cycling-coders: For anyone working with cycling data files (Strava, FIT, etc.)

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 26, 2020, 8:10pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/7 "2020-02-26T20:10:27Z")

</div>

bumping my own thread to get some more nerds in.

As for my own tinkering, I’ve managed to connect some dots with Django and loading Fit files for analysis and saving TSS, IF, and NP to a database to potentially use to build a PMC. What I need to do next is to mess with my user profile to indicate different FTPs that are associated with ride dates, right now I’m just using my current value as static.

I’ll try and clean up some code and put it up for anyone else interested in trying this stuff out.

---

<div class="post-metadata">

**Author:** ![Jerrodg](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/jerrodg/32/7721_2.png) [@Jerrodg](https://www.trainerroad.com/forum/u/Jerrodg)\
**Post date:** [February 27, 2020, 3:06am UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/8 "2020-02-27T03:06:24Z")

</div>

Not quite to Python yet myself. While I have no illusions that a job at TrainerRoad is in the future for me, it was the idea of working on a project like this that made me begin the journey to change professions. My pops has been coding since the 70’s, and was ecstatic when I told him - as he badly wanted me to follow in his footsteps but never pushed me into it.

---

<div class="post-metadata">

**Author:** ![sjkpt](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/sjkpt/32/12890_2.png) [@sjkpt](https://www.trainerroad.com/forum/u/sjkpt)\
**Post date:** [February 27, 2020, 8:21am UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/9 "2020-02-27T08:21:13Z")

</div>

I am interested! I am proficient in Python (I teach bio-informatics), but I need to develop my skills in integrating data analysis with (preferably) interactive web pages. So for example developing an interactive PMC in Django could be nice!

@hubcyclist I will contact you on GitHub so we can share ideas.

---

<div class="post-metadata">

**Author:** ![WildWill](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/wildwill/32/9414_2.png) [@WildWill](https://www.trainerroad.com/forum/u/WildWill)\
**Post date:** [February 27, 2020, 8:24am UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/10 "2020-02-27T08:24:58Z")

</div>

Hi all

I started as an assembly level games programmer in the 80’s

I’ve used most programming languages.

But currently focusing on Native to create a running app for Android / iPhobe

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 27, 2020, 2:48pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/11 "2020-02-27T14:48:03Z")

</div>

nice! My current bang my head against the wall task is getting data from a fit file into the model database, which I knew in advance would be a challenge for me because of how many rows of data are involved. So the info from the fit file makes its way into a dataframe, at the moment I’m passing watts, heartrate, timestamp, cadence, and time (in seconds) and then trying to get that into the model, but I’m clearly doing something wrong with the model to create a mismatch. I’ve tried to do ArrayField and JSONField (using postgresql) but keep hitting this wall when uploading the fit file. It’s stuff like this that makes me remember why I chose not to keep going with computer science as an undergrad lol

```
(psycopg2.errors.DatatypeMismatch) column "watts" is of 
type integer[] but expression is of type integer
LINE 1: ...tts, heartrate, timestamp, cadence, time) VALUES 
(176, 59, '...
                                                         ^
HINT: You will need to rewrite or cast the expression.

[SQL: INSERT INTO "PMC_ride" (watts, heartrate, timestamp, 
cadence, time) VALUES (%(watts)s, %(heartrate)s, % 
(timestamp)s, %(cadence)s, %(time)s)]
[parameters: ({'watts': 176, 'heartrate': 59, 'timestamp': 
datetime.datetime(2020, 2, 26, 16, 19, 25), 'cadence': 80, 
'time': 0.0}, {'watts': 176, 'heartrate': 59, 'timestamp': 
datetime.datetime(2020, 2, 26, 16, 19, 26), 'cadence': 80, 
'time': 1.0}

```

---

<div class="post-metadata">

**Author:** ![bbarrera](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/bbarrera/32/14734_2.png) [@bbarrera](https://www.trainerroad.com/forum/u/bbarrera)\
**Post date:** [February 27, 2020, 3:13pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/12 "2020-02-27T15:13:36Z")

</div>

> [@WildWill](#):
>
> I started as an assembly level games programmer in the 80’s
> 
> I’ve used most programming languages.

similar background, except it was real-time programming for modems and other communications gear. And using Unix (“Linux”) since mid 80s. But I just casually hack on stuff these days, like taking the Garmin ANT+ FIT SDK and hacking the example code to extract battery levels from the FIT file.

Pretty busy with work, training, and housework, but I might try and help.

---

<div class="post-metadata">

**Author:** ![pcort](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/pcort/32/153913_2.png) [@pcort](https://www.trainerroad.com/forum/u/pcort)\
**Post date:** [February 27, 2020, 3:14pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/13 "2020-02-27T15:14:40Z")

</div>

you can try using the cast function in postgres

> **[PostgreSQL CAST Convert From One Data Type Into Another](https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-cast/)**
>
> Shows you how to use PostgreSQL CAST to convert from one data type into another e.g., a string into an integer, a string to date, a string to double etc.

It looks like for whatever reason it’s importing watts as a list or object rather than an integer.

---

<div class="post-metadata">

**Author:** ![sjkpt](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/sjkpt/32/12890_2.png) [@sjkpt](https://www.trainerroad.com/forum/u/sjkpt)\
**Post date:** [February 27, 2020, 3:46pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/14 "2020-02-27T15:46:29Z")

</div>

Just to be sure: your intention is to

- create a SQL table with attributes `watts`, `heartrate`, `timestamp`, `cadence` and `time`.
- each row in the table will contain a single measurement of all these attributes (e.g. row1 will represent second1 in an activity, and row2 will represent second2 in that activity)

How are you going to store different activities in this table?

By the way: for `pandas` dataframes, the method `.to_sql` is available. This is super convenient! See [pandas.DataFrame.to\_sql — pandas 1.5.0 documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_sql.html)

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 27, 2020, 3:50pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/15 "2020-02-27T15:50:09Z")

</div>

I’m using df.to\_sql method, and have used it with simpler items, it’s just the multi-row nature of fit files is throwing me for a loop.

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 27, 2020, 4:05pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/16 "2020-02-27T16:05:35Z")

</div>

alright, so I borked my database and started over because clearly I had done something crazy lol The good thing with being small is I can just toss everything in the trash and start over

So I was able to successfully upload a fitfile from a ride, the thing now is that each line is its own object in the model lol. Really I’d like the ride to be the object with a bunch of datapoints in it.

---

<div class="post-metadata">

**Author:** ![route66](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/route66/32/13551_2.png) [@route66](https://www.trainerroad.com/forum/u/route66)\
**Post date:** [February 27, 2020, 10:19pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/17 "2020-02-27T22:19:33Z")

</div>

C#/SQL guy here. Would love to help if I had more time, but am just popping in to offer some encouragement. It looks like you are making good progress – keep chipping away and you’ll get there. Cheers!

---

<div class="post-metadata">

**Author:** ![pcort](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/pcort/32/153913_2.png) [@pcort](https://www.trainerroad.com/forum/u/pcort)\
**Post date:** [February 27, 2020, 10:36pm UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/18 "2020-02-27T22:36:06Z")

</div>

I forked the repo and created a zone for myself to play in, which includes a pretty basic web app setup to take a .fit file and graph out the power / hr / cadence over time. Figure that might be nice for anybody who like me doesn’t do python / django stuff, and wants an easy space to mess around!

Got a couple ideas from stuff on here to mess around with including taking a stab at calculating optimal cadence, and what’s your optimal time of day to workout.

---

<div class="post-metadata">

**Author:** ![hubcyclist](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/hubcyclist/32/14363_2.png) [@hubcyclist](https://www.trainerroad.com/forum/u/hubcyclist)\
**Post date:** [February 28, 2020, 12:00am UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/19 "2020-02-28T00:00:39Z")

</div>

Saw that, thanks for jumping in!

I’ve been wasting a lot of time on this whole handling of Fit files. So the thing with Django which is neat is that there are ListViews and DetailViews, where the listview gives you (obviously lol) a listing of objects and when you click you can get into a detailview where I’m hoping to have the graphs and whatnot. I was hoping to put a lot of the fitparse coding into the detailview to just do that stuff dynamically based on the selected record.

Anyhow I’m continuing to look into what I had been above as far as getting fit files into the model database, but I’m also seeing if there’s a way the detailview class can just access the fit file url of an uploaded fit file. Not sure if this makes any sense! lol I put up some topics on stackoverflow, let’s just say I’m not confident about getting any responses!

---

<div class="post-metadata">

**Author:** ![gjjones](https://sea2.discourse-cdn.com/trainerroad/forum/user_avatar/www.trainerroad.com/gjjones/32/17291_2.png) [@gjjones](https://www.trainerroad.com/forum/u/gjjones)\
**Post date:** [February 28, 2020, 12:03am UTC](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505/20 "2020-02-28T00:03:21Z")

</div>

Frontend dev here. Mostly react and JavaScript these days. I work for on an infrastructure team, so it’s a lot of moving stuff around to better fit our scaling organization. Happy to look over UI pieces of anyone has questions

[Next page](https://www.trainerroad.com/forum/t/coding-nerds-unite/30505.md?page=2)
