From 97189ef02be7adba4f84dce1e78b73839658dccc Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 24 Feb 2017 15:57:20 +0100 Subject: [PATCH 01/16] dataprep routine fusing two dataframes --- rowers/dataprep.py | 22 +++++++++++++++++++++- rowers/views.py | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 71e6d585..d7497a78 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -772,7 +772,27 @@ def smalldataprep(therows,xparam,yparam1,yparam2): pass return df - + +# data fusion +def datafusion(id1,id2,column,offset): + df1 = getrowdata_db(id=id1) + columns = ['time',column] + df2 = getsmallrowdata_db(columns,ids=[id2]) + + keep1 = set(df1.columns) + keep1.pop(column) + + for c in df1.columns: + if not c in keep1: + df1 = df1.drop(c,1,errors='ignore') + + df = pd.concat([df1,df2],ignore_index=True) + df = df.sort_value(['time']) + df.interpolate(method='linear',axis=0,limit_direction='both') + df.fillna(method='bfill',inplace=True) + + return df + # This is the main routine. # it reindexes, sorts, filters, and smooths the data, then # saves it to the stroke_data table in the database diff --git a/rowers/views.py b/rowers/views.py index 26ad82c9..dbf7f9d8 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -3601,7 +3601,7 @@ def workout_unsubscribe_view(request,id=0): user=request.user).order_by("created") for c in comments: - c.notify = False + c.notification = False c.save() form = WorkoutCommentForm() From 0db945ee396a3a575de7b05a98074b419990e6cd Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 24 Feb 2017 15:59:51 +0100 Subject: [PATCH 02/16] dataprep --- rowers/dataprep.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index d7497a78..33827e10 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -774,13 +774,14 @@ def smalldataprep(therows,xparam,yparam1,yparam2): return df # data fusion -def datafusion(id1,id2,column,offset): +def datafusion(id1,id2,columns,offset): df1 = getrowdata_db(id=id1) - columns = ['time',column] + columns = ['time']+columns df2 = getsmallrowdata_db(columns,ids=[id2]) keep1 = set(df1.columns) - keep1.pop(column) + for c in columns: + keep1.pop(c) for c in df1.columns: if not c in keep1: From 866a4123b427e0410554d456a19c20d0917f136c Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 2 Mar 2017 20:52:10 +0100 Subject: [PATCH 03/16] images on comment page --- rowers/views.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/rowers/views.py b/rowers/views.py index a025f86e..67715fb1 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -3692,13 +3692,27 @@ def workout_comment_view(request,id=0): return HttpResponseRedirect(url) form = WorkoutCommentForm() - - return render(request, - 'workout_comments.html', - {'workout':w, - 'comments':comments, - 'form':form, - }) + + g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime") + + if (len(g)<=3): + return render(request, + 'workout_comments.html', + {'workout':w, + 'graphs1':g[0:3], + 'comments':comments, + 'form':form, + }) + else: + return render(request, + 'workout_comments.html', + {'workout':w, + 'graphs1':g[0:3], + 'graphs1':g[3:6], + 'comments':comments, + 'form':form, + }) + # The basic edit page @login_required() From 5e5cc36da06b940ee3453d2d87aff6258afd2165 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 3 Mar 2017 15:41:51 +0100 Subject: [PATCH 04/16] added effective drive length --- rowers/dataprep.py | 5 ++ rowers/forms.py | 2 +- rowers/interactiveplots.py | 93 +++++++------------ rowers/models.py | 4 +- rowers/templates/developers.html | 8 +- rowers/templates/flexchart3otw.html | 134 +++++++++------------------- rowers/views.py | 27 ++++-- 7 files changed, 109 insertions(+), 164 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 6d9a5cf3..1e36ace9 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -1020,7 +1020,10 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True, drivelength = arclength else: drivelength = driveenergy/(averageforce*4.44822) + slip = rowdatadf.ix[:,'slip'] + totalangle = finish-catch + effectiveangle = finish-wash-catch-slip if windowsize > 3 and windowsize
  • Advantages
      -
    • It may take up to five minutes for the workout to show up - on the site.
    • +
    • It's a simple process, which can be automated.
  • Disadvantages
      -
    • It's a simple process, which can be automated.
    • +
    • It may take up to five minutes for the workout to show up + on the site.
  • @@ -86,7 +86,7 @@
  • The API is not stable and not fully tested yet.
  • You need to register your app with us. We can revoke your permissions if you misuse them.
  • -
  • The first time user must grant permissions to your app.
  • +
  • The user user must grant permissions to your app.
  • You need to manage authorization tokens.
  • diff --git a/rowers/templates/flexchart3otw.html b/rowers/templates/flexchart3otw.html index 4697f3a7..923edcbb 100644 --- a/rowers/templates/flexchart3otw.html +++ b/rowers/templates/flexchart3otw.html @@ -51,41 +51,19 @@ @@ -93,38 +71,23 @@ -