This guide walks you through setting up ECG Axis Lab for development or local deployment.
Before starting, ensure you have:
-
Python 3.11 or later with Miniconda
- Download: https://docs.conda.io/en/latest/miniconda.html
- Check:
python --version
-
Node.js 18+ and npm
- Download: https://nodejs.org/
- Check:
node --versionandnpm --version
-
Git
- Download: https://git-scm.com/
- Check:
git --version
git clone https://github.com/herobrine15432/ecg-axis-lab.git
cd ecg-axis-labNote: this repository is highly experimental and may receive infrequent updates.
# Navigate to backend directory
cd apps/api
# Create conda environment from environment.yml
conda env create -f environment.yml
# Activate environment
conda activate ecg-axis-lab
# Verify installation
python -c "import fastapi; print(f'FastAPI {fastapi.__version__} installed')"# Navigate to frontend directory (from repo root)
cd apps/web
# Install dependencies via npm
npm install
# Verify installation
npm list react react-dom # Should show versionscd apps/api
conda activate ecg-axis-lab
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000You should see:
Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Access points:
- API Health: http://localhost:8000/health
- Interactive Docs: http://localhost:8000/docs
- API Root: http://localhost:8000/
cd apps/web
npm run devYou should see:
VITE v5.0.8 ready in XXX ms
Local: http://localhost:5173/
Visit: http://localhost:5173/
You should see the ECG Axis Lab landing page.
- Backend API running on port 8000
- Frontend running on port 5173
- Browser loads http://localhost:5173 without errors
- "Enter App" button works
- Demo selector shows demo options
- Clicking a demo loads data
- Browser DevTools console shows no errors
cd apps/api
conda activate ecg-axis-lab
pytest tests/ -vExpected output:
tests/test_geometry.py::test_project_vector_to_lead PASSED
tests/test_geometry.py::test_estimate_frontal_vector PASSED
...
cd apps/api
pytest tests/ --cov=app --cov-report=html
# Coverage report in htmlcov/index.htmlSolution:
- Install Miniconda: https://docs.conda.io/en/latest/miniconda.html
- Or use pip with venv:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
Solution:
conda activate ecg-axis-lab
conda install -c conda-forge fastapi uvicornSolution:
cd apps/web
npm install --legacy-peer-depsSolution:
# Use a different port
uvicorn app.main:app --reload --port 8001
# Update frontend proxy in vite.config.tsSolution:
- Ensure backend is running on port 8000
- Check CORS settings in
apps/api/app/core/config.py - Verify frontend proxy in
apps/web/vite.config.ts
Solution:
Add your frontend URL to CORS_ORIGINS in backend config:
# apps/api/app/core/config.py
CORS_ORIGINS = ["http://localhost:5173", "http://localhost:3000"]Solution:
- Ensure backend
/api/demosendpoint is responding - Check browser DevTools Network tab
- Verify API client URL in frontend
VITE_API_URL=http://localhost:8000DEBUG=True
API_TITLE=ECG Axis Lab API
API_VERSION=0.1.0
CORS_ORIGINS=["http://localhost:5173"]-
Read the Documentation:
-
Explore the Code:
- Development Guide
- Backend:
apps/api/app/ - Frontend:
apps/web/src/
-
Try Some Demos:
- Load demo datasets from the UI
- Adjust simulation parameters
- Explore the geometry visualization
-
Try Your Own Data:
- Prepare CSV or JSON file with ECG data
- Upload via the UI (future feature)
- Or manually call API endpoints via Swagger docs
For production use, see deployment guides in docs/ (future).
- Bug reports: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: See
docs/directory
MIT License - see LICENSE file.