first attempt compare
This commit is contained in:
1
rowers/.#dataroutines.py
Symbolic link
1
rowers/.#dataroutines.py
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
sander@rowsandall-2.231246:1710428505
|
||||||
@@ -1273,7 +1273,7 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, comp
|
|||||||
data.append(df)
|
data.append(df)
|
||||||
except (OSError, ArrowInvalid, IndexError):
|
except (OSError, ArrowInvalid, IndexError):
|
||||||
pass
|
pass
|
||||||
|
df['workoutid'] = id
|
||||||
try:
|
try:
|
||||||
df = pd.concat(data, axis=0)
|
df = pd.concat(data, axis=0)
|
||||||
except ValueError: # pragma: no cover
|
except ValueError: # pragma: no cover
|
||||||
@@ -1314,6 +1314,7 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, comp
|
|||||||
workstrokesonly=workstrokesonly)
|
workstrokesonly=workstrokesonly)
|
||||||
data.dropna(axis=1, how='all', inplace=True)
|
data.dropna(axis=1, how='all', inplace=True)
|
||||||
data.dropna(axis=0, how='any', inplace=True)
|
data.dropna(axis=0, how='any', inplace=True)
|
||||||
|
print(data)
|
||||||
return data
|
return data
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -399,7 +399,11 @@ def interactive_boxchart(datadf, fieldname, extratitle='',
|
|||||||
if 'date' not in columns: # pragma: no cover
|
if 'date' not in columns: # pragma: no cover
|
||||||
return '', 'Not enough data'
|
return '', 'Not enough data'
|
||||||
|
|
||||||
|
try:
|
||||||
datadf.date = datadf.date.apply(lambda x:x.strftime("%Y-%m-%d"))
|
datadf.date = datadf.date.apply(lambda x:x.strftime("%Y-%m-%d"))
|
||||||
|
except AttributeError:
|
||||||
|
datadf.date = "2000-01-01"
|
||||||
|
|
||||||
datadf['value'] = datadf[fieldname]
|
datadf['value'] = datadf[fieldname]
|
||||||
data_dict = datadf.to_dict("records")
|
data_dict = datadf.to_dict("records")
|
||||||
boxplot_data = {
|
boxplot_data = {
|
||||||
@@ -3973,9 +3977,8 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
|
|||||||
extratitle='',
|
extratitle='',
|
||||||
trendline=False):
|
trendline=False):
|
||||||
|
|
||||||
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
|
||||||
ids = [int(w.id) for w in theworkouts]
|
ids = [int(w.id) for w in theworkouts]
|
||||||
#columns = [xparam, yparam1, yparam2, 'spm', 'driveenergy', 'distance']
|
|
||||||
columns = [name for name, d in metrics.rowingmetrics]
|
columns = [name for name, d in metrics.rowingmetrics]
|
||||||
columns_basic = [name for name, d in metrics.rowingmetrics if d['group'] == 'basic']
|
columns_basic = [name for name, d in metrics.rowingmetrics if d['group'] == 'basic']
|
||||||
columns = columns + ['spm', 'driveenergy', 'distance']
|
columns = columns + ['spm', 'driveenergy', 'distance']
|
||||||
@@ -4048,20 +4051,6 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
|
|||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
datadf['y2'] = datadf['y1']
|
datadf['y2'] = datadf['y1']
|
||||||
|
|
||||||
# average values
|
|
||||||
x1mean = datadf['x1'].mean()
|
|
||||||
|
|
||||||
y1mean = datadf['y1'].mean()
|
|
||||||
y2mean = datadf['y2'].mean()
|
|
||||||
|
|
||||||
x_axis_type = 'linear'
|
|
||||||
y_axis_type = 'linear'
|
|
||||||
if xparam == 'time':
|
|
||||||
x_axis_type = 'datetime'
|
|
||||||
|
|
||||||
if yparam1 == 'pace': # pragma: no cover
|
|
||||||
y_axis_type = 'datetime'
|
|
||||||
y1mean = datadf.loc[:, 'pace'].mean()
|
|
||||||
|
|
||||||
datadf['xname'] = axlabels[xparam]
|
datadf['xname'] = axlabels[xparam]
|
||||||
datadf['yname1'] = axlabels[yparam1]
|
datadf['yname1'] = axlabels[yparam1]
|
||||||
@@ -5285,19 +5274,28 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
|
|||||||
message = ''
|
message = ''
|
||||||
errormessage = ''
|
errormessage = ''
|
||||||
|
|
||||||
columns = [xparam, yparam,
|
columns = [name for name, d in metrics.rowingmetrics]
|
||||||
'ftime', 'distance', 'fpace',
|
columns_basic = [name for name, d in metrics.rowingmetrics if d['group'] == 'basic']
|
||||||
'power', 'hr', 'spm',
|
columns = columns + ['spm', 'driveenergy', 'distance']
|
||||||
'time', 'pace', 'workoutstate',
|
columns_basic = columns_basic + ['spm', 'driveenergy', 'distance']
|
||||||
'workoutid']
|
|
||||||
|
|
||||||
compute = False
|
compute = False
|
||||||
doclean = False
|
doclean = False
|
||||||
if workstrokesonly:
|
if workstrokesonly:
|
||||||
compute = True
|
compute = True
|
||||||
doclean = True
|
doclean = True
|
||||||
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean, compute=compute,
|
|
||||||
|
|
||||||
|
datadf = pd.DataFrame()
|
||||||
|
if promember:
|
||||||
|
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean,
|
||||||
|
compute=compute,
|
||||||
workstrokesonly=workstrokesonly)
|
workstrokesonly=workstrokesonly)
|
||||||
|
else:
|
||||||
|
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean,
|
||||||
|
compute=compute,
|
||||||
|
workstrokesonly=workstrokesonly)
|
||||||
|
|
||||||
datadf.dropna(axis=1, how='all', inplace=True)
|
datadf.dropna(axis=1, how='all', inplace=True)
|
||||||
datadf.dropna(axis=0, how='any', inplace=True)
|
datadf.dropna(axis=0, how='any', inplace=True)
|
||||||
|
|
||||||
@@ -5315,6 +5313,26 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
|
|||||||
if datadf.empty: # pragma: no cover
|
if datadf.empty: # pragma: no cover
|
||||||
return ['', '<p>No non-zero data in selection</p>', '', 'No non-zero data in selection']
|
return ['', '<p>No non-zero data in selection</p>', '', 'No non-zero data in selection']
|
||||||
|
|
||||||
|
data_dict = datadf.to_dict("records")
|
||||||
|
|
||||||
|
|
||||||
|
metrics_list = [{'name': name, 'rowingmetrics':d } for name, d in metrics.rowingmetrics]
|
||||||
|
|
||||||
|
workoutsdict = [{'id': id, 'label': labeldict[id]} for id in ids]
|
||||||
|
|
||||||
|
chart_data = {
|
||||||
|
'title': '',
|
||||||
|
'x': xparam,
|
||||||
|
'y': yparam,
|
||||||
|
'data': data_dict,
|
||||||
|
'metrics': metrics_list,
|
||||||
|
'plottype': plottype,
|
||||||
|
'workouts': workoutsdict,
|
||||||
|
}
|
||||||
|
|
||||||
|
script, div = get_chart("/compare", chart_data)
|
||||||
|
return script, div, message, errormessage
|
||||||
|
|
||||||
if xparam != 'distance' and xparam != 'time' and xparam != 'cumdist': # pragma: no cover
|
if xparam != 'distance' and xparam != 'time' and xparam != 'cumdist': # pragma: no cover
|
||||||
xaxmax = yaxmaxima[xparam]
|
xaxmax = yaxmaxima[xparam]
|
||||||
xaxmin = yaxminima[xparam]
|
xaxmin = yaxminima[xparam]
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user