interactive compare chart v1
This commit is contained in:
@@ -642,6 +642,8 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
after = {}
|
after = {}
|
||||||
|
|
||||||
|
return datadf
|
||||||
for workoutid in data_orig['workoutid'].unique():
|
for workoutid in data_orig['workoutid'].unique():
|
||||||
after[workoutid] = len(
|
after[workoutid] = len(
|
||||||
datadf[datadf['workoutid'] == workoutid].dropna())
|
datadf[datadf['workoutid'] == workoutid].dropna())
|
||||||
@@ -1273,7 +1275,6 @@ 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
|
||||||
@@ -1313,7 +1314,7 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, comp
|
|||||||
data = clean_df_stats(data, ignorehr=True,
|
data = clean_df_stats(data, ignorehr=True,
|
||||||
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='all', inplace=True)
|
||||||
return data
|
return data
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ def get_chart(end_point, chart_data, debug=False):
|
|||||||
headers = {'authorization':"Bearer {token}".format(token=settings.ROWSANDALL_CHARTS_TOKEN)}
|
headers = {'authorization':"Bearer {token}".format(token=settings.ROWSANDALL_CHARTS_TOKEN)}
|
||||||
try:
|
try:
|
||||||
response = requests.post(url, json=chart_data, headers=headers)
|
response = requests.post(url, json=chart_data, headers=headers)
|
||||||
except Error as err:
|
except Exception as err:
|
||||||
if debug:
|
if debug:
|
||||||
print("Chart Server Error")
|
print("Chart Server Error")
|
||||||
print(err)
|
print(err)
|
||||||
@@ -5276,8 +5276,14 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
|
|||||||
|
|
||||||
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']
|
add_columns = [
|
||||||
columns_basic = columns_basic + ['spm', 'driveenergy', 'distance']
|
'ftime', 'distance', 'fpace',
|
||||||
|
'power', 'hr', 'spm',
|
||||||
|
'time', 'pace', 'workoutstate',
|
||||||
|
'workoutid'
|
||||||
|
]
|
||||||
|
columns = columns + add_columns
|
||||||
|
columns_basic = columns_basic + add_columns
|
||||||
|
|
||||||
compute = False
|
compute = False
|
||||||
doclean = False
|
doclean = False
|
||||||
@@ -5296,8 +5302,9 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
|
|||||||
compute=compute,
|
compute=compute,
|
||||||
workstrokesonly=workstrokesonly)
|
workstrokesonly=workstrokesonly)
|
||||||
|
|
||||||
|
datadf['workoutid'] = datadf['workoutid'].astype(int)
|
||||||
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='all', inplace=True)
|
||||||
|
|
||||||
nrworkouts = len(ids)
|
nrworkouts = len(ids)
|
||||||
|
|
||||||
@@ -5317,8 +5324,9 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
|
|||||||
if (xparam == 'time'):
|
if (xparam == 'time'):
|
||||||
datadf[xparam] = datadf[xparam] - datadf[xparam].iloc[0]
|
datadf[xparam] = datadf[xparam] - datadf[xparam].iloc[0]
|
||||||
|
|
||||||
data_dict = datadf.to_dict("records")
|
datadf = datadf.fillna(0)
|
||||||
|
|
||||||
|
data_dict = datadf.to_dict("records")
|
||||||
|
|
||||||
metrics_list = [{'name': name, 'rowingmetrics':d } for name, d in metrics.rowingmetrics]
|
metrics_list = [{'name': name, 'rowingmetrics':d } for name, d in metrics.rowingmetrics]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user