Skip to content
heartKIT
Tasks
HELIA

Tasks

heartKIT provides several built-in heart-monitoring tasks. Each task is designed to address a unique aspect such as ECG denoising, segmentation, and rhythm/beat classification. The tasks are designed to be modular and can be used independently or in combination to address specific use cases. In addition to the built-in tasks, custom tasks can be created by extending the HKTask base class and registering it with the task factory.

Task Diagram

Signal denoise is the process of removing noise from a physiological signal such as ECG. This task is useful for improving the quality of the signal and for further downstream tasks such as segmentation in which noise can interfere with the delineation of individual waves.

Signal segmentation is the process of delineating a signal into its constituent parts. In the context of ECG, segmentation refers to delineating the ECG signal into individual waves (e.g. P-wave, QRS, T-wave). This task is useful for extracting features (e.g. HRV) from the ECG signal and for further analysis such as rhythm classification.

Rhythm classification is the process of identifying abnormal heart rhythms, also known as arrhythmias, such as atrial fibrillation (AFIB) and atrial flutter (AFL) from ECG signals. Cardiovascular diseases such as AFIB are a leading cause of morbidity and mortality worldwide. Being able to remotely identify heart arrhtyhmias is important for early detection and intervention.

Beat classification is the process of identifying and classifying individual heart beats such as normal, premature, and escape beats from ECG signals. By identifying abnormal heart beats, it is possible to detect and monitor various heart conditions.

Bring-Your-Own-Task (BYOT) is a feature that allows users to create custom tasks by extending the HKTask base class and registering it with the TaskFactory. This feature is useful for addressing specific use cases that are not covered by the built-in tasks.


The task factory, TaskFactory, provides a convenient way to access the built-in tasks. The factory is a thread-safe singleton class that provides a single point of access to the tasks via the tasks’ slug names. The benefit of using the factory is it allows registering custom tasks that can then be used just like built-in tasks.

The dataset factory provides the following methods:

  • hk.TaskFactory.register: Register a custom task
  • hk.TaskFactory.unregister: Unregister a custom task
  • hk.TaskFactory.has: Check if a task is registered
  • hk.TaskFactory.get: Get a task
  • hk.TaskFactory.list: List all available tasks
Python example
import heartkit as hk
# Grab a rhythm task
task = hk.TaskFactory.get("rhythm")
task.train(hk.HKTrainParams(
...
))

TaskPurpose
Signal denoisingRemove noise from physiological signals.
Signal segmentationDelineate physiological signals into constituent parts.
Rhythm classificationIdentify rhythm-level arrhythmias such as AFIB and AFL.
Beat classificationIdentify premature and escape beats.
Bring your own taskCreate and register a custom task.