Skip to main content

Parser for weightlifting logs

Project description

fitdown-py

Markup language and parser for fitness logs, mainly weightlifting. A superset of Markdown.

Based off of fitdown

The idea is to be able to derive structured data from concise workout notes taken on a smartphone.

Workout Date

Triggers on the term "Workout" and requires 'Month Day, Year' date format (e.g., 'January 1, 2024'). All exercises that follow a workout date line have that date associated with it. Example:

Workout January 1, 2024'

Exercises with Sets & Reps

Parse a specific exercise and its sets and reps (repititions) with weights using a few different formats. Pounds (lb) and kilograms (kg) are supported and each exercise should be separated by a blank line.

Formats:

  1. Single Line Exercises
  2. Multi-line Exercises
  3. Exercises with Multiplied Sets & Reps

A parsed exercise is a dictionary with the following keys:

  • date: The date of the workout in MM/DD/YYYY format.
  • exercise: The name of the exercise.
  • reps: The number of repetitions.
  • weight: The weight lifted.
  • unit (Optional): The unit of weight, either lb or kg.
  • notes (Optional): Any notes associated with the exercise.

Single Line Exercises

Can define an entire exercise on a single line. Notes are not supported in this format.

{sets}x{reps}@{weight}{lb|kg} {exercise}

Example:

5@185 Deadlift

5@185lb Deadlift

2x5 @ 35 Squat

2x5 @ 35kg Squat

Multi-line Exercises

Define an exercise and its sets and reps on multiple lines. Notes are supported in this format as shown in the example below, where the second Deadlift set is marked as 'TOUGH'.

{exercise}
{sets}x{reps}@{weight}{lb|kg} {notes}

Example:

Deadlift
5@185

Deadlift
5@185lb

Squat
2x5 @ 35

Squat
5@35kg
5@35kg TOUGH

Example

Here's an example of a workout log in the Fitdown format:

Workout February 26, 2024

5@185lb Deadlift

3x5 @ 35kg Squat

Crunches
3x20 @ 20lb 

Hammer Curl
10 @ 45.5lb each
10 @ 45.5lb each

Bench Press
10 @ 90lb 
10 @ 90lb 
10 @ 120lb TOUGH

The following elements are parsed:

[
    {
        "date": "02/26/2024",
        "exercise": "deadlift",
        "notes": "",
        "reps": 5,
        "unit": "lb",
        "weight": 185.0
    },
    {
        "date": "02/26/2024",
        "exercise": "squat",
        "notes": "",
        "reps": 5,
        "unit": "kg",
        "weight": 35.0
    },
    {
        "date": "02/26/2024",
        "exercise": "squat",
        "notes": "",
        "reps": 5,
        "unit": "kg",
        "weight": 35.0
    },
    {
        "date": "02/26/2024",
        "exercise": "crunches",
        "notes": "",
        "reps": 20,
        "unit": "lb",
        "weight": 20.0
    },
    {
        "date": "02/26/2024",
        "exercise": "crunches",
        "notes": "",
        "reps": 20,
        "unit": "lb",
        "weight": 20.0
    },
    {
        "date": "02/26/2024",
        "exercise": "hammer curl",
        "notes": "each",
        "reps": 10,
        "unit": "lb",
        "weight": 45.5
    },
    {
        "date": "02/26/2024",
        "exercise": "hammer curl",
        "notes": "each",
        "reps": 10,
        "unit": "lb",
        "weight": 45.5
    },
    {
        "date": "02/26/2024",
        "exercise": "bench press",
        "notes": "",
        "reps": 10,
        "unit": "lb",
        "weight": 90.0
    },
    {
        "date": "02/26/2024",
        "exercise": "bench press",
        "notes": "",
        "reps": 10,
        "unit": "lb",
        "weight": 90.0
    },
    {
        "date": "02/26/2024",
        "exercise": "bench press",
        "notes": "TOUGH",
        "reps": 10,
        "unit": "lb",
        "weight": 120.0
    }
]

Acknowledgements

Many thanks to Datavis Tech INC and curran for building it in JavaScript and paving the way for me to now use this in my own notes!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fitdown-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fitdown-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file fitdown-0.0.1.tar.gz.

File metadata

  • Download URL: fitdown-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for fitdown-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3baedf9a381972c54e451cfad1bf1ca111d00c253adc3b8006ee210e2f5e6b5a
MD5 a5cb1f2afdfb7dc98f1038c3d5aedfa1
BLAKE2b-256 fd75570b5becdb6e63515c41475f5372839446b1c5b49cfa92967a3470c3a69c

See more details on using hashes here.

File details

Details for the file fitdown-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: fitdown-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for fitdown-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0d9526f0c4df0d137ff8d45fc93e8d046178c8d95c483da3444f285f81d4b013
MD5 5c6649b73c19507440fcf7731a069d2f
BLAKE2b-256 6e8a55697714d622ab543646da03c1bc0e20ee4658e1bd614d596e538f4fc775

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page