Skip to content

maheshLEO4/Wellness_Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wellness Tracker API

Project Description:
A single Python script that trains a Polynomial Ridge Regression model to predict a wellness index and exposes a Flask API for real-time predictions.


1. Project Structure


wellTrack/
│
├── wellness\_app.py              # All-in-one training + Flask API
├── wellness\_dataset\_cleaned.csv # Dataset
├── requirements.txt             # Python dependencies
├── Dockerfile                   # Docker setup
└── README.md                    # Project documentation


2. Installation

2.1 Clone the Repository

git clone https://github.com/maheshLEO4/Wellness_Tracker.git
cd wellTrack

2.2 Install Dependencies

pip install -r requirements.txt

⚠️ Make sure you’re using Python 3.10+ (recommended).


3. Run All-in-One Script

python wellness_app.py

The script will automatically:

  1. Load and clean the dataset
  2. Train a Polynomial Ridge Regression model
  3. Save the trained model (wellness_poly_pipeline.pkl)
  4. Start the Flask API at http://127.0.0.1:5000/

4. API Endpoint

POST /predict

Request Body (JSON):

{
    "features": [age, sleep_hours, phone_use_hours, water_liters, gender_Male, gender_Other]
}

Feature Description:

Feature Type Notes
age int Age of the user
sleep_hours float Average sleep hours
phone_use_hours float Daily phone usage hours
water_liters float Daily water intake
gender_Male int 0 = False, 1 = True
gender_Other int 0 = False, 1 = True

Response (JSON):

{
    "wellness_index_percentage": 60
}

5. Test API with curl

curl -X POST http://127.0.0.1:5000/predict
-H "Content-Type: application/json"
-d '{"features": [34, 7.2, 7.3, 2.4, 0, 0]}'


---

## 6. Docker Deployment

### 6.1 Build Docker Image

```bash
docker build -t wellness-api .

6.2 Run Docker Container

docker run -p 5000:5000 wellness-api

Access the API at: http://localhost:5000/predict

7. Notes

  • Feature order and number must match the dataset columns.
  • gender_Male and gender_Other must be 0 or 1.
  • The script is self-contained, so no separate training step is required.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published