https://github.com/b-acharekar/vitalflow_backend
VitalFlow Backend is the server-side engine of the VitalFlow health tracking app, built with Flask and MongoDB. It manages user authentication, health data storage, NLP-based water and stress analysis, and provides smart insights through secure API endpoints.
https://github.com/b-acharekar/vitalflow_backend
backend-api flask flask-restful health-tracking hydration mongodb nlp python server stress-analysis
Last synced: 8 months ago
JSON representation
VitalFlow Backend is the server-side engine of the VitalFlow health tracking app, built with Flask and MongoDB. It manages user authentication, health data storage, NLP-based water and stress analysis, and provides smart insights through secure API endpoints.
- Host: GitHub
- URL: https://github.com/b-acharekar/vitalflow_backend
- Owner: B-Acharekar
- Created: 2025-03-21T15:14:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-26T02:16:20.000Z (about 1 year ago)
- Last Synced: 2025-07-29T17:45:09.791Z (11 months ago)
- Topics: backend-api, flask, flask-restful, health-tracking, hydration, mongodb, nlp, python, server, stress-analysis
- Language: Python
- Homepage:
- Size: 74.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# VitalFlow Backend
VitalFlow is a health monitoring system that integrates health data from Android devices using Flutter and Kotlin, processes it through a Flask-based backend, and stores insights in a MongoDB database. This backend handles API endpoints for health metrics like steps, heart rate, sleep, hydration, stress levels, and daily performance.
---
## Features
- User Authentication (Signup/Login with bcrypt password hashing)
- Health Data Syncing from Health Connect (Steps, Heart Rate, Sleep, etc.)
- Water Intake Logging (Manual and estimated via NLP)
- Stress Detection (Text-based and calculated from vitals)
- Sleep Monitoring using bedtime schedule
- Performance & Insights Engine combining metrics
- Data Visualization Support for graphs and trends (via API)
---
## Tech Stack
| Layer | Tech |
|-------------|------------------------------|
| Backend | Python, Flask |
| Database | MongoDB |
| Auth | Bcrypt, JWT (optional) |
| API Design | RESTful |
| NLP Model | Scikit-learn / SpaCy / Custom ML |
| Platform | Android (Flutter & Kotlin) |
---
## Project Structure
```
vitalflow_backend/
│
├── app/
│ ├── __init__.py
│ ├── routes/
│ │ ├── auth.py
│ │ ├── health_data.py
│ │ ├── water_log.py
│ │ ├── stress_log.py
│ │ └── insights.py
│ ├── models/
│ │ ├── user.py
│ │ ├── health.py
│ │ └── utils.py
│ └── nlp/
│ ├── water_parser.py
│ └── stress_analyzer.py
│
├── config.py
├── requirements.txt
├── run.py
└── README.md
```
---
## Getting Started
### 1. Clone the Repository
```bash
git clone https://github.com/B-Acharekar/vitalflow_backend.git
cd vitalflow_backend
```
### 2. Create a Virtual Environment
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
### 3. Install Dependencies
```bash
pip install -r requirements.txt
```
### 4. Configure Environment Variables
Create a `.env` file in the root directory with the following content:
```
MONGO_URI=mongodb://localhost:27017/vitalflow
SECRET_KEY=your-secret-key
```
### 5. Run the Server
```bash
python run.py
```
Server runs at `http://localhost:5000/`
---
## API Endpoints Overview
| Method | Endpoint | Description |
|--------|------------------------|----------------------------------|
| POST | `/signup` | Register a new user |
| POST | `/login` | Authenticate user |
| POST | `/health/steps` | Log step data |
| POST | `/health/heart-rate` | Log heart rate |
| POST | `/health/sleep` | Log sleep duration |
| POST | `/water/log` | Log water intake |
| POST | `/stress/analyze` | Log and analyze stress input |
| GET | `/insights/day` | Get daily performance insights |
---
## NLP and Stress Estimation
- **Water Intake Parsing**: Converts phrases like "drank a glass of water" into estimated ml values.
- **Stress Detection**: Based on sentiment analysis or derived from heart rate and sleep data.
---
## Future Improvements
- Add unit and integration tests
- Add Swagger/OpenAPI documentation
- Dockerize for containerized deployment
- Implement CI/CD pipeline
```