CODE-test / README.md
dronefreak's picture
Claude Opus 5.5
Card: correct the padding note
ae6a745 verified
|
Raw History Blame
7.03 kB
metadata
language:
  - en
license: cc-by-4.0
size_categories:
  - n<1K
task_categories:
  - other
pretty_name: CODE-test
tags:
  - ecg
  - electrocardiogram
  - biosignals
  - time-series
  - medical
  - ecg-classification
configs:
  - config_name: default
    data_files:
      - split: test
        path: data/train-*

CODE-test: An Annotated 12-Lead ECG Dataset

Task Dataset Format Exams Leads License

Unofficial mirror of CODE-test: 827 12-lead ECGs with labels from cardiologists, residents, medical students and a neural network, in a viewer-ready Parquet layout with exact signal values.

Dataset Description

Disclaimer

This repository is not an official release of CODE-test.

CODE-test was created by Antônio H. Ribeiro, Manoel Horta Ribeiro, Gabriela M. M. Paixão, Derick M. Oliveira, Paulo R. Gomes, Jéssica A. Canazart, Milton P. S. Ferreira, Carl R. Andersson, Peter W. Macfarlane, Wagner Meira Jr., Thomas B. Schön and Antonio Luiz P. Ribeiro. 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. 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 3765780 (v1.0.3), with the 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-test is the test set of Automatic diagnosis of the 12-lead ECG using a deep neural network (Nature Communications, 2020). Each of the 827 exams comes from a different patient and is 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).


Changes from the Official Release

  • Packed into Parquet, one row per exam, as a test split, matching how the authors use this set.
  • Joined the tracings, patient attributes and all annotation files into one table.
  • Added lead_names, active_start, active_end, is_empty and a rendered 12-lead preview.
  • The official package is included unchanged at original/data.zip.
  • No signal values or labels were changed.

Dataset Structure

Column Content
exam_index row position in the official files, 0 to 826
age, sex from attributes.csv
lead_names verified order of the 12 leads in signal (see below)
gold_standard consensus labels: two cardiologists, with a senior specialist resolving disagreements
cardiologist1, cardiologist2 each cardiologist's labels
cardiology_residents, emergency_residents, medical_students labels from each group
dnn_prediction the paper's neural network output, thresholded to 0 or 1
signal float64, shape (12, 4096) as (lead, sample), 400 Hz
active_start, active_end first and last sample where any lead is non-zero
is_empty true if every sample is zero (no exam here)
preview PNG plot of the recorded portion

Read before using the signals

  • The documented lead order is wrong for three leads. The official README lists DI, DII, DIII, AVR, AVL, AVF, V1..V6, but the stored order is DI, DII, DIII, AVL, AVF, AVR, V1..V6. We tested each exam against the standard limb-lead equations: 773 of 827 match this order on all three leads, the remaining 54 are too noisy to classify on at least one lead, and none match the documented order. The signal is unchanged, so use lead_names. The sibling datasets SaMi-Trop and CODE-15% do follow the documented order, so reorder these leads before combining them.
  • 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, 253 of 827 exams are non-zero across all 4096 samples, so read active_start and active_end instead of assuming a duration.
  • The amplitude unit is ambiguous. The official README says the scale is 1e-4 V and also says to multiply by 1000 to obtain volts, and these two statements disagree. Values are kept as published and no unit is asserted here.
  • datasets NumPy formatting rounds this column. with_format("numpy") returns float32. For exact values, use the default format as shown below.

Usage

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

ds = load_dataset("dronefreak/CODE-test", split="test")
row = ds[0]

signal = np.asarray(row["signal"], dtype=np.float64)   # (12, 4096)
recorded = signal[:, row["active_start"]:row["active_end"] + 1]
avr = signal[row["lead_names"].index("AVR")]
labels = row["gold_standard"]                          # {"1dAVb": 0, "RBBB": 0, ...}

Dataset Sources

Citation

@article{ribeiro_automatic_2020,
  title   = {Automatic Diagnosis of the 12-Lead {{ECG}} Using a Deep Neural Network},
  author  = {Ribeiro, Ant{\^o}nio H. and Ribeiro, Manoel Horta and Paix{\~a}o, Gabriela M. M. and Oliveira, Derick M. and Gomes, Paulo R. and Canazart, J{\'e}ssica A. and Ferreira, Milton P. S. and Andersson, Carl R. and Macfarlane, Peter W. and Meira Jr., Wagner and Sch{\"o}n, Thomas B. and Ribeiro, Antonio Luiz P.},
  year    = {2020},
  volume  = {11},
  number  = {1},
  pages   = {1760},
  doi     = {10.1038/s41467-020-15432-4},
  journal = {Nature Communications}
}

License

CODE-test 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 paper.