src.crud package
Submodules
src.crud.delete module
Delete data from the database.
src.crud.insert module
src.crud.read module
Store and analyze weight-training data.
Docs: https://tinydb.readthedocs.io/en/latest/getting-started.html
- src.crud.read.analyze_workout(table, exercise: str) list[source]
Deeper analysis of workout.
- Parameters:
table (TinyDB table) – A TinyDB table
exercise (str) – Name of exercise to analyze
- Returns:
A list of dictionaries representing the records.
- Return type:
list
- src.crud.read.describe_workout(table, date: str) dict | None[source]
Simple summary statistics for each exercise.
- Parameters:
table (TinyDB table) – TinyDB table
date (str) – Date of workout
- Returns:
A dictionary with the date of the workout and the exercises performed
- Return type:
dict
- src.crud.read.get_all(table) list[dict][source]
Get all documents.
- Parameters:
table (TinyDB table) – TinyDB table
- Returns:
A list of dictionaries representing the records.
- Return type:
list[dict]
- src.crud.read.get_dates(table) list[str][source]
Get all workout dates.
- Parameters:
table (TinyDB table) – TinyDB table
- Returns:
A list of workout dates
- Return type:
list[str]
- src.crud.read.get_dates_and_muscle_groups(table) dict[str, str][source]
Returns all workout dates with their corresponding muscle groups.
- Parameters:
table (TinyDB table) – A TinyDB table
- Returns:
A dictionary of workout dates and corresponding splits / musclegroup
- Return type:
dict[str, str]
- src.crud.read.search_for_exercise(table, exercise: str = 'assisted_pullup') list[dict][source]
Search for a specific exercise in the table.
- Parameters:
table (TinyDB table) – TinyDB table
exercise (str) – Name of exercise to search for
- Returns:
A list of dictionaries representing the records.
- Return type:
list[dict]
src.crud.update module
Update or delete weight-training data.
- src.crud.update.clean_exercise_name(exercise: str) str[source]
Cleans the name of an exercise by replacing spaces with underscores.
- Parameters:
exercise (str) – The name of an exercise
- Returns:
The cleaned exercise name
- Return type:
str
- src.crud.update.clean_exercise_names(table) None[source]
Cleans the names of exercises by replacing spaces with underscores and updating the database.
- Parameters:
table (tinydb.table.Table) – The database table containing workout data.
- Returns:
None
- Return type:
None