CODE-15 / README.md
dronefreak's picture
Add CODE-15% part 0 (#1)
6c4408c
|
Raw History Blame Contribute Delete
8.07 kB
metadata
language:
  - en
license: cc-by-4.0
size_categories:
  - 100K<n<1M
task_categories:
  - other
pretty_name: CODE-15%
tags:
  - ecg
  - electrocardiogram
  - biosignals
  - time-series
  - medical
  - ecg-classification
configs:
  - config_name: default
    default: true
    data_files:
      - split: train
        path: data/train-*
  - config_name: samples
    data_files:
      - split: train
        path: samples/train-*

CODE-15%: A Large-Scale Annotated 12-Lead ECG Dataset

Task Dataset Format Exams Patients Leads License

Unofficial mirror of CODE-15%: 345,779 12-lead ECG exams from 233,770 patients, with abnormality labels and mortality follow-up, in a streamable Parquet layout with exact signal values.

Dataset Description

Disclaimer

This repository is not an official release of CODE-15%.

The dataset was published by Antônio H. Ribeiro, Gabriela M. M. Paixão, Emilly M. Lima, Manoel Horta Ribeiro, Marcelo M. Pinto Filho, Paulo R. Gomes, Derick M. Oliveira, Wagner Meira Jr, Thomas B. Schön and Antonio Luiz P. Ribeiro. The data was collected by the Telehealth Network of Minas Gerais. This repository does not claim ownership of the data. If you are an author or rights holder and want this repository changed or removed, please open a discussion and it will be addressed promptly.

These are records from real patients and include mortality follow-up. Do not attempt to identify anyone in them. This dataset is for research and is not a medical device or a basis for clinical decisions.

Source and verification: built from Zenodo record 4916206 (v1.0.0), with every download checked against its MD5. Every stored signal was read back from Parquet and compared with the source HDF5 for exact equality.


Dataset Overview

CODE-15% is a stratified sample of 15% of the patients in the CODE dataset, collected by the Telehealth Network of Minas Gerais, Brazil, between 2010 and 2016. Exams are labeled for six abnormalities: 1st degree AV block (1dAVb), right bundle branch block (RBBB), left bundle branch block (LBBB), sinus bradycardia (SB), atrial fibrillation (AF) and sinus tachycardia (ST).

Label Positive exams
normal_ecg 134,657
RBBB 9,672
ST 7,584
AF 7,033
LBBB 6,026
1dAVb 5,716
SB 5,605

Changes from the Official Release

  • Packed the 18 HDF5 parts into 18 Parquet shards, one row per exam, joined to exams.csv by exam_id.
  • Removed the one trailing placeholder row in each HDF5 part (exam id 0, all samples zero). It is not an exam and has no row in exams.csv.
  • Added source_file, active_start, active_end and is_empty.
  • Added a small samples config of 196 exams with a rendered 12-lead preview.
  • The official exams.csv is included unchanged in original/. The official HDF5 zips are not duplicated here and remain on Zenodo.
  • No signal values or labels were changed.

Dataset Structure

Column Content
exam_id, patient_id official exam and patient ids
age, is_male patient age at the exam, and sex
nn_predicted_age age predicted by the authors' neural network
1dAVb, RBBB, LBBB, SB, AF, ST abnormality labels
normal_ecg true if the automatic annotation system reports a normal ECG
death true if the patient died during follow-up, only on the patient's first exam
timey time to death, or follow-up time, only on the patient's first exam
source_file official HDF5 part holding this exam
signal float32, shape (12, 4096) as (lead, sample), 400 Hz
active_start, active_end first and last sample where any lead is non-zero, -1 if empty
is_empty true if every sample is zero
preview PNG plot of the recorded portion (samples config only)

Lead order: DI, DII, DIII, AVR, AVL, AVF, V1, V2, V3, V4, V5, V6. There is one train split because the authors define no official split.

Read before using the signals

  • Split by patient_id, not by row. Many patients have several exams, so a row-level split leaks patients between train and test.
  • 670 exams are entirely zero. They are kept and flagged with is_empty, so filter them before training.
  • Many signals are zero-padded, but not all. The official description says 7 s and 10 s recordings are centered in 4096 samples with zeros. In this file, 130,763 exams have a non-zero value at both the first and last sample, so read active_start and active_end instead of assuming a duration.
  • death and timey are mostly null by design. They are filled on 233,647 rows and null on the other 112,132. 8,341 rows record a death.
  • Lead order was checked on every exam. Against the standard limb-lead equations, 338,778 exams match the documented order within a 10% residual and none match the CODE-test order. The other 7,001 are the 670 empty exams and 6,331 that do not meet the tolerance, so they are unclassified rather than proven.
  • CODE-test uses a different order. The sibling dataset CODE-test stores AVL, AVF, AVR in these positions, so reorder before combining them.
  • The amplitude unit is not stated in this record. Values are kept as published.

Usage

The full dataset is about 43 GB, so streaming is the easiest way to start.

# pip install datasets pillow numpy
import numpy as np
from datasets import load_dataset

ds = load_dataset("dronefreak/CODE-15", split="train", streaming=True)
row = next(r for r in ds if not r["is_empty"])

signal = np.asarray(row["signal"], dtype=np.float32)   # (12, 4096)
recorded = signal[:, row["active_start"]:row["active_end"] + 1]

# A small subset with rendered previews
samples = load_dataset("dronefreak/CODE-15", "samples", split="train")

Dataset Sources

Citation

Please cite both papers and the dataset (DOI 10.5281/zenodo.4916206):

Ribeiro, A. H., Ribeiro, M. H., Paixão, G. M. M., Oliveira, D. M., Gomes, P. R., Canazart, J. A., Ferreira, M. P. S., et al. Automatic diagnosis of the 12-lead ECG using a deep neural network. Nature Communications, 11(1):1760, 2020. doi: 10.1038/s41467-020-15432-4

Lima, E. M., Ribeiro, A. H., Paixão, G. M. M., Ribeiro, M. H., Pinto Filho, M. M., Gomes, P. R., Oliveira, D. M., Sabino, E. C., Duncan, B. B., Giatti, L., Barreto, S. M., Meira Jr, W., Schön, T. B., Ribeiro, A. L. P. Deep neural network estimated electrocardiographic-age as a mortality predictor. medRxiv, 2021. doi: 10.1101/2021.02.19.21251232


License

CODE-15% is released by its authors under Creative Commons Attribution 4.0 International (CC BY 4.0). This mirror reformats the data as described above. Please credit the authors and cite the papers.