This is a Django-based web application for predicting cardiovascular disease risk based on user-entered data. The system provides a user-friendly interface for signup, login, data entry, and viewing results.
- Signup Page: Users can create an account by providing basic information.
- Login Page: Registered users can log in securely to access the system.
- Data Entry Page: Users can enter their personal health data, including age, gender, height, weight, blood pressure, cholesterol levels, and lifestyle factors.
- Result Page (Positive): Displays a positive result indicating the presence of cardiovascular disease based on the entered data.
- Result Page (Negative): Displays a negative result indicating the absence of cardiovascular disease based on the entered data.
The backend of the Cardiovascular Disease Prediction System is implemented using Python and the Django web framework. Here's how the system works:
-
Data Preprocessing: The system starts by preprocessing the input data. It reads a dataset (
cardio_train.csv
) containing information about patients, including their age, gender, height, weight, blood pressure, cholesterol levels, and other health indicators. -
Feature Selection: The system selects relevant features from the dataset to use for prediction. In the
userdetailsview
function of theviews.py
file, features such as age, gender, height, weight, blood pressure, cholesterol levels, smoking status, alcohol consumption, and physical activity are extracted from the user input. -
Model Training: After feature selection, the system splits the dataset into training and testing sets using the
train_test_split
function from thesklearn.model_selection
module. It then trains a machine learning model using theRandom Forest Classifier algorithm
from thesklearn.ensemble
module. The model is trained on the training data to predict the presence or absence of cardiovascular disease based on the selected features. -
Prediction: Once the model is trained, the system uses the input provided by the user to make a prediction. The user-entered data is converted into a numpy array and passed to the trained model's
predict
function. The model predicts whether the user has cardiovascular disease or not based on the input features. -
Result Rendering: Finally, the system renders a result page (
result.html
) to display the prediction outcome to the user. If the model predicts that the user has cardiovascular disease, the result page displays a message indicating the presence of the disease. Otherwise, it displays a message indicating that the user is normal.
By leveraging machine learning algorithms and Django's powerful web development capabilities, the Cardiovascular Disease Prediction System provides users with valuable insights into their health status and helps them make informed decisions about their well-being.
-
Clone the repository:
git clone https://github.com/yourusername/cardiovascular-disease-prediction.git
-
Install dependencies:
pip install -r requirements.txt
-
Run the Django server:
python manage.py runserver
-
Open your web browser and navigate to http://localhost:8000 to access the application.