Degree
Bachelor of Science (Computer Science)
Department
Department of Computer Science
School
School of Mathematics and Computer Science (SMCS)
Advisor
Dr. Imran Khan, Assistant Professor, Department of Computer Science, IBA Karachi
Keywords
Electrocardiography, Arrhythmia Classification, Deep Learning, Explainable Artificial Intelligence, Clinical Decision Support, Retrieval Augmented Generation
Abstract
Cardiac Digital Shadow is an AI powered ECG analysis platform that makes clinical grade arrhythmia detection accessible through a web interface. Traditional ECG interpretation depends on trained cardiologists and specialist software, which creates a bottleneck in research and educational settings where fast, automated analysis is needed. The platform lets users upload a twelve lead ECG recording and receive an instant AI driven analysis across 71 diagnostic and rhythm conditions. A deep learning model trained on the PTB-XL dataset identifies conditions with severity classifications and highlights the exact regions of the waveform that influenced each prediction. The system also computes clinical measurements such as heart rate, PR interval, QRS duration and QTc, adjusts interpretations based on patient demographics, and generates structured clinical notes. Users can simulate cardiac pathologies and treatments, ask an AI assistant questions about the analysis in plain language, and export a formatted clinical report. The main contribution of this project is bringing deep learning inference, signal level explainability, demographic aware clinical reasoning and an accessible web interface together in a single platform that supports medical education, ECG research and pre clinical decision support.
Tools and Technologies Used
Python, FastAPI, Uvicorn, PyTorch, Keras, scikit learn, NumPy, SciPy, pandas, NeuroKit2, WFDB, HeartPy, PyWavelets, joblib, ReportLab, Groq API, LangGraph, ChromaDB, sentence transformers, Pydantic, React 19, TypeScript, Vite, Tailwind CSS, uPlot, Docker, Docker Compose
Methodology
The project followed a modular, pipeline driven approach in which each component was built and validated independently before integration.
- ECG data pipeline: supports WFDB and CSV formats with automatic format detection, lead standardisation, amplitude normalisation and resampling.
- Classification model: an xresnet1d101 model was trained on PTB-XL for 71 class multi label cardiac classification. It was benchmarked against SVM, Logistic Regression and a Transformer encoder baseline to measure performance gains.
- Clinical measurements: a NeuroKit2 based delineation layer extracts PR interval, QRS duration, QTc and HRV metrics, and a signal quality gate rejects corrupt recordings before inference.
- Explainability: Grad-CAM produces temporal saliency maps over the raw ECG so that predictions are interpretable and clinically grounded.
- Demographic reasoning: a threshold engine personalises interpretations based on patient age, sex and BMI.
- AI assistant: built as a Retrieval Augmented Generation pipeline using ChromaDB and sentence transformers, with a knowledge base covering all 71 conditions to give grounded answers to clinical questions.
- Frontend and deployment: the interface was developed in React 19 with TypeScript, using uPlot for waveform rendering, and the full system was containerised with Docker and Docker Compose.
Document Type
Restricted Access
Submission Type
BSCS Final Year Project
Recommended Citation
Faisal, R., Hussain, U., & Saqlain, S. (2026). Cardiac Digital Shadow. Retrieved from https://ir.iba.edu.pk/fyp-bscs/66
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-No Derivative Works 4.0 International License.
COinS
