improving data export
This commit is contained in:
@@ -332,6 +332,7 @@ def workout_summary_to_df(
|
|||||||
|
|
||||||
types = []
|
types = []
|
||||||
names = []
|
names = []
|
||||||
|
ids = []
|
||||||
startdatetimes = []
|
startdatetimes = []
|
||||||
timezones = []
|
timezones = []
|
||||||
distances = []
|
distances = []
|
||||||
@@ -346,11 +347,15 @@ def workout_summary_to_df(
|
|||||||
goldstandards = []
|
goldstandards = []
|
||||||
goldstandarddurations = []
|
goldstandarddurations = []
|
||||||
rscores = []
|
rscores = []
|
||||||
|
hrtss = []
|
||||||
trimps = []
|
trimps = []
|
||||||
|
rankingpieces = []
|
||||||
|
boattypes = []
|
||||||
|
|
||||||
for w in ws:
|
for w in ws:
|
||||||
types.append(w.workouttype)
|
types.append(w.workouttype)
|
||||||
names.append(w.name)
|
names.append(w.name)
|
||||||
|
ids.append(encoder.encode_hex(w.id))
|
||||||
startdatetimes.append(w.startdatetime)
|
startdatetimes.append(w.startdatetime)
|
||||||
timezones.append(w.timezone)
|
timezones.append(w.timezone)
|
||||||
distances.append(w.distance)
|
distances.append(w.distance)
|
||||||
@@ -358,6 +363,7 @@ def workout_summary_to_df(
|
|||||||
weightcategories.append(w.weightcategory)
|
weightcategories.append(w.weightcategory)
|
||||||
adaptivetypes.append(w.adaptiveclass)
|
adaptivetypes.append(w.adaptiveclass)
|
||||||
weightvalues.append(w.weightvalue)
|
weightvalues.append(w.weightvalue)
|
||||||
|
boattypes.append(w.boattype)
|
||||||
notes.append(w.notes)
|
notes.append(w.notes)
|
||||||
tcx_link = SITE_URL+'/rowers/workout/{id}/emailtcx'.format(
|
tcx_link = SITE_URL+'/rowers/workout/{id}/emailtcx'.format(
|
||||||
id=encoder.encode_hex(w.id)
|
id=encoder.encode_hex(w.id)
|
||||||
@@ -374,28 +380,34 @@ def workout_summary_to_df(
|
|||||||
trimps.append(workout_trimp(w)[0])
|
trimps.append(workout_trimp(w)[0])
|
||||||
rscore = workout_rscore(w)
|
rscore = workout_rscore(w)
|
||||||
rscores.append(int(rscore[0]))
|
rscores.append(int(rscore[0]))
|
||||||
|
hrtss.append(int(w.hrtss))
|
||||||
goldstandard,goldstandardduration = workout_goldmedalstandard(w)
|
goldstandard,goldstandardduration = workout_goldmedalstandard(w)
|
||||||
goldstandards.append(int(goldstandard))
|
goldstandards.append(int(goldstandard))
|
||||||
goldstandarddurations.append(int(goldstandardduration))
|
goldstandarddurations.append(int(goldstandardduration))
|
||||||
|
rankingpieces.append(w.rankingpiece)
|
||||||
|
|
||||||
df = pd.DataFrame({
|
df = pd.DataFrame({
|
||||||
|
'ID': ids,
|
||||||
|
'date':startdatetimes,
|
||||||
'name':names,
|
'name':names,
|
||||||
'link':workout_links,
|
'link':workout_links,
|
||||||
'date':startdatetimes,
|
|
||||||
'timezone':timezones,
|
'timezone':timezones,
|
||||||
'type':types,
|
'type':types,
|
||||||
|
'boat type':boattypes,
|
||||||
'distance (m)':distances,
|
'distance (m)':distances,
|
||||||
'duration ':durations,
|
'duration ':durations,
|
||||||
|
'ranking piece':rankingpieces,
|
||||||
'weight category':weightcategories,
|
'weight category':weightcategories,
|
||||||
'adaptive classification':adaptivetypes,
|
'adaptive classification':adaptivetypes,
|
||||||
'weight (kg)':weightvalues,
|
'weight (kg)':weightvalues,
|
||||||
'notes':notes,
|
|
||||||
'Stroke Data TCX':tcx_links,
|
'Stroke Data TCX':tcx_links,
|
||||||
'Stroke Data CSV':csv_links,
|
'Stroke Data CSV':csv_links,
|
||||||
'TRIMP Training Load':trimps,
|
'TRIMP Training Load':trimps,
|
||||||
'TSS Training Load':rscores,
|
'TSS Training Load':rscores,
|
||||||
|
'hrTSS Training Load':hrtss,
|
||||||
'GS':goldstandards,
|
'GS':goldstandards,
|
||||||
'GS_secs':goldstandarddurations,
|
'GS_secs':goldstandarddurations,
|
||||||
|
'notes':notes,
|
||||||
})
|
})
|
||||||
|
|
||||||
return df
|
return df
|
||||||
@@ -1046,7 +1058,8 @@ def get_workoutsummaries(userid,startdate):
|
|||||||
u = User.objects.get(id=userid)
|
u = User.objects.get(id=userid)
|
||||||
r = u.rower
|
r = u.rower
|
||||||
df = workout_summary_to_df(r,startdate=startdate)
|
df = workout_summary_to_df(r,startdate=startdate)
|
||||||
df = df.sort_values('date')
|
df.drop(['Stroke Data TCX','Stroke Data CSV'],axis=1,inplace=True)
|
||||||
|
df = df.sort_values('date',ascending=False)
|
||||||
|
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user