Private
Public Access
1
0

also working for non oarlock workouts now - still naive implementation

This commit is contained in:
Sander Roosendaal
2021-04-04 19:58:04 +02:00
parent 13391c0e40
commit 6be21a0a8a
3 changed files with 18 additions and 5 deletions

View File

@@ -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