This project is a full-stack application that helps users predict health risks based on their medical data and provides personalized health goals and tracking features. The system uses React for the frontend, Express for the backend, Flask for machine learning models, and MongoDB for storing user data.
- Project Overview
- Key Features
- Tech Stack
- Prerequisites
- Installation
- Running the Application
- Project Structure
- Backend API Endpoints
- Contributing
- License
The Health Risk Prediction and Management System allows users to:
- Predict health risks like strokes based on their medical history and lifestyle data using machine learning models.
- Track health goals (e.g., reducing BMI, maintaining blood pressure) and monitor progress.
- View personalized health recommendations to reduce risk levels.
- Secure access through user authentication (registration and login).
- Registration/Login: Users must first register or login.
- Data Submission: Users fill out forms providing their health data.
- Machine Learning Prediction: The data is sent to the backend, which communicates with Flask to get predictions from ML models.
- Health Recommendations: Based on the user's input, personalized health tips are given.
- User Authentication: Secure registration and login with JWT tokens.
- Health Risk Prediction: Predicts health risks like strokes based on user input.
- Data Persistence: User inputs and health data are stored in MongoDB.
- Personalized Health Tips: After prediction, personalized tips and goals are provided to the user.
- Frontend: React, Material-UI for styling.
- Backend: Express.js (Node.js), Axios for API communication.
- Machine Learning: Flask (Python) for health risk prediction using ML models.
- Database: MongoDB for user data storage.
- Authentication: JWT for token-based authentication.
Make sure you have the following installed on your system:
- Node.js (v12.x or later)
- npm
- Python (v3.6 or later)
- MongoDB
- Netlify CLI (for deployment)
git clone https://github.com/your-repository/health-risk-prediction.git
cd health-risk-prediction- Install MongoDB locally or use a cloud service like MongoDB Atlas.
- Create a database named as per your choice.
- Make sure to configure the MongoDB URI in the .env file of the backend (Express).
cd frontend
npm install cd backend
npm install cd backend
python -m venv venv
venv\Scripts\activate cd backend
pip install -r requirements.txt TOKEN_SECRET=your_secret_key
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
REACT_APP_BACKEND_URL=http://localhost:5000- Start the backend server:
cd backend
nodemon server.js- Start the frontend server:
cd frontend
npm start- Start the Flask server:
cd backend
python app.py.
├── frontend/ # React Frontend
│ ├── public/
│ └── src/
│ ├── components/
│ ├── pages/
│ ├── styles/
│ └── App.js
├── backend/ # Express Backend
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ └── app.js
├── diabetes_model.pkl
├── heart_disease_model.pkl
├── stroke_model.pkl
├── requirements.txt
├── liver_model.pkl
├── server.js
└── README.md-
Request Body :
{ "username": "", "email": "", "password": "" }
-
Request Body :
{ "email": "", "password": "" }
Apache License Version 2.0, September 2024 http://www.apache.org/licenses/
Copyright 2024 Divyanshu Tyagi
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.