Fitomo Prediction Service
Fitomo Prediction Service is a tool to forecast users' future health, based on their current steps, sleep and heart rate data as well as previous trends.
Table of Contents
- Getting started
- Tech Stack
- Directory Layout
This service takes 'GET' requests at '/api/getPrediction'; data to include is a dictionary with the following keys:
date user_id steps total_sleep resting_hr step_week_slope sleep_week_slope hr_week_slope
The service will then output the current health score and predicted health score (calculated using a gradient boosting regression). Incorrect requests will not return health scores.
1. Clone the latest version
Start by cloning the latest version of the Fitomo Prediction Service on your local machine by running:
$ git clone https://github.com/Fitomo/Prediction-Service.git $ cd Prediction-Service
2. Setup Environment
$ pip install virtualenv
Setup a virtual environment for the application:
$ virtualenv venv $ source venv/bin/activate
3. Install Dependencies
From within the root directory run the following command to install all dependencies:
$ pip install -r requirements.txt
4. Run the application
Start your local PostgreSQL database instance
Run the following command in your terminal to run the app:
$ python app/app.py
After that open in your browser the localhost with your chosen port, e.g.
http://localhost:5000/to access the application.
├── /algorithm/ # Algorithm-related code │ ├── /predicted_health_algorithm.py/ # Creating and tuning the algorithm │ ├── /data_prep/ # Prepping and cleaning code for the algorithm │ ├── /clean_data.py/ # Putting data into useful format for the algorithm │ ├── /prep_generated_data.py/ # Prepare generated user data to be cleaned │ ├── /results/ # Results and analysis of algorithm │ ├── /parameter_tuning_results.py/ # Prepare generated user data to be cleaned ├── /app/ # Server source code │ ├── /migrations/ # Database migration data │ ├── /app.py/ # Core server file │ ├── /config.py/ # Configs for different situations │ ├── /manage.py/ # Manage database migrations │ ├── /models.py/ # Data model │ ├── /health_prediction.pkl/ # Prediction algorithm ├── /tests/ # Server and client side tests └── requirements.txt # List of 3rd party libraries and utilities to be installed └── .env # Environment variables
- Fork the repo.
- Clone it to your local computer
- Cut a namespaced feature branch from master and name it appropriately
- Make commits and prefix each commit with the type of work you were doing
- BEFORE PUSHING UP YOUR CHANGES, rebase upstream changes into your branch, fix any potential conflicts, and then push to your fork.
- Submit a pull request directly to the master
- Someone else will perform code review to keep codebase clean
- Fix any errors or issues raised by the reviewer and push the fixes as a single new commit
- Repeat until the pull request is merged.
See CONTRIBUTING.md for contribution guidelines in detail.