Add CODE-15% part 0

#1
by dronefreak - opened
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ original/exams.csv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-4.0
5
+ size_categories:
6
+ - 100K<n<1M
7
+ task_categories:
8
+ - other
9
+ pretty_name: CODE-15%
10
+ tags:
11
+ - ecg
12
+ - electrocardiogram
13
+ - biosignals
14
+ - time-series
15
+ - medical
16
+ - ecg-classification
17
+ configs:
18
+ - config_name: default
19
+ default: true
20
+ data_files:
21
+ - split: train
22
+ path: data/train-*
23
+ - config_name: samples
24
+ data_files:
25
+ - split: train
26
+ path: samples/train-*
27
+ ---
28
+
29
+ <h1 align="center">CODE-15%: A Large-Scale Annotated 12-Lead ECG Dataset</h1>
30
+
31
+ <p align="center"><video controls autoplay loop muted playsinline width="900" poster="https://huggingface.co/datasets/dronefreak/CODE-15/resolve/main/assets/demo_banner_poster.jpg" src="https://huggingface.co/datasets/dronefreak/CODE-15/resolve/main/assets/demo_banner.mp4"><img src="https://huggingface.co/datasets/dronefreak/CODE-15/resolve/main/assets/demo_banner_poster.jpg" alt="Six ECG traces sweeping across the screen" width="900"></video></p>
32
+
33
+ ![Task](https://img.shields.io/badge/Task-ECG%20Classification-blue?style=flat-square)
34
+ ![Dataset](https://img.shields.io/badge/Dataset-CODE--15%25-0aa1a7?style=flat-square)
35
+ ![Format](https://img.shields.io/badge/Format-Parquet-orange?style=flat-square)
36
+ ![Exams](https://img.shields.io/badge/Exams-345779-success?style=flat-square)
37
+ ![Patients](https://img.shields.io/badge/Patients-233770-success?style=flat-square)
38
+ ![Leads](https://img.shields.io/badge/Leads-12-blueviolet?style=flat-square)
39
+ ![License](https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey?style=flat-square)
40
+
41
+ > **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.**
42
+
43
+ ## Dataset Description
44
+
45
+ - **Homepage:** https://zenodo.org/records/4916206
46
+ - **CODE paper:** https://doi.org/10.1038/s41467-020-15432-4
47
+ - **ECG-age paper:** https://doi.org/10.1101/2021.02.19.21251232
48
+ - **Code:** https://github.com/antonior92/ecg-age-prediction
49
+ - **License:** CC BY 4.0
50
+
51
+ ## Disclaimer
52
+
53
+ This repository is **not** an official release of CODE-15%.
54
+
55
+ 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.**
56
+
57
+ 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.
58
+
59
+ **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.
60
+
61
+ ---
62
+
63
+ # Dataset Overview
64
+
65
+ 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`).
66
+
67
+ | Label | Positive exams |
68
+ |---|---:|
69
+ | `normal_ecg` | 134,657 |
70
+ | `RBBB` | 9,672 |
71
+ | `ST` | 7,584 |
72
+ | `AF` | 7,033 |
73
+ | `LBBB` | 6,026 |
74
+ | `1dAVb` | 5,716 |
75
+ | `SB` | 5,605 |
76
+
77
+ ---
78
+
79
+ # Changes from the Official Release
80
+
81
+ - Packed the 18 HDF5 parts into 18 Parquet shards, one row per exam, joined to `exams.csv` by `exam_id`.
82
+ - 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`.
83
+ - Added `source_file`, `active_start`, `active_end` and `is_empty`.
84
+ - Added a small `samples` config of 196 exams with a rendered 12-lead `preview`.
85
+ - The official `exams.csv` is included unchanged in `original/`. The official HDF5 zips are not duplicated here and remain on Zenodo.
86
+ - No signal values or labels were changed.
87
+
88
+ ---
89
+
90
+ # Dataset Structure
91
+
92
+ | Column | Content |
93
+ |---|---|
94
+ | `exam_id`, `patient_id` | official exam and patient ids |
95
+ | `age`, `is_male` | patient age at the exam, and sex |
96
+ | `nn_predicted_age` | age predicted by the authors' neural network |
97
+ | `1dAVb`, `RBBB`, `LBBB`, `SB`, `AF`, `ST` | abnormality labels |
98
+ | `normal_ecg` | true if the automatic annotation system reports a normal ECG |
99
+ | `death` | true if the patient died during follow-up, only on the patient's first exam |
100
+ | `timey` | time to death, or follow-up time, only on the patient's first exam |
101
+ | `source_file` | official HDF5 part holding this exam |
102
+ | `signal` | `float32`, shape `(12, 4096)` as (lead, sample), 400 Hz |
103
+ | `active_start`, `active_end` | first and last sample where any lead is non-zero, -1 if empty |
104
+ | `is_empty` | true if every sample is zero |
105
+ | `preview` | PNG plot of the recorded portion (`samples` config only) |
106
+
107
+ 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.
108
+
109
+ ### Read before using the signals
110
+
111
+ - **Split by `patient_id`, not by row.** Many patients have several exams, so a row-level split leaks patients between train and test.
112
+ - **670 exams are entirely zero.** They are kept and flagged with `is_empty`, so filter them before training.
113
+ - **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.
114
+ - **`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.
115
+ - **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.
116
+ - **CODE-test uses a different order.** The sibling dataset [CODE-test](https://huggingface.co/datasets/dronefreak/CODE-test) stores `AVL, AVF, AVR` in these positions, so reorder before combining them.
117
+ - **The amplitude unit is not stated in this record.** Values are kept as published.
118
+
119
+ ## Usage
120
+
121
+ The full dataset is about 43 GB, so streaming is the easiest way to start.
122
+
123
+ ```python
124
+ # pip install datasets pillow numpy
125
+ import numpy as np
126
+ from datasets import load_dataset
127
+
128
+ ds = load_dataset("dronefreak/CODE-15", split="train", streaming=True)
129
+ row = next(r for r in ds if not r["is_empty"])
130
+
131
+ signal = np.asarray(row["signal"], dtype=np.float32) # (12, 4096)
132
+ recorded = signal[:, row["active_start"]:row["active_end"] + 1]
133
+
134
+ # A small subset with rendered previews
135
+ samples = load_dataset("dronefreak/CODE-15", "samples", split="train")
136
+ ```
137
+
138
+ ---
139
+
140
+ # Dataset Sources
141
+
142
+ ## Citation
143
+
144
+ Please cite both papers and the dataset (DOI `10.5281/zenodo.4916206`):
145
+
146
+ 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
147
+
148
+ 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
149
+
150
+ ---
151
+
152
+ # License
153
+
154
+ 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.
assets/demo_banner.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4168259f216152aa615977627e146fd314e0f34c09d17d1ef67af548014ef531
3
+ size 664662
assets/demo_banner_poster.jpg ADDED

Git LFS Details

  • SHA256: 63aa627ee65d723020eaa3219d104a229728bc3a4736f0b3556ed2e6aaf40760
  • Pointer size: 131 Bytes
  • Size of remote file: 173 kB
data/train-00000-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:638119b1785b6fcdd6f4a1fe66dc6b974ea824473b0ce720e94c7c85f3797e96
3
+ size 2497506378
data/train-00001-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1b19e8ca59ecfe38e892b34b9887aa34f16df6ed06524ab2fd6a95ad1461aae
3
+ size 2493909132
data/train-00002-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4da3aa07a24cada8cab006109e7c09dedfc2fc66f6a32e65f76e85695d22d987
3
+ size 2499530533
data/train-00003-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60f2efdf2b6f46f04abb8c8cf7b1a68623562afd0ba595f799218aef96113bc2
3
+ size 2500713555
data/train-00004-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:536cf0f5c9f2a5f4848b05371187a32d07425d31a732f46e733a6259b367ba15
3
+ size 2498657090
data/train-00005-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe5f597fe21a846ccff11157bbf8865ba08e09d3706ef5b58dc042c36f18cfaf
3
+ size 2497719698
data/train-00006-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac91d57ada0be01cb878bf4c48b991e505116313412b84839c6c232b778a1e04
3
+ size 2493126925
data/train-00007-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7adfa2aab91c9dc738fa637bfdcef88b0a907095641f80931353d7a5026f9ce9
3
+ size 2497195770
data/train-00008-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe9d85b2253f9c40afcc68f3106c120434227db0ea8ad8ad05cd0bb84ba3709f
3
+ size 2492353282
data/train-00009-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50dcc17f6df29a805feca58c18abb3363d6e225c0102f33f26a98d5d7c420eed
3
+ size 2493576290
data/train-00010-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10e182ecc0ba218d1338357f48a6a99b4893e927cfdad3f1f3b8496a17094e5f
3
+ size 2497643434
data/train-00011-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cf03145b2443f8d3d77b740547e696d44f413b2f83589d62c69ef00f0ea4402
3
+ size 2492808486
data/train-00012-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef72acf74a315834b95765d7c0927dd3242c2cbc6d867634caeacc17816722af
3
+ size 2498586355
data/train-00013-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba6a50dfdf52140dd519dc6693d2b713375e096c39704d261ea5bb13cfd739d6
3
+ size 2493116130
data/train-00014-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78db5d83ea15370d03a30fea9ddd09b3fc03d38b3d61cbdff9d52bbe6270aaef
3
+ size 2497104883
data/train-00015-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:298560c146677ddab32c20b79f22cd6a1ccc4d384e1677653fd8aee55e3660e0
3
+ size 2515065604
data/train-00016-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26f7bee8c48535ccdcdd3bf3c611004362355c1d18ce667a4a75377cff419876
3
+ size 2540565049
data/train-00017-of-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2fcdca7a23af3ad6373c724978ba4c618c74e187668f60517b06bc4114fa9b7
3
+ size 731007472
original/exams.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9f82f4c07c1793e2285915c69f1113f5a7db8a0f2cf2f4b90474502f406bc35
3
+ size 35500900
samples/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:769402c0edecf68cfa9eef20e39f2d6ef364383b982239fb40ff48074cbc8198
3
+ size 45315947