How garimapaudel/heartdiseaseprediction-6thsemproject works
Main Components
• Frontend (Client/Web Interface):
• Templates & Static Assets: The “templates” directory contains HTML files (index.html, predict.html, disease.html, about.html) which form the user interface.
• User Web Browser: Acts as the front end that displays these pages and captures user inputs (e.g., patient age, sex, blood pressure, cholesterol, etc.).
• Backend (Application Server):
• The “app.py” file serves as the entry point for the application. It likely uses a framework like Flask to handle HTTP requests, route between pages, and manage user submissions.
• It accepts user inputs from the frontend and interacts with the prediction engine.
• Machine Learning Component:
• Pre-trained ML Model(s): The model file (“model_rand.pkl”) stored at the root (and possibly training notebooks in the “ML Models” folder) functions as the core engine for predicting the presence of heart disease.
• ML Development Artifacts: The “ML Models” folder contains Jupyter notebooks for data preprocessing, initial prediction experiments, hyperparameter tuning, and file checkpoints which were used during development and training.
• Datasets and Intermediate Files: CSV files (datasetforproject.csv, preprocessed_dataset.csv) exist to support training and validation.
Relationships and Interactions
• The User (via the browser) submits heart health data on a web page.
• The application server (app.py) receives the input, passes it to the loaded ML model (from model_rand.pkl).
• The ML model processes the input and returns a prediction (presence or absence of heart disease).
• The result is then rendered on an appropriate web template (predict.html or disease.html) and sent back to the client.
• Additionally, the “ML Models” directory represents the experimental and training flows used to develop and fine-tune the model. This can be depicted as a separate “development/training pipeline” component that eventually outputs a production-ready model.
Important Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly divides responsibilities between the user interface (HTML templates and static files), the backend logic that handles request routing and prediction (app.py), and the machine learning model development (ML Models directory with notebooks).
• Model Deployment: The architecture shows the transition from model experimentation (using Jupyter notebooks, CSV datasets, and interim pickle files) to a deployment-ready model used in production.
• Clear Data Flow: User inputs travel from the client to the backend, where the ML component (loaded model) is invoked, and the output is then rendered back on the web page.
Relevant Technologies and Libraries
• Web Framework: Likely Flask (suggested by the use of app.py, templates, and static directories).
• Python Libraries: Libraries for machine learning (e.g., scikit-learn, pandas, etc.) potentially used during model training and prediction.
• Jupyter Notebooks: Helped in experimentation, data preprocessing, and fine-tuning the ML model.
• Pickle: Used for serializing and deserializing the ML model.