Pipelines¶
The three high-level entry points behind the ecgbench CLI. Each is a plain
keyword-argument function, so everything the CLI does is importable:
See the CLI page for the equivalent commands and their flags.
run_splits¶
splits
¶
Full pipeline subcommand: validate + split + export + Croissant.
run_splits
¶
run_splits(dataset: str, data_path: Path | str | None = None, output_dir: Path | str | None = None, sampling_rate: int | None = None, n_folds: int | None = None, max_workers: int = 4, skip_validation: bool = False, skip_croissant: bool = False) -> dict
Run the full pipeline: validate + split + export + Croissant.
n_folds defaults to the dataset's own config.n_folds, which is 10 for
every dataset but szdb — see that field for why a small release cannot
take ten. Passing an explicit value overrides it.
Returns the stats dict produced by export_splits plus output_dir,
dataset and dataset_name keys for convenience.
Source code in ecgbench/cli/splits.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
run_croissant¶
croissant
¶
Standalone Croissant metadata generation subcommand.
run_croissant
¶
run_croissant(dataset: str, splits_dir: Path | str, output: Path | str | None = None, version: str = 'clean', validate: bool = False) -> Path
Generate (and optionally validate) Croissant 1.1 JSON-LD for a dataset.
Returns the path to the saved croissant.json file.
Source code in ecgbench/cli/croissant.py
run_upload¶
run_upload refuses before any network call for a dataset whose config sets
publish_fold_csvs: False.
upload
¶
Upload fold CSVs and metadata to HuggingFace Hub.
run_upload
¶
run_upload(data_dir: Path | str, datasets: list[str], hf_repo_id: str = 'vlbthambawita/ECGBench', dry_run: bool = False, token: str | None = None) -> dict[str, int]
Upload per-dataset fold CSVs and metadata to HuggingFace Hub.
Returns a mapping of dataset slug -> number of files uploaded (or that would
have been uploaded, for dry_run=True).
Source code in ecgbench/cli/upload.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |