HeartMAP REST API
HeartMAP provides a REST API built with FastAPI for integrating cardiac analysis into web applications and services.Installation
Install with API dependencies:Starting the API Server
Quick Start
- Base URL:
http://localhost:8000 - API Docs:
http://localhost:8000/docs(Swagger UI) - ReDoc:
http://localhost:8000/redoc
Custom Configuration
API Endpoints
Health Check
GET/health
Check if the API is running:
Root Endpoint
GET/
Get API information:
Analyze Data
POST/analyze
Perform single-cell analysis on uploaded data.
Request:
- Method: POST
- Content-Type: multipart/form-data
- Parameters:
file: Single-cell data file (.h5ad)analysis_type: Type of analysis (optional, default: “comprehensive”)config_overrides: JSON config overrides (optional)
List Available Models
GET/models
Get list of available analysis types:
Get Configuration
GET/config
Retrieve current server configuration:
Update Configuration
POST/config
Update server configuration:
Request/Response Models
AnalysisRequest
AnalysisResponse
Complete Examples
Example 1: Basic Analysis
Example 2: With Configuration Overrides
Example 3: Batch Processing
Example 4: Web Application Integration
Production Deployment
Using Uvicorn (Recommended)
Using Gunicorn
Docker Deployment
CreateDockerfile:
Authentication
For production, add authentication:Error Handling
API returns standard HTTP error codes:- 200: Success
- 400: Bad Request (invalid input)
- 401: Unauthorized
- 500: Internal Server Error
Next Steps
CLI Usage
Command-line interface
API Reference
Full API documentation
Configuration
Config options