also working for non oarlock workouts now - still naive implementation
This commit is contained in:
@@ -44,13 +44,13 @@ oauth_data = {
|
||||
'client_id': NK_CLIENT_ID,
|
||||
'client_secret': NK_CLIENT_SECRET,
|
||||
'redirect_uri': NK_REDIRECT_URI,
|
||||
'autorization_uri': "https:#oauth-stage.nkrowlink.com/oauth/authorize",
|
||||
'autorization_uri': "https://oauth-stage.nkrowlink.com/oauth/authorize",
|
||||
'content_type': 'application/json',
|
||||
'tokenname': 'nktoken',
|
||||
'refreshtokenname': 'nkrefreshtoken',
|
||||
'expirydatename': 'nktokenexpirydate',
|
||||
'bearer_auth': True,
|
||||
'base_url': "https:#oauth-stage.nkrowlink.com/oauth/token",
|
||||
'base_url': "https://oauth-stage.nkrowlink.com/oauth/token",
|
||||
'scope':'read',
|
||||
}
|
||||
|
||||
@@ -287,13 +287,17 @@ def get_workout(user,nkid):
|
||||
|
||||
df = pd.DataFrame.from_dict(strokeData)
|
||||
oarlockData = df['oarlockStrokes']
|
||||
|
||||
oarlockData = oarlockData.apply(lambda x:getdict(x, seatIndex=1))
|
||||
df2 = pd.DataFrame.from_records(oarlockData.values)
|
||||
|
||||
df.set_index('timestamp')
|
||||
df2.set_index('timestamp')
|
||||
df = df.merge(df2,left_index=True,right_index=True)
|
||||
df = df.rename(columns={"timestamp_x":"timestamp"})
|
||||
|
||||
if not df2.empty:
|
||||
df2.set_index('timestamp')
|
||||
df = df.merge(df2,left_index=True,right_index=True)
|
||||
df = df.rename(columns={"timestamp_x":"timestamp"})
|
||||
|
||||
df = df.drop('oarlockStrokes',axis=1)
|
||||
df.sort_values(by='timestamp',ascending=True,inplace=True)
|
||||
df.fillna(inplace=True,method='ffill')
|
||||
@@ -321,5 +325,6 @@ def get_workout(user,nkid):
|
||||
|
||||
# not to_csv and run upload API!
|
||||
#strokedata = df.to_json(orient='records')
|
||||
#df.to_csv('~/Downloads/nk_logbook.csv')
|
||||
|
||||
return workoutdata, df
|
||||
|
||||
Reference in New Issue
Block a user