How aura-healthcare/hrv-analysis works
Project Type and Purpose
• It is a pure Python library (not a web service or microservice) that provides:
• Preprocessing of RR-intervals (outlier/ectopic-beat filtering)
• Feature extraction (time, geometrical, frequency, nonlinear)
• Plotting utilities (PSD, Poincaré, etc.)
• It is published on PyPI, has automated testing/docs pipelines, and uses Sphinx for documentation.
File Structure
• Top-level code:
• hrvanalysis/ : core Python package (extract_features.py, preprocessing.py, plot.py)
• tests/ : unit tests validating each module
• figures/ : input images for docs
• pyproject.toml : build/config file
• Documentation:
• docs/ : generated Sphinx HTML output (GitHub Pages)
• sphinx-docs/ : source reST/Markdown for building docs
• CI & Publishing:
• .github/workflows/ :
– ci.yml → run tests, coverage, build & deploy docs
– publish.yml → build & publish to PyPI
Extract Architectural Insights from README
• Core “pip install hrv-analysis” workflow
• Dependencies on SciPy, NumPy, AstroPy, Nolds, Future
• Four feature domains and several plotting methods
• A reference “architecture.png” shows three blocks: preprocess → features → plots
Main Components & Their Interactions
a. User / Client
• Imports hrvanalysis functions in their Python code or REPL
b. hrvanalysis Python Package
– Preprocessing Module:
• remove_outliers, remove_ectopic_beats, interpolate_nan_values
– Feature Extraction Module:
• get_time_domain_features, get_geometrical_features, get_frequency_domain_features, get_sampen, etc.
– Plotting Module:
• plot_timeseries, plot_distrib, plot_psd, plot_poincare
c. External Dependencies
• NumPy, SciPy, AstroPy, Nolds, Future (runtime libraries)
d. Testing Suite
• tests/ → invoked by CI to validate each module’s behavior
e. Documentation Generator
• Sphinx source (sphinx-docs/) → HTML (docs/) → published to GitHub Pages
f. CI/CD Pipelines
– GitHub Actions:
• CI pipeline: checkout → install deps → run tests → coverage → build docs → deploy docs
• Publish pipeline: on tag → build package → upload to PyPI
Architectural Patterns & Design Principles
• Modular Separation of Concerns:
• Preprocessing, Feature Extraction, Plotting are independent subpackages
• Layered Data Flow:
1) Raw RR intervals → 2) Cleaned NN intervals → 3) Feature arrays/dicts → 4) Visualizations
• Automated Documentation + Testing:
• CI enforces quality and auto-publishes both docs and code