Pulse AI is a full-stack cardiac MRI analysis and doctor consultation platform. It combines a React patient/doctor/admin dashboard with a Flask MRI analysis service powered by a fine-tuned VGG16 model.
Live project: https://pulseai.abdulmoiz.net/
Pulse AI helps patients upload cardiac MRI reports, receive AI-assisted disease risk analysis, send reports to verified doctors, chat with doctors, receive prescriptions, download branded PDF reports, and review doctors after prescriptions. Doctors can review assigned cases, inspect report timelines, chat with patients, prescribe medicines, and track patient reviews.
The research notebooks, extracted metrics, figures, and supporting experiments are maintained in the Pulse AI notebook resources. The trained best VGG16 model is loaded by the Flask analysis API.
- Patient MRI upload and analysis
- AI-assisted cardiac MRI classification
- Risk level, confidence, diagnosis details, urgency, and patient guidance
- Patient dashboard with reports, cases, prescriptions, chats, and doctor reviews
- Doctor dashboard with assigned cases, case timelines, chat, prescriptions, and patient reviews
- Shared patient-doctor chat channel per patient/doctor pair
- Case timeline for repeated reports sent to the same doctor
- Prescription flow with report/case reference
- Doctor review flow after prescription
- Branded PDF report download with Pulse AI logo and website link
- Admin user and doctor verification workflows
- Supabase authentication, database, storage, and row-level security
- GetStream chat token/channel integration
- React 18
- TypeScript
- Vite
- Tailwind CSS
- shadcn/ui and Radix UI
- lucide-react icons
- Supabase client
- Stream Chat
- jsPDF
- Python
- Flask
- TensorFlow / Keras
- VGG16 fine-tuned model
- Pillow, NumPy, pydicom
- Supabase admin client
- Stream Chat server client
- Jupyter Notebook / Google Colab
- TensorFlow / Keras
- VGG16 transfer learning
- Matplotlib, Seaborn
- scikit-learn
- OpenCV
pulse-ai/
src/ React app source
components/ Shared UI, reports, chat, cases, patient components
hooks/ Auth, Stream chat, theme, toast hooks
integrations/supabase/ Supabase client and generated types
lib/ MRI reports, labels, permissions, doctor profiles
pages/ Patient, doctor, admin, auth, landing pages
services/mri_analysis/ Flask MRI analysis and Stream token API
supabase/migrations/ Database schema, RLS, consultation, review migrations
public/ Static frontend assets
Dataset/ Local dataset folder, ignored by Git
notebooks/ Local notebook/model folder, ignored by Git
cache/ Downloaded model cache, ignored by Git
Notebook resources are available in the companion notebook project:
Pulse Ai Notebooks/
Pulse-ai.ipynb
ai-based-heart-disease-detection-system-mri.ipynb
notebooks/active/
notebooks/archive/
notebooks/archive/figures/
notebooks/archive/scripts/
The trained best VGG16 model can be downloaded from Google Drive:
Recommended local model path:
notebooks/active/models/best_vgg_finetuned.keras
Model files are intentionally ignored by Git because trained .keras files can exceed GitHub file size limits. The backend can also download/cache the model when MRI_ANALYSIS_MODEL_PATH is set to a URL.
- Node.js 18 or newer
- npm
- Python 3.10 or newer
- Supabase project
- GetStream Chat app
- Trained VGG16
.kerasmodel or hosted model URL
Create a local .env file in pulse-ai/. Do not commit real keys.
VITE_SUPABASE_URL=
VITE_SUPABASE_PUBLISHABLE_KEY=
VITE_SUPABASE_PROJECT_ID=
VITE_STREAM_API_KEY=
STREAM_API_KEY=
STREAM_API_SECRET=
VITE_MRI_ANALYSIS_API_URL=http://127.0.0.1:5000
MRI_ANALYSIS_MODEL_PATH=notebooks/active/models/best_vgg_finetuned.keras
SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=Notes:
VITE_*variables are exposed to the frontend.SUPABASE_SERVICE_ROLE_KEYandSTREAM_API_SECRETare backend-only secrets.- In production, set
VITE_MRI_ANALYSIS_API_URLto the deployed Flask API URL.
Install frontend dependencies:
npm installInstall backend dependencies:
cd services/mri_analysis
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtOn macOS/Linux:
cd services/mri_analysis
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtStart the Flask MRI analysis API:
npm run analysis:apiOr run directly:
python services/mri_analysis/app.pyStart the frontend:
npm run devOpen the Vite URL shown in the terminal, usually:
http://localhost:5173
The Flask service exposes:
GET /health- service health and configuration statusPOST /analyze- MRI image analysisPOST /admin/create-user- admin user creation helperPOST /stream/token- GetStream user token endpointPOST /stream/create-channel- creates/updates consultation chat channels
Database schema and RLS policies are in:
supabase/migrations/
Important modules include:
- profiles and user roles
- MRI reports
- diagnosis records
- prescriptions
- doctor information
- consultation requests
- Stream channel IDs
- doctor reviews and rating aggregation
Apply migrations to the Supabase project before using the app in production.
npm run dev # Start frontend dev server
npm run build # Production build
npm run build:dev # Development-mode build
npm run preview # Preview built frontend
npm run lint # Run ESLint
npm run test # Run Vitest
npm run test:watch # Watch tests
npm run analysis:api # Start Flask MRI analysis APIThe companion notebook project contains the model training and evaluation work.
Repository contents from the notebook resources:
Pulse-ai.ipynb- main Pulse AI notebookai-based-heart-disease-detection-system-mri.ipynb- original MRI detection notebooknotebooks/active/- active notebooks, extracted text, and metricsnotebooks/archive/- archived backend notebooks, scripts, and generated figuresnotebooks/archive/figures/- confusion matrices, dataset distribution plots, training history charts, and sample outputsnotebooks/archive/scripts/- supporting Flask and Node.js scripts
Notebook setup:
python -m venv .venv
.venv\Scripts\activate
pip install tensorflow keras numpy pandas matplotlib seaborn scikit-learn opencv-python jupyter
jupyter notebookOpen Pulse-ai.ipynb or the notebooks inside notebooks/active/ and run the cells in order.
- Project Deployment: https://pulseai.abdulmoiz.net/
- GitHub Repository: https://github.com/Moiz-CodeByte/pulse-ai
- Notebook Repository: https://github.com/Moiz-CodeByte/pulse-ai-notebook
- Kaggle Notebook: AI Based Heart MRI Detection System - Pulse AI
- Google Colab Notebook: https://colab.research.google.com/drive/1mZ1CFhKMvCUXa0Qp2dUeGSBlb38P7rim
- CAD Dataset VGG16 Notebook for Testing: https://www.kaggle.com/code/moizkalid/cad-pulse-ai-vgg16
- CAD Dataset CNN Notebook for Testing: https://www.kaggle.com/code/moizkalid/cad-cnn-pulse-ai
- Best VGG16 Model: Google Drive download
- Deploy the React app as a static Vite build.
- Deploy
services/mri_analysis/app.pyas the Python API. - Configure production CORS and
VITE_MRI_ANALYSIS_API_URLto point to the API. - Apply all Supabase migrations.
- Configure Supabase storage bucket
mri-images. - Configure Stream API key/secret for chat.
- Use a hosted model URL or mount the
.kerasmodel file on the backend.
This project is licensed under the MIT License. See the LICENSE file if present.
For questions or support, contact [email protected].