How akash-selvaraj/ecg-based-cardiac-arrhythmia-prediction works
Project type and purpose
• This is a full-stack web application combining a Next.js-based React frontend with a Python microservice backend for ECG (electrocardiogram) arrhythmia prediction using a pre-trained ResNet50 model.
• The frontend handles UI, user input (ECG data or images), and presentation of health tips and prediction results. The backend (ecg-backend/app.py) exposes a REST API, loads the ResNet model, and returns arrhythmia classifications.
File structure
• Top-level files: Next.js configuration (next.config.ts, tsconfig.json), Tailwind CSS config, package.json, public assets.
• /public/images: static images served by Next.js.
• /src/app: Next.js App Router directory (Components subfolder, layout.tsx, page.tsx). Components include HealthTips.tsx and PredictionResult.tsx.
• /ecg-backend: a standalone Python service with app.py (likely Flask or FastAPI), requirements.txt, a Jupyter notebook for model training, and the trained_model folder containing resnet50_model2.keras.
README
• Confirms that the frontend is a standard Next.js app (bootstrapped with create-next-app).
• No mention of the ECG backend; infer that you need to document it yourself as an external microservice.
Main components & relationships
a. Frontend (Next.js + React + Tailwind CSS)
b. Backend microservice (Python + Flask/FastAPI)
c. ML Model (ResNet50 .keras file loaded by the backend)
d. Browser / Client
e. Potential deployment hosts (e.g., Vercel for frontend, AWS/GCP/Docker for backend)
Interactions:
• User (browser) → Next.js UI: uploads ECG data / requests prediction.
• Next.js → Python backend: HTTP POST/GET to /predict endpoint.
• Python backend → ResNet model: run inference, return JSON classification.
• Next.js UI ← receives JSON → renders PredictionResult component.
• HealthTips component reads static data or optional external health-tips service.
Architectural patterns & design principles
• Microservices: clear separation of concerns between UI (JavaScript/TypeScript) and compute-heavy ML tasks (Python).
• API-driven design: REST or RPC between front and back.
• Componentized UI: React components under src/app/Components.
• Model serving pattern: backend loads model once on startup and processes each request.
• Static vs. dynamic: public/ folder and Next.js static optimization vs. dynamic backend inference.
Essential details to capture
• Clear separation between UI, API, and model inference tiers.
• The fact that the model is loaded from a local file and served in-process.