Skip to content

Tasks

Introduction

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

Available Tasks

Signal Denoise

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

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

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

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)

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.


Task Factory

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
1
2
3
4
5
6
7
8
import heartkit as hk

# Grab a rhythm task
task = hk.TaskFactory.get("rhythm")

task.train(hk.HKTrainParams(
    ...
))

Recap

Signal Denoising

Remove noise from physiological signals.
Refer to Denoise Task for more details.

Signal Segmentation

Delineate physiological signal into constituent parts.
Refer to Segmentation Task for more details.

Rhythm Classification

Identify rhythm-level arrhythmias such as AFIB and AFL.
Refer to Rhythm Task for more details.

Beat Classification

Identify premature and escape beats.
Refer to Beat Task for more details.

<!-- === "Diagnostic"

### Diagnostic Classification

Assign diagnostic labels to an ECG signal. <br>
Refer to [Diagnostic Task](./diagnostic.md) for more details. -->