Random Bodyweight Workout with Video!

fitcypher

I have added a new workout page, this one will read a list of youtube videos from a json file, for example :

/src/fitcypher$ cat ui/data/darebee.json 
[
  {
    "id": "4XcGTvcSRxY",
    "title": "hop heel clicks",
    "duration": 8
  },
  {
    "id": "wqfRvXc7BHY",
    "title": "half squat walk",
    "duration": 19
  },
  {
    "id": "HAQvQXovwuo",
    "title": "side splits",
    "duration": 83
  }
]

and then will play a random youtube video for the user with a counter of the elapsed time :

alt text

Once the user has done the exercise for as long as they want, they click the Complete button, this will save the exercise and duration to the database.

If an exercise video comes up that you don’t like click the skip button and it will go to the next video and will not save the exercise to the database.

Checkout the FitCypher Workouts here :

https://alexlaverty.pythonanywhere.com/workouts

alt text

Or git clone the FitCypher github repo and run it locally :

https://github.com/alexlaverty/fitcypher


Quick Body Weight Workout

fitcypher

Now we’ve added a page to show a list of available Workouts to choose from :

alt text

Each time the user performs an exercise they can click the exercise and it will add an entry for today for that exercise and display a total count of exercises performed per day for that exercise :

alt text

I found that with this approach of creating an entry per exercise rep performed the entries page quickly became cluttered with individual reps, so I’ve updated the Entries page to group the exercises by name and provide a count of total exercises :

alt text

Try out FitCypher here :

https://alexlaverty.pythonanywhere.com/

Or git clone the FitCypher github repo and run it locally :

https://github.com/alexlaverty/fitcypher


REST API

fitcypher

We will use Django Rest Framework as the API framework to interact with this model.

Using API’s allows to either add entries in bulk, allow users to export and import from other systems, allow for automation and scheduled data syncing.

To make the API friendly to use we’ll provide an API UI :

alt text

Rest API Authentication

For now we will just use basic authentication, username and password, however in the future we’ll implement some better authentication methods like token authentication.

FitCypher API Curl Commands

GET

Curl Command :

curl - X GET http: //127.0.0.1:8000/api/entries/ -u your_username:your_password

JSON Response :

    [{
        "id": 1,
        "user": {
            "id": 1,
            "username": "alex"
        },
        "date": "2025-02-02T07:51:00Z",
        "tracking": "Food",
        "string_value": "Apple",
        "numerical_value": null,
        "notes": "",
        "tags": "",
        "source": "FitCypher"
    }, {
        "id": 2,
        "user": {
            "id": 1,
            "username": "alex"
        },
        "date": "2025-02-02T07:52:00Z",
        "tracking": "Exercise",
        "string_value": "Push Ups",
        "numerical_value": "10.00",
        "notes": "",
        "tags": "",
        "source": "FitCypher"
    }]

If you install JQ you can also get pretty printed output via :

curl -s -X GET http://127.0.0.1:8000/api/entries/ -u your_username:your_password | jq
[
  {
    "id": 1,
    "user": {
      "id": 1,
      "username": "alex"
    },
    "date": "2025-02-02T07:51:00Z",
    "tracking": "Food",
    "string_value": "Apple",
    "numerical_value": null,
    "notes": "",
    "tags": "",
    "source": "FitCypher"
  },
  {
    "id": 2,
    "user": {
      "id": 1,
      "username": "alex"
    },
    "date": "2025-02-02T07:52:00Z",
    "tracking": "Exercise",
    "string_value": "Push Ups",
    "numerical_value": "10.00",
    "notes": "",
    "tags": "",
    "source": "FitCypher"
  },
  {
    "id": 3,
    "user": {
      "id": 1,
      "username": "alex"
    },
    "date": "2023-10-15T12:00:00Z",
    "tracking": "weight",
    "string_value": null,
    "numerical_value": "70.50",
    "notes": "After breakfast",
    "tags": "morning",
    "source": "fitcypher"
  }
]

POST

Add a new entry via the API

curl -X POST http://127.0.0.1:8000/api/entries/ \
-H "Content-Type: application/json" \
-u your_username:your_password \
-d '{
    "date": "2023-10-15T12:00:00Z",
    "tracking": "weight",
    "numerical_value": 70.5,
    "notes": "After breakfast",
    "tags": "morning",
    "source": "fitcypher"
}'

Add a new entry via the API to the PythonAnywhere hosted instance :

curl -X POST https://alexlaverty.pythonanywhere.com/api/entries/ \
-H "Content-Type: application/json" \
-u your_username:your_password \
-d '{
    "date": "2023-10-15T12:00:00Z",
    "tracking": "food",
    "string_value": "Banana",
    "numerical_value": "",
    "notes": "",
    "tags": "",
    "source": "fitcypher"
}'

Try out FitCypher here :

https://alexlaverty.pythonanywhere.com/

Or git clone the FitCypher github repo and run it locally :

https://github.com/alexlaverty/fitcypher