# Download Datasets

## Introduction

The `download` command is used to download specified datasets. Please refer to [Datasets](https://ambiqai.github.io/heartkit/datasets/) for details on the available datasets. Additional datasets can be added by creating a new dataset class and registering it with __heartKIT__ dataset factory, [DatasetFactory](https://ambiqai.github.io/heartkit/datasets/#dataset-factory).

## Usage

### CLI

Using the CLI, the `download` command can be used to download specified datasets in the configuration file or directly in the command line.

```bash title="Terminal"
heartkit -m download -c '{"datasets": [{"name": "ptbxl", "params": {"path": "./datasets/ptbxl"}}]}'
```

### Python

In code, the `download` method of a dataset can be used to download the dataset.

```py title="Python example" linenums="1"
import heartkit as hk

ds = hk.DatasetFactory.get("ptbxl")(path="./datasets/ptbxl")
ds.download()

```

Similarly, to download multiple datasets, the `download` method of a task can be used.

```py title="Python example" linenums="1"
import heartkit as hk

task = hk.TaskFactory.get("rhythm")

params = hk.HKTaskParams(
    datasets=[hk.NamedParams(
        name="ptbxl",
        parameters={"path": "./datasets/ptbxl"}
    ), hk.NamedParams(
        name="lsad",
        parameters={"path": "./datasets/lsad"}
    )],
    force_download=False
)

task.download(params)

```

## Arguments

Please refer to [HKTaskParams](https://ambiqai.github.io/heartkit/modes/configuration/#hktaskparams) for the available configuration options for the `download` command.
