src.crud package

Submodules

src.crud.delete module

Delete data from the database.

src.crud.delete.main() None[source]

Main function.

src.crud.delete.remove_from_table(table) type[NotImplementedError][source]

Remove from table.

Parameters:

table (TinyDB.table) – TinyDB table

src.crud.delete.truncate_table(table) None[source]

Truncate table.

Parameters:

table (TinyDB.table) – TinyDB table

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_bw_workouts(table) list[dict][source]

get workouts where BODYWEIGHT was used

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.main() None[source]

Main function to run all the functions.

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.read.show_exercise(table, exercise: str, date: str) list[source]

Show detailed data for selected exercise.

Parameters:
  • table (TinyDB table) – TinyDB table

  • exercise (str) – Name of exercise

  • date (str) – Date of workout

Returns:

A list of sets for the selected exercise

Return type:

list

src.crud.read.show_exercises(table, date: str) list[str][source]

Show all exercises for given workout date.

Parameters:
  • table (TinyDB table) – A TinyDB table

  • date (str) – Date of a given workout

Returns:

A list of exercises performed on a given date

Return type:

list[str]

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

src.crud.update.filter_exercises_with_whitespace(workout_data: list) list[dict][source]

Find exercises with whitespace.

Parameters:

workout_data (list) – Workout data

Returns:

A list of workouts with exercises that contain whitespace

Return type:

list

src.crud.update.main() None[source]

Main function for the update module.

Module contents