-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
333 configure step count in dialogs #125
Conversation
I spotted: virtual-coach-rasa/Rasa_Bot/actions/actions_weekly_reflection.py Lines 200 to 201 in a187948
I think it should be pa_group = 1 virtual-coach-rasa/Rasa_Bot/actions/actions_weekly_reflection.py Lines 271 to 272 in a187948
Instead of setting it to a default of 15, I propose we use historical data to set a realistic goal. |
I realize that most functions I created will not work if no data is returned from the sensor data API. Also, I tested all functions in isolation, as spinning up the system would not work as there is no data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! I left some suggestions. Probably other things can be optimized, but this will work anyway
group_2_threshold_total_steps = 56000 | ||
sufficient_daily_steps = 8000 | ||
group_2_threshold_daily_steps = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to move this values to the constants
user_id = int(tracker.current_state()['sender_id']) | ||
|
||
end = datetime.datetime.now() | ||
start = end - datetime.timedelta(days=16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also the number of days for the different ranges would be better placed in the constants, so to have all defined in a single place
# Get data from API | ||
user_id = int(tracker.current_state()['sender_id']) | ||
end = datetime.datetime.now() | ||
start = end - datetime.timedelta(days=16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
|
||
# Get avg. steps per day | ||
end = datetime.now() | ||
start = end - timedelta(days=9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
number of days could be a constant?
Rasa_Bot/actions/helper.py
Outdated
min_val = 2000 | ||
max_val = 10000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this values should be moved to the constants
Rasa_Bot/actions/helper.py
Outdated
step_goals = [] | ||
for i in range(7): | ||
steps_nine_days = steps[i:i + 9] | ||
steps_nine_days = [x for x in steps_nine_days if not pd.isna(x)] # Remove NaN values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
step_goals = [] | |
for i in range(7): | |
steps_nine_days = steps[i:i + 9] | |
steps_nine_days = [x for x in steps_nine_days if not pd.isna(x)] # Remove NaN values | |
steps_nine_days = [steps[i:i + 9] for i in range(7) if not pd.isna(steps[i:i + 9])] # Remove NaN values |
Not tested, but I guess that this does the same thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this suggestion will not work. The for loop includes step_goals.append(int(round(steps_nine_days[5], -1))) # Definition of the goal
Co-authored-by: Walter Baccinelli <100706999+wbaccinelli@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me.
import pandas as pd | ||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numpy and pandas should be added to the requirements file of sensor_api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch :)
SonarCloud Quality Gate failed. 0 Bugs 4.0% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Fixes: PerfectFit-project/virtual-coach-issues#333