ECGDataKit
A Python library for parsing, processing, and visualizing multi-format ECG files.
Developed at UMMISCO / IRD by Ahmad Fall.
ecgdatakit.ummisco.fr: Full documentation, API reference, and getting started guide.
Features
Parsing - 13 ECG formats, one unified data model
| Format | File Types | Detection |
|---|---|---|
| HL7 aECG | .xml |
<AnnotatedECG in header |
| Philips Sierra XML | .xml |
<restingecgdata in header |
| ISHNE Holter | .ecg, .hol |
ISHNE1.0 or ANN 1.0 magic bytes |
| Mortara EL250 | .xml |
<ECG + <CHANNEL in header |
| EDF/EDF+ | .edf |
"0 " at offset 0 |
| SCP-ECG | .scp |
Valid Section 0 pointer table at offset 6 |
| GE MUSE XML | .xml |
<RestingECG> in header |
| DICOM Waveform | .dcm |
DICM at offset 128 |
| WFDB (PhysioNet) | .hea + .dat |
.hea extension + valid header |
| MFER | .mwf, .mfer |
Valid MFER tag + BER length |
| Mindray BeneHeart R12 | .xml |
<BeneHeartR12> or <MindrayECG> |
| GE MAC 2000 | .xml |
<MAC2000> or <GE_MAC> |
| EDAN ARC Holter | patient.hea + ecgraw.dat |
filename patient.hea + sibling ecgraw.dat |
Signal Processing
| Category | Capabilities |
|---|---|
| Filtering | Butterworth (lowpass, highpass, bandpass, notch), baseline removal, diagnostic & monitoring presets |
| Peak Detection | Pan-Tompkins, Shannon energy |
| Heart Rate | Average HR, RR intervals, instantaneous beat-by-beat HR |
| HRV Analysis | Time-domain (SDNN, RMSSD, pNN50), frequency-domain (VLF/LF/HF), Poincaré (SD1/SD2) |
| Spectral | FFT, Welch PSD, beat segmentation, ensemble averaging |
| Quality | Signal quality index (SQI), SNR estimation |
| Leads | Derive III, aVR/aVL/aVF, full 12-lead assembly |
| Cleaning | Built-in, BioSPPy, NeuroKit2, combined pipelines |
| Deep Denoising | DeepFADE, a DenseNet encoder-decoder denoising autoencoder trained on a large private ECG database (weights bundled) |
Visualization
| Type | Plots |
|---|---|
| ECG Waveforms | Single lead, multi-lead, standard 12-lead grid with paper background |
| Annotations | R-peak markers, RR intervals, heart rate overlay |
| Beat Analysis | Segmented beats, ensemble-averaged beat with SD shading |
| Spectral | Power spectrum (PSD/FFT), spectrogram |
| HRV | Tachogram, Poincaré plot, frequency bands, metrics dashboard |
| Reports | Signal quality per lead, full ECG report with patient info |
| Interactive | All plots available as interactive Plotly versions (zoom, pan, hover) |
Installation
# Core (parsing only)
pip install ecgdatakit
# With signal processing
pip install "ecgdatakit[processing]"
# With static plots (matplotlib)
pip install "ecgdatakit[plotting]"
# With interactive plots (plotly)
pip install "ecgdatakit[plotting-interactive]"
# With ECG cleaning backends
pip install "ecgdatakit[cleaning]"
# With DeepFADE denoising autoencoder (requires torch)
pip install "ecgdatakit[denoising]"
# Everything (except torch, install separately if needed)
pip install "ecgdatakit[all]"
Optional extras for specific formats:
pip install "ecgdatakit[holter]" # ISHNE Holter CRC validation
pip install "ecgdatakit[dicom]" # DICOM waveform support
Quick Start
Parse an ECG file
from ecgdatakit import FileParser
record = FileParser().parse("path/to/ecg_file.xml")
print(record.source_format) # "sierra_xml"
print(record.patient.first_name) # "John"
print(record.patient.age) # 55
print(record.recording.acquisition.signal.sampling_rate) # 500
print(record.measurements.heart_rate) # 75
print(record.recording.device.manufacturer) # "Philips"
print(record.recording.acquisition.signal.data_encoding) # "base64_int16le"
print(len(record.leads)) # 12
json_str = record.to_json()
Visualize
from ecgdatakit.plotting import plot_12lead, plot_lead, iplot_12lead
plot_12lead(record) # static 12-lead grid (auto-displays)
plot_lead(record.leads[0]) # single lead
fig = plot_12lead(record, show=False) # get the figure without displaying
fig.savefig("ecg_12lead.png", dpi=150)
iplot_12lead(record).show() # interactive (plotly), opens in browser
Batch processing
from pathlib import Path
from ecgdatakit import parse_batch
files = list(Path("ecg_data/").glob("*.xml"))
for record in parse_batch(files, max_workers=4):
print(record.patient.patient_id, record.measurements.heart_rate)
Data Model
Every parser returns the same ECGRecord, so downstream code stays identical no matter which format was read. Leads hold raw ADC counts by default. Call record.to_physical() to scale them to voltage, then record.convert_units("mV") to switch between uV, mV, or V. Export the whole record with record.to_dict() or record.to_json().
ECGRecord
patient PatientInfo ID, name, birth date, sex, age, weight, height, medications, history
recording RecordingInfo date, end date, duration, technician, physician, room, location
├─ device DeviceInfo manufacturer, model, serial number, software version, institution
└─ acquisition AcquisitionSetup
├─ signal SignalCharacteristics sampling rate, resolution, bits/sample, encoding, compression, channels
└─ filters FilterSettings highpass, lowpass, notch frequencies
leads list[Lead] label, samples (float64), sampling rate, resolution, units, is_raw
measurements GlobalMeasurements HR, PR, QRS, QT, QTc (Bazett/Fridericia), P/QRS/T axes, RR interval
interpretation Interpretation statements, severity, source, interpreter
median_beats list[Lead] median/template beats, when available
annotations dict[str, str] additional key-value annotations
source_format str parser identifier (e.g. "sierra_xml")
raw_metadata dict original format-specific metadata
Author
License
Apache 2.0. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ecgdatakit-1.0.2.tar.gz.
File metadata
- Download URL: ecgdatakit-1.0.2.tar.gz
- Upload date:
- Size: 48.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8e6ebe98ca72b20ad24805973de267521abf0bf438cf6f722ce9168e49550f5
|
|
| MD5 |
c8fa354fa768c79ad856a7dd79aa0858
|
|
| BLAKE2b-256 |
c797562eeff33130a397deaca1a2be904e66b3f9fd8a1200512b9b8468909152
|
Provenance
The following attestation bundles were made for ecgdatakit-1.0.2.tar.gz:
Publisher:
publish.yml on UMMISCO/ECGDataKit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ecgdatakit-1.0.2.tar.gz -
Subject digest:
b8e6ebe98ca72b20ad24805973de267521abf0bf438cf6f722ce9168e49550f5 - Sigstore transparency entry: 2090324977
- Sigstore integration time:
-
Permalink:
UMMISCO/ECGDataKit@f0002eda151db7f99f712f8851d573856e6bc1db -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/UMMISCO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0002eda151db7f99f712f8851d573856e6bc1db -
Trigger Event:
release
-
Statement type:
File details
Details for the file ecgdatakit-1.0.2-py3-none-any.whl.
File metadata
- Download URL: ecgdatakit-1.0.2-py3-none-any.whl
- Upload date:
- Size: 48.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f356267081305f39f807cc1e7e9313724502288a2e0785b54e180f95fd2006
|
|
| MD5 |
a1b87bc9050fd137d89b55f4d39a4b04
|
|
| BLAKE2b-256 |
e97eb3ffe83e2c0f8e5539b305fab27bb936a10fe44dd3a77efece383a765db8
|
Provenance
The following attestation bundles were made for ecgdatakit-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on UMMISCO/ECGDataKit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ecgdatakit-1.0.2-py3-none-any.whl -
Subject digest:
47f356267081305f39f807cc1e7e9313724502288a2e0785b54e180f95fd2006 - Sigstore transparency entry: 2090325409
- Sigstore integration time:
-
Permalink:
UMMISCO/ECGDataKit@f0002eda151db7f99f712f8851d573856e6bc1db -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/UMMISCO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0002eda151db7f99f712f8851d573856e6bc1db -
Trigger Event:
release
-
Statement type: