Skip to content

Latest commit

 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HealthLens AI

HealthLens AI is a wellness monitoring tool designed to track heart rate (HR), heart rate variability (HRV), and respiratory rate (RR) using remote photoplethysmogram (rPPG) and artificial intelligence (AI). The project aims to provide a non-invasive, accurate, and real-time analysis of vital signs through just a webcam or mobile camera.

Project Overview

HealthLens AI aims to create a wellness solution that helps individuals monitor their health metrics in a simple and user-friendly manner. By leveraging AI algorithms and rPPG technology, the tool will analyze user's vital signs and provide insights on their health status.

For a detailed project overview and introduction, please refer to the Project Overview.

Key Features:

  • Heart Rate (HR) Monitoring: Real-time heart rate measurement.
  • Heart Rate Variability (HRV) Calculation: Monitor HRV for stress and overall health.
  • Respiratory Rate (RR): Track the rate of breaths per minute.
  • Chatbot Integration: Provides health tips and advice based on collected data.
  • Data Privacy & Security: Adheres to best practices in data handling and user privacy.

Technologies Used:

  • Frontend:

    • Next.js (React-based framework)
    • Tailwind CSS (Utility-first CSS framework)
    • TypeScript (JavaScript with static types)
  • Backend:

    • FastAPI (Asynchronous Python web framework)
    • Python 3.10+
    • PostgreSQL (For database management, using Docker or Supabase)
  • AI & Data Processing:

    • rPPG (remote photoplethysmography) for non-invasive heart rate monitoring
    • Gemini 2.5 Flash API (Google) for AI chatbot responses
    • OpenCV and MediaPipe for video capture and signal processing
  • Security & Authentication:

    • JWT Authentication for secure user login
    • OAuth2 for third-party authentication options

Setup Instructions

Follow the instructions below to set up the project locally.

Prerequisites

Ensure you have the following installed:

Clone the Repository

git clone https://github.com/YOUR_USERNAME/HealthLensAI.git
cd HealthLensAI

Frontend Setup (Next.js)

  1. Navigate to the frontend directory and install dependencies:
cd healthlens-frontend
npm install
  1. Configure Tailwind CSS:
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init
  1. Install ESLint and Prettier for code formatting:
npm install eslint prettier eslint-config-prettier eslint-plugin-prettier --save-dev
  1. Run the frontend:
npm run dev

Backend Setup (FastAPI)

  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Linux/Mac
.\venv\Scripts\activate  # On Windows
  1. Install the required dependencies:
pip install fastapi uvicorn opencv-python mediapipe numpy scipy pandas scikit-learn sqlalchemy psycopg2-binary python-jose[cryptography] passlib[bcrypt]
  1. Run the backend server:
uvicorn app.main:app --reload

Database Setup

  1. Using Docker Compose: If you prefer local development, set up PostgreSQL with Docker. Create a docker-compose.yml file with the following content:
   version: '3.8'
   services:
     db:
       image: postgres:13
       environment:
         POSTGRES_DB: healthlens
         POSTGRES_USER: healthlens_user
         POSTGRES_PASSWORD: password
       ports:
         - "5432:5432"

then, run the following command:

docker-compose up -d
  1. Using Supabase:
  • Create an account on Supabase and
  • Follow the instructions to set up a PostgreSQL database and note down your database connection details (host, database, username, password).
  • You can use these credentials to configure the PostgreSQL connection in your backend.

API Keys

  1. Obtain a Gemini API key to enable AI chatbot functionality:
  • Go to Google AI Studio to generate a free Gemini API key.
  • Once you have your API key, store it in the .env.local file at the root of the frontend project:
GEMINI_API_KEY=your_api_key_here
  1. Set the API key in your environment variables.
  • Make sure to load this key in your Next.js backend route (/api/chat) via process.env.GEMINI_API_KEY.
  • Never commit your .env.local file — it is already excluded via .gitignore.

Development

To contribute to the project, fork the repository and create a pull request with your changes. Please follow the following steps:

  1. Fork the repository on GitHub.
  2. Clone your fork to your local machine:
git clone https://github.com/YOUR_USERNAME/HealthLensAI.git
  1. Create a new branch for your changes:
git checkout -b feature-branch-name
  1. Push changes to your fork:
git push origin feature-branch-name
  1. Create a pull request on GitHub.

Design Principles

  • Wellness Tool, Not Medical Device: This tool is designed for wellness monitoring, not for diagnosing medical conditions.
  • Privacy-First: User data is handled with strict privacy in mind. No raw video is stored, and all data is encrypted and anonymized.
  • Safety-First: All health-related advice is provided with disclaimers. The AI chatbot offers general tips and encourages users to consult medical professionals for serious concerns.
  • Transparency: All health metrics are presented with confidence scores to ensure the user understands the quality of the data being presented.

Data Security and Privacy

  1. Encryption and Data Handling:
  • All sensitive data, including health metrics, will be encrypted both in transit (using SSL/TLS) and at rest (using AES-256 encryption).
  • Health data such as heart rate, HRV, and RR will be anonymized and stored only after processing. Raw video footage will never be stored.
  1. Data Anonymization:
  • Personal identifiable information (PII) will be removed wherever possible from the stored data, ensuring that the system complies with data protection regulations (e.g., GDPR).
  1. User Consent:
  • Before any data is collected, the user will be required to give explicit consent regarding how their data will be collected, processed, stored, and used. The system will provide clear information on what data is being collected and why.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

We welcome contributions to HealthLens AI! Please fork the repository and submit pull requests for bug fixes, improvements, or new features.

Future Work

  • BP Estimation (Phase 5): Integrating blood pressure estimation and calibration.
  • Mobile Version: Developing a mobile app using React Native or PWA.
  • Enhanced Chatbot Features: Adding more personalized health advice based on user data.

Glossary

  • rPPG (remote Photoplethysmography): A technology used to measure physiological signals (such as heart rate) by analyzing subtle changes in skin color due to blood flow, captured through a device's camera (smartphone or laptop).
  • HR (Heart Rate): The number of heartbeats per minute.
  • HRV (Heart Rate Variability): The variation in the time interval between heartbeats, a key indicator of stress levels and overall health.
  • RR (Respiratory Rate): The number of breaths per minute.
  • AI (Artificial Intelligence): A technology that enables the system to automatically analyze data and provide health recommendations based on the collected data.
  • MVP (Minimum Viable Product): The first version of the product with just enough features to test the market and gather user feedback.
  • BP (Blood Pressure): The measurement of the force exerted by blood against the walls of arteries.
  • API (Application Programming Interface): A set of rules that allow different software applications to communicate with each other.
  • JWT (JSON Web Token): An open standard for securely exchanging information between systems via tokens (authentication tokens).

Acronyms

Acronym Meaning
rPPG Remote Photoplethysmography
HR Heart Rate
HRV Heart Rate Variability
RR Respiratory Rate
AI Artificial Intelligence
MVP Minimum Viable Product
BP Blood Pressure
API Application Programming Interface
JWT JSON Web Token

About

A wellness monitoring tool using rPPG technology and AI assistance.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages