Personal Trainer Tool
Personal Trainer Tool is an app created for professional who works at the health environment, can it being a personal trainer, nutritionist, whoever.
This app analyzes client's health and creates diets for them, according to their goals.
Click here to visit the deployed site.
Here is the link to the Google Spreadsheet, to see the updates made.
Table of contents
Project Goals
The project goals are:
- Create an app for health professionals to check client health and weight status
- Create an app for health professionals to track their clients and help them to achieve their goals
- Create an app that calculates BMI ( Body Mass Index), BMR (Basal Metabolic Rate)
- Create an app that creates diets for specific objective (maintain, loss or gain weight)
- Create and update a worksheet for the professionals to track their clients easily
- Automate calculations
User Goals
The user goals are:
- Input client details and get their BMI ( Body Mass Index), BMR (Basal Metabolic Rate)
- Creat diets for their clients
- Save client details into a worksheet
- Update client details and get new diets
- Check client health and weight status
- Track their clients
Structure
Flowchart
Below is a flowchart describing the structure of the application, created with Lucidchart.
Click here to view it.
Initial Screen
At the Initial Screen, user has two options: navigate to new client, or to existing client. This welcomes the user, and give them some instructions.
Click here to view the screenshot.
New Client
At the new client section, user will be asked many details to calculate Body Mass Index (BMI), Basal Metabolic Rate (BMR), and create diets. At the end inserting all the data into the worksheet.
Click here to view the screenshots
Existing Client
At the existing client section, user will be able to consult a client that was already created before, by their ID. If wanted, user can update the client details, and create new diets.
Click here to view the screenshots.
Features
- Calculate Body Mass Index (BMI)
- Calculate Basal Metabolic Rate (BMR)
- Create diet to loss weight
- Create diet to gain weight
- Create diet to mantain weight
- Save data into a worksheet
- Update existing client and create new diets
- User can have several clients at the same time
Future Features
- User can delete a client
- User can save new details without deleting the old ones, being possible to do a future comparison
- Create diets specifying the number of carbohydrates, fat, and protein depending on client goal.
Technologies Used
Languages
- Python 3 - Was used solely to create this project.
Applications and Platforms
- Git - Version control system used to commit and push to Github via Gitpod.
- Github - The projects repository and all its branches were commited, pushed and deployed to Github.
- Gitpod - All code was written and tested using the Gitpod web-based IDE.
- Heroku - Used to deploy the application.
- Lucidchart - Lucidchart was used to create the flowchart of the project.
- Google Sheets - The users input data creates and edits content on Google Sheets
- Google Cloud Platform - All data send and received with the help of the Google API, through the Google Cloud Platform
Third Party Libraries
- googleapiclient.discovery: needed to work with the Google API
- google.oauth2.service_account: So the application can access the account that the sheet are on with the credentials
- gspread: so the application can read Google Spreadsheets
Validation
All Python files passed the PEP8 tests with 0 errors. Click here to view them.
Testing
Testing new client
"I would like to register a new client and create diets to them"
- Actions:
- User hits "n" to add new client
- User enters "1" to agree on the application logging the patient data
- User enters client name
- User enters client last name
- User enters client gender
- User enters client height
- User enters client weight
- User enters client age
- User enters client activite level
- User enters "n" to continue
- BMI is calculated"
- User enters "n" to continue
- BMR is calculated
- User enters "n" to continue
- Diet is calculated and saved
-
Expected result: To create a successful client and their diets
-
Actual result: Works as intended
Testing existing client
"I would like to update a existing client details and process new diets
- Actions:
- User hits "e" to access existing client
- User enters "1" to consult client
- User enters client id
- User get clients details and diets
- User enters 1 to update client details
- User enters client height
- User enters client weight
- User enters client age
- User enters client activite level
- User enters "n" to continue
- BMI is calculated"
- User enters "n" to continue
- BMR is calculated
- User enters "n" to continue
- New diet is calculated and updated
-
Expected result: To update a client details and their diets
-
Actual result: Works as intended
Deployment
Heroku
This application has been deployed from Github using Heroku. Here's how:
- Create an account at heroku.com
- Create a new app, add app name and your region
- Click on create app
- Go to "Settings"
- Under Config Vars, add your sensitive data (creds.json for example)
- For this project, I set buildpacks to and in that order.
- Go to "Deploy" and at "Deployment method", click on "Connect to Github"
- Enter your repository name and click on it when it shows below
- Choose the branch you want to buid your app from
- If desired, click on "Enable Automatic Deploys", which keeps the app up to date with your Github repository
- All done!
Google API
Here's how you can set up your own API:
- Login or create a Google account and navigate to https://console.cloud.google.com/
- Create a new Project by clicking on the New Project icon
- Add Project name and details
- Under API's and services, enable the relevant API for your project (in this case Google Drive, Sheets)
- IF the API requires, create a credential (service account in this case) for your project
- Download the credential and upload it to your workspace as creds.json file
- Under API's and services, enable the relevant API for your project (in this case Google Drive, Sheets)
- Add them to your code.