From cc83488c70d92d121469d6960a3971cb1bb814fe Mon Sep 17 00:00:00 2001 From: Tom Goetz Date: Mon, 19 Feb 2024 11:56:53 -0600 Subject: [PATCH] update Jupyter notebooks for new activities fields and bug fixes --- Jupyter/activities.ipynb | 12 +++++++----- Jupyter/activity.ipynb | 6 +++--- Jupyter/jupyter_funcs.py | 2 +- Jupyter/requirements.txt | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Jupyter/activities.ipynb b/Jupyter/activities.ipynb index 94e8d77..f01e517 100644 --- a/Jupyter/activities.ipynb +++ b/Jupyter/activities.ipynb @@ -80,14 +80,16 @@ " if activity:\n", " if activity.is_steps_activity():\n", " steps_activity = StepsActivities.get(garmin_act_db, activity.activity_id)\n", - " return [activity.activity_id, activity.name, activity.type, activity.sport, format_number(activity.distance, 1), activity.elapsed_time, format_number(activity.avg_speed, 1), steps_activity.avg_pace, format_number(activity.calories)]\n", - " return [activity.activity_id, activity.name, activity.type, activity.sport, format_number(activity.distance, 1), activity.elapsed_time, format_number(activity.avg_speed, 1), '', format_number(activity.calories)]\n", + " return [activity.activity_id, activity.name, activity.type, activity.sport, format_number(activity.distance, 1), activity.elapsed_time, format_number(activity.avg_speed, 1), steps_activity.avg_pace,\n", + " format_number(activity.calories), activity.self_eval_feel, activity.self_eval_effort]\n", + " return [activity.activity_id, activity.name, activity.type, activity.sport, format_number(activity.distance, 1), activity.elapsed_time, format_number(activity.avg_speed, 1), '',\n", + " format_number(activity.calories), activity.self_eval_feel, activity.self_eval_effort]\n", " return ['', '', '', '', '', '', '', '', '']\n", "\n", "activities = Activities.get_latest(garmin_act_db, 10)\n", "rows = [__format_activity(activity) for activity in activities]\n", "doc.add_heading(\"Last Ten Activities\", 3)\n", - "doc.add_table(['Id', 'Name', 'Type', 'Sport', f'Distance ({distance_units})', 'Elapsed Time', f'Speed ({unit_strings[fitfile.units.UnitTypes.speed]})', f'Pace ({unit_strings[fitfile.units.UnitTypes.pace]})', 'Calories'], rows)\n", + "doc.add_table(['Id', 'Name', 'Type', 'Sport', f'Distance ({distance_units})', 'Elapsed Time', f'Speed ({unit_strings[fitfile.units.UnitTypes.speed]})', f'Pace ({unit_strings[fitfile.units.UnitTypes.pace]})', 'Calories', 'Feel', 'Effort'], rows)\n", "\n", "rows = []\n", "for display_activity in gc_config.display_activities():\n", @@ -98,7 +100,7 @@ " rows.append([f'Longest {name}'] + __format_activity(Activities.get_longest_by_sport(garmin_act_db, display_activity)))\n", "\n", "doc.add_heading(\"Interesting Activities\", 3)\n", - "doc.add_table(['What', 'Id', 'Name', 'Type', 'Sport', f'Distance ({distance_units})', 'Elapsed Time', f'Speed ({unit_strings[fitfile.units.UnitTypes.speed]})', f'Pace ({unit_strings[fitfile.units.UnitTypes.pace]})', 'Calories'], rows)\n", + "doc.add_table(['What', 'Id', 'Name', 'Type', 'Sport', f'Distance ({distance_units})', 'Elapsed Time', f'Speed ({unit_strings[fitfile.units.UnitTypes.speed]})', f'Pace ({unit_strings[fitfile.units.UnitTypes.pace]})', 'Calories', 'Feel', 'Effort'], rows)\n", "\n", "doc.add_heading(\"Courses\", 3)\n", "courses = Activities.get_col_distinct(garmin_act_db, Activities.course_id)\n", @@ -126,7 +128,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.7" }, "orig_nbformat": 4 }, diff --git a/Jupyter/activity.ipynb b/Jupyter/activity.ipynb index f2c0a7c..8896dce 100644 --- a/Jupyter/activity.ipynb +++ b/Jupyter/activity.ipynb @@ -50,13 +50,13 @@ "doc.add_table(\n", " [\n", " 'Start', 'Id', 'Sport', 'Type', f'Distance ({distance_units})', \"Ellapsed Time\", \"Moving Time\", 'Avg HR', 'Max HR', 'Avg RR', 'Max RR', f'Gained ({altitude_units})', f'Lost ({altitude_units})',\n", - " \"Calories\", f\"Avg Temp (deg {temp_units})\", 'Start Location', 'End Location'\n", + " \"Calories\", f\"Avg Temp (deg {temp_units})\", 'Start Location', 'End Location', \"Feel\", \"Effort\"\n", " ],\n", " [\n", " [\n", " activity.start_time, activity_id, activity.sport, activity.type, format_distance(activity.distance), activity.elapsed_time, activity.moving_time, activity.avg_hr, activity.max_hr,\n", " format_number(activity.avg_rr), format_number(activity.max_rr), format_number(activity.ascent), format_number(activity.descent),\n", - " activity.calories, format_temp(activity.avg_temperature), linked_location(start_loc), linked_location(end_loc)\n", + " activity.calories, format_temp(activity.avg_temperature), linked_location(start_loc), linked_location(end_loc), activity.self_eval_feel, activity.self_eval_effort\n", " ]\n", " ]\n", ")\n", @@ -141,7 +141,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.7" }, "orig_nbformat": 4 }, diff --git a/Jupyter/jupyter_funcs.py b/Jupyter/jupyter_funcs.py index 4062a76..01bdc8f 100644 --- a/Jupyter/jupyter_funcs.py +++ b/Jupyter/jupyter_funcs.py @@ -39,4 +39,4 @@ def format_weight(distance, digits=1): def linked_location(location): """Return a location as markdown formatted linked text.""" - return snakemd.Inline(location.display(), location.to_google_maps_url()) + return snakemd.Inline(location.display(), link=location.to_google_maps_url()) diff --git a/Jupyter/requirements.txt b/Jupyter/requirements.txt index ce31e45..4c3f520 100644 --- a/Jupyter/requirements.txt +++ b/Jupyter/requirements.txt @@ -1,5 +1,5 @@ garmindb>=3.2.8 -snakemd==2.1.0 +snakemd==2.2.0 ipykernel==6.25.1 ipywidgets==7.7.2 ipyleaflet==0.17.3