CODE II dataset - Abreu, Petrus; Paixão, Gabriela M.; Li, Jiawei; Gomes, Paulo R.; Macfarlane, Peter W.; Oliveira, Ana C. S.; Carvalho, Vinícius T.; Schön, Thomas B.; Ribeiro, Antonio Luiz P.; H. Ribeiro, Antonio (Uppsala University, 2026)
This project contains the ECG waveform files (WFDB format) of the CODE-II dataset, a large-scale collection of 2,735,196 12-lead ECG exams from 2,093,748 unique patients, collected by the Telehealth Network of Minas Gerais (TNMG), Brazil, between January 2019 and December 2022. Data collection was approved under ethics protocol CAAE 85892325.1.0000.5149, with a waiver of the informed consent form (TCLE).

The dataset is described in detail in the accompanying manuscript:
Abreu, P. E. O. G. B. et al. CODE-II: A large-scale dataset for artificial intelligence in ECG analysis. npj Digital Medicine (2026). https://doi.org/10.1038/s41746-026-02704-4

Requesting access

Researchers affiliated to educational or research institutions might make requests to access this data dataset. The usage is exclusively for academic purposes. Requests will be analyzed on an individual basis and should contain: Name of PI and host organisation; Contact details (including your name and email); and, the scientific purpose of data access request.


File organization
Files are grouped into compressed packages (.tar.gz) organized by year and month (waveforms/YYYY/MM/partNN.tar.gz). A manifest.csv file (mapping each exam record to its corresponding package) and the original RECORDS.txt index are included to help locate specific exams within the packages.

File naming convention
Each tracing is stored as a pair of files following the pattern ecg_{exam_id}_reg{register_num}.hea / .dat (WFDB header and signal data files). Exams with multiple tracings produce multiple numbered pairs (e.g., ecg_533310_reg1, ecg_533310_reg2, ecg_533310_reg3).

Signal properties

- Leads: 12 standard leads (DI, DII, DIII, AVR, AVL, AVF, V1–V6)
- Unit: millivolts (mV)
- Sampling rate: 300, 500, 600, or 1000 Hz (device-dependent; stored in each header file)
- Duration: 7–12 seconds per tracing
- Format: WFDB format 16 (16-bit integer)

Leads DIII, AVR, AVL, and AVF are reconstructed from the 8 essential leads (DI, DII, V1–V6) using standard ECG equations. Signals are stored as recorded, after unit conversion (raw ADU → mV) and lead reconstruction; no additional preprocessing (filtering or resampling) was applied. Researchers wishing to apply the preprocessing pipeline used in the accompanying manuscript should refer to: https://github.com/antonior92/ecg-preprocessing

Reading the signals
Signals can be read using the wfdb Python library. Example: import wfdb, then record = wfdb.rdrecord('ecg_533310_reg1') to load a record; record.p_signal returns the signal array in mV, and record.fs returns the sampling rate in Hz.

A full description of the dataset, curation methodology, and the 66 CODE diagnostic classes is provided in the accompanying manuscript:

Abreu, P. E. O. G. B. et al. CODE-II: A large-scale dataset for artificial intelligence in ECG analysis. npj Digital Medicine (2026). https://doi.org/10.1038/s41746-026-02704-4
Keywords: Cardiology (incl. cardiovascular diseases); Medical and Health Sciences; Medicin och hälsovetenskap; Cardiology and Cardiovascular Disease; Kardiologi och kardiovaskulära sjukdomar