<codeBook xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="ddi:codebook:2_6 http://www.ddialliance.org/Specification/DDI-Codebook/2.6/XMLSchema/codebook.xsd" xmlns="ddi:codebook:2_6">
  <docDscr>
    <citation>
      <titlStmt>
        <titl xml:lang="sv"></titl>
        <parTitl xml:lang="en">CODE II dataset</parTitl>
        <IDNo agency="SND">doi-10-17044-scilifelab-32859377-0</IDNo>
        <IDNo agency="DOI">https://doi.org/10.17044/SCILIFELAB.32859377</IDNo>
      </titlStmt>
      <prodStmt>
        <producer xml:lang="en" abbr="SND">Swedish National Data Service</producer>
        <producer xml:lang="sv" abbr="SND">Svensk nationell datatjänst</producer>
      </prodStmt>
      <holdings URI="https://doi.org/10.17044/SCILIFELAB.32859377">Landing page</holdings>
    </citation>
  </docDscr>
  <stdyDscr>
    <citation>
      <titlStmt>
        <titl xml:lang="sv"></titl>
        <parTitl xml:lang="en">CODE II dataset</parTitl>
        <IDNo agency="SND">doi-10-17044-scilifelab-32859377-0</IDNo>
        <IDNo agency="DOI">https://doi.org/10.17044/SCILIFELAB.32859377</IDNo>
      </titlStmt>
      <rspStmt>
        <AuthEnty xml:lang="en" affiliation="Science for Life Laboratory">H. Ribeiro, Antonio</AuthEnty>
      </rspStmt>
      <prodStmt />
      <distStmt>
        <distrbtr xml:lang="en" abbr="SND" URI="https://snd.se">Swedish National Data Service</distrbtr>
        <distrbtr xml:lang="sv" abbr="SND" URI="https://snd.se">Svensk nationell datatjänst</distrbtr>
        <distDate xml:lang="en" date="2026-07-23" />
      </distStmt>
      <verStmt>
        <version elementVersion="0" elementVersionDate="2026-07-23" />
      </verStmt>
      <holdings URI="https://doi.org/10.17044/SCILIFELAB.32859377">Landing page</holdings>
    </citation>
    <stdyInfo>
      <subject />
      <abstract xml:lang="en" contentType="abstract">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</abstract>
      <sumDscr />
    </stdyInfo>
    <method>
      <dataColl />
    </method>
    <dataAccs>
      <useStmt>
        <restrctn xml:lang="en">Access to data through an external actor. Access to data is restricted.</restrctn>
        <restrctn xml:lang="sv">Åtkomst till data via extern aktör. Tillgång till data är begränsad.</restrctn>
        <conditions elementVersion="info:eu-repo-Access-Terms vocabulary">restrictedAccess</conditions>
      </useStmt>
    </dataAccs>
    <othrStdyMat />
  </stdyDscr>
</codeBook>