The dataset is publicly available on Kaggle: Heart Failure Prediction Dataset
A local copy (heart.csv) is included in this repository for convenience.
- Number of records: 918 patients
- Features: 11 medical attributes per patient, including:
- Age, Sex, Cholesterol, Resting Blood Pressure, Max Heart Rate, etc.
- Target variable:
HeartDisease- Binary classification:
1→ Patient has heart disease0→ Patient does not have heart disease
- Binary classification:
ℹ️ The dataset is relatively small but contains rich information for predictive modeling. Detailed descriptions of the attributes are available on the Kaggle dataset page.
The objective of this project is to build a predictive model that can determine whether a patient is at risk of heart disease based on their medical attributes.
- Type of problem: Binary classification
- Goal: Predict the likelihood of heart disease for a given patient record.
By training on this dataset, the model should be able to learn patterns and relationships in the medical features that indicate risk, enabling early detection and potential preventive measures.
- The dataset used for training (
heart.csv) is included in the repository. - More details about the features and dataset statistics can be found on the Kaggle dataset page.
(Running and Testing the Project)
This application is packaged as a Docker image and can be run locally using Docker. Follow the steps below to start the app and test predictions using the built-in /docs UI.
✅ Prerequisites
You must have the following installed:
Docker → https://www.docker.com/get-started
A modern web browser (Chrome, Safari, Firefox, etc.)
No other tools or setup are required.
🚀 Run the App Locally Using Docker
Pull and run the Docker image:
docker run -p 9696:9696 dvsrinath/mlzc-midterm-srinath
This starts the FastAPI app with the following entrypoint:
uvicorn predict:app --host 0.0.0.0 --port 9696
Once running, the service will be available at:
📘 Test the API Using Swagger UI
Open your browser and go to:
This will load the interactive FastAPI Swagger documentation.
Example Request Body
Use the following sample data for testing:
{ "age": 58, "sex": "m", "chestpaintype": "asy", "restingbp": 114, "cholesterol": 318, "fastingbs": "low", "restingecg": "st", "maxhr": 140, "exerciseangina": "n", "oldpeak": 4.4, "st_slope": "down" }
✅ Expected Response
If everything is working correctly, you should receive a prediction similar to:
{ "heartdisease_probability": 0.8307692307692308, "heartdisease": true }
🛑 Stopping the App
Press Ctrl+C in the terminal that is running the container, or stop the container using:
docker ps docker stop <container_id>
Attached images from a local run of flyway.io:
Account: https://fly.io/apps/mlzc-midterm/monitoring App: https://mlzc-midterm.fly.dev/ (Note the app has been torn down and is not available)
https://github.com/sdronava/mlzc_midterm
https://github.com/DataTalksClub/machine-learning-zoomcamp/tree/master/projects
