A comprehensive web application that uses Machine Learning to predict potential health risks and diseases based on user symptoms and vital statistics. The app provides early warning signs and helps users make informed decisions about consulting healthcare professionals.
- Features
- Technology Stack
- Project Structure
- Installation Guide
- API Endpoints
- ML Model Details
- Screenshots
- Contributing
- License
- AI-Powered Health Predictions: Machine Learning models for disease risk assessment
- Symptom Analysis: Multi-symptom input with intelligent risk calculation
- Real-time Risk Assessment: Instant health risk evaluation with confidence scores
- Health History Tracking: Complete record of all predictions and assessments
- Interactive Analytics: Visual charts and insights into health trends
- Modern Responsive UI: Clean, professional medical interface
- Interactive Dashboard: Overview of health statistics and recent activities
- Risk Visualization: Color-coded risk meters and progress indicators
- Data Export: CSV export functionality for health records
- Mobile-Friendly: Fully responsive design for all devices
- RESTful API Architecture: Scalable backend services
- Real-time Data Processing: Immediate prediction results
- Secure Data Storage: MongoDB database with proper data modeling
- Modular ML Service: Separate Python service for machine learning
- Error Handling: Comprehensive error management and user feedback
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2.0 | UI Framework |
| Vite | 5.0.0 | Build Tool & Dev Server |
| Tailwind CSS | 3.3.6 | Utility-first CSS Framework |
| React Router DOM | 6.8.0 | Client-side Routing |
| Axios | 1.6.0 | HTTP Client for API calls |
| Recharts | 2.8.0 | Data Visualization Charts |
| Lucide React | 0.294.0 | Icon Library |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 18+ | JavaScript Runtime |
| Express.js | 4.18.2 | Web Framework |
| MongoDB | 6.0+ | NoSQL Database |
| Mongoose | 8.0.0 | MongoDB ODM |
| CORS | 2.8.5 | Cross-Origin Resource Sharing |
| Helmet | 7.1.0 | Security Middleware |
| Express Rate Limit | 7.1.0 | API Rate Limiting |
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.8+ | ML Service Runtime |
| Flask | 2.3.3 | Python Web Framework |
| Pandas | 2.1.0 | Data Manipulation |
| Scikit-learn | 1.3.0 | Machine Learning Library |
| NumPy | 1.24.0 | Numerical Computing |
| Joblib | 1.3.0 | Model Serialization |
health-tracker/
βββ client/ # React Frontend
β βββ src/
β β βββ components/ # Reusable UI Components
β β βββ pages/ # Page Components
β β βββ context/ # React Context for State Management
β β βββ services/ # API Service Functions
β β βββ assets/ # Static Assets
β βββ package.json
β βββ vite.config.js
βββ server/ # Node.js Backend
β βββ models/ # MongoDB Data Models
β βββ routes/ # API Route Handlers
β βββ middleware/ # Custom Middleware
β βββ server.js # Express Server Entry Point
β βββ package.json
βββ ml-service/ # Python ML Service
β βββ app.py # Flask Application
β βββ requirements.txt # Python Dependencies
β βββ models/ # Trained ML Models
βββ README.md
Before you begin, ensure you have the following installed on your system:
- Node.js (v18 or higher)
- Python (v3.8 or higher)
- MongoDB (v6.0 or higher)
- npm or yarn package manager
git clone https://github.com/your-username/health-tracker.git
cd health-tracker# Navigate to server directory
cd server
# Install dependencies
npm install
# Create environment file
echo "MONGODB_URI=mongodb://localhost:27017/health-tracker" > .env
echo "ML_SERVICE_URL=http://localhost:8000" >> .env
echo "PORT=5000" >> .env
echo "NODE_ENV=development" >> .env
# Start the server (development mode)
npm run dev
# Or start in production mode
npm start# Open a new terminal and navigate to ml-service
cd ml-service
# Create virtual environment (recommended)
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Start the ML service
python app.py# Open a new terminal and navigate to client
cd client
# Install dependencies
npm install
# Start the development server
npm run dev# Using Docker (recommended)
docker run -d -p 27017:27017 --name mongodb mongo:latest
# Or using locally installed MongoDB
mongod --dbpath /path/to/your/databaseOpen your browser and navigate to:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000/api/health
- ML Service: http://localhost:8000/health
# Clone the repository
git clone https://github.com/your-username/health-tracker.git
cd health-tracker
# Start all services with Docker Compose
docker-compose up -d
# Check running services
docker-compose ps
# View logs
docker-compose logs -fversion: '3.8'
services:
mongodb:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
ml-service:
build: ./ml-service
ports:
- "8000:8000"
environment:
- FLASK_ENV=production
server:
build: ./server
ports:
- "5000:5000"
environment:
- MONGODB_URI=mongodb://mongodb:27017/health-tracker
- ML_SERVICE_URL=http://ml-service:8000
depends_on:
- mongodb
- ml-service
client:
build: ./client
ports:
- "3000:3000"
depends_on:
- server
volumes:
mongodb_data:| Method | Endpoint | Description | Request Body |
|---|---|---|---|
POST |
/api/predict |
Make health prediction | Health data JSON |
GET |
/api/predictions |
Get prediction history | - |
GET |
/api/stats |
Get analytics statistics | - |
DELETE |
/api/predictions/:id |
Delete a prediction | - |
// Make a prediction
const healthData = {
age: 45,
gender: "male",
bloodPressure: 145,
cholesterol: 240,
heartRate: 92,
glucose: 130,
bmi: 28.5,
symptoms: ["Fatigue", "Chest Pain"]
};
const response = await fetch('/api/predict', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(healthData)
});
const prediction = await response.json();
console.log(prediction);The application uses a rule-based risk assessment system that can be enhanced with trained ML models:
# Current Risk Calculation (Rule-based)
risk_score = 0
# Age factor
if age > 50: risk_score += 0.3
elif age > 30: risk_score += 0.1
# Blood pressure factor
if bp > 140: risk_score += 0.3
elif bp > 120: risk_score += 0.1
# Cholesterol factor
if cholesterol > 240: risk_score += 0.3
elif cholesterol > 200: risk_score += 0.1
# Glucose factor
if glucose > 126: risk_score += 0.3
elif glucose > 100: risk_score += 0.1- Random Forest Classifier for disease prediction
- Logistic Regression for probability scores
- Neural Networks for complex pattern recognition
- Integration with Kaggle health datasets
- Frontend Components:
cd client/src/components
# Create new component files- Backend Routes:
cd server/routes
# Add new API endpoints- ML Models:
cd ml-service
# Add new prediction algorithms# Frontend tests
cd client
npm test
# Backend tests
cd server
npm test
# ML service tests
cd ml-service
python -m pytest# Build frontend
cd client
npm run build
# Build backend (if using TypeScript)
cd server
npm run build
# The build files will be in dist/ foldersWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Frontend: ESLint + Prettier configuration
- Backend: Standard JavaScript style
- Python: PEP 8 compliance
- Commit Messages: Conventional commits format
This project is licensed under the MIT License - see the LICENSE file for details.
This application is for educational and informational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.
If you encounter any issues or have questions:
- Check the Troubleshooting Guide
- Search existing GitHub Issues
- Create a new issue with detailed information
- Project Maintainer: PRITAM TUNG
- GitHub Repository: https://github.com/your-username/health-tracker
- Documentation: https://health-tracker-docs.example.com
Made with β€οΈ for better health awareness
If you find this project helpful, please give it a β on GitHub!