Add CODE-test (Parquet, original package, banner)

#1
README.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-4.0
5
+ size_categories:
6
+ - n<1K
7
+ task_categories:
8
+ - other
9
+ pretty_name: CODE-test
10
+ tags:
11
+ - ecg
12
+ - electrocardiogram
13
+ - biosignals
14
+ - time-series
15
+ - medical
16
+ - ecg-classification
17
+ configs:
18
+ - config_name: default
19
+ data_files:
20
+ - split: test
21
+ path: data/train-*
22
+ ---
23
+
24
+ <h1 align="center">CODE-test: An Annotated 12-Lead ECG Dataset</h1>
25
+
26
+ <p align="center"><video controls autoplay loop muted playsinline width="900" poster="https://huggingface.co/datasets/dronefreak/CODE-test/resolve/main/assets/demo_banner_poster.jpg" src="https://huggingface.co/datasets/dronefreak/CODE-test/resolve/main/assets/demo_banner.mp4"><img src="https://huggingface.co/datasets/dronefreak/CODE-test/resolve/main/assets/demo_banner_poster.jpg" alt="Six ECG traces, one per labeled abnormality, sweeping across the screen" width="900"></video></p>
27
+
28
+ ![Task](https://img.shields.io/badge/Task-ECG%20Classification-blue?style=flat-square)
29
+ ![Dataset](https://img.shields.io/badge/Dataset-CODE--test-0aa1a7?style=flat-square)
30
+ ![Format](https://img.shields.io/badge/Format-Parquet-orange?style=flat-square)
31
+ ![Exams](https://img.shields.io/badge/Exams-827-success?style=flat-square)
32
+ ![Leads](https://img.shields.io/badge/Leads-12-blueviolet?style=flat-square)
33
+ ![License](https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey?style=flat-square)
34
+
35
+ > **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.**
36
+
37
+ ## Dataset Description
38
+
39
+ - **Homepage:** https://zenodo.org/records/3765780
40
+ - **Paper:** https://doi.org/10.1038/s41467-020-15432-4
41
+ - **Code:** https://github.com/antonior92/automatic-ecg-diagnosis
42
+ - **License:** CC BY 4.0
43
+
44
+ ## Disclaimer
45
+
46
+ This repository is **not** an official release of CODE-test.
47
+
48
+ 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.**
49
+
50
+ 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.
51
+
52
+ **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.
53
+
54
+ ---
55
+
56
+ # Dataset Overview
57
+
58
+ 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`).
59
+
60
+ ---
61
+
62
+ # Changes from the Official Release
63
+
64
+ - Packed into Parquet, one row per exam, as a `test` split, matching how the authors use this set.
65
+ - Joined the tracings, patient attributes and all annotation files into one table.
66
+ - Added `lead_names`, `active_start`, `active_end`, `is_empty` and a rendered 12-lead `preview`.
67
+ - The official package is included unchanged at `original/data.zip`.
68
+ - No signal values or labels were changed.
69
+
70
+ ---
71
+
72
+ # Dataset Structure
73
+
74
+ | Column | Content |
75
+ |---|---|
76
+ | `exam_index` | row position in the official files, 0 to 826 |
77
+ | `age`, `sex` | from `attributes.csv` |
78
+ | `lead_names` | **verified** order of the 12 leads in `signal` (see below) |
79
+ | `gold_standard` | consensus labels: two cardiologists, with a senior specialist resolving disagreements |
80
+ | `cardiologist1`, `cardiologist2` | each cardiologist's labels |
81
+ | `cardiology_residents`, `emergency_residents`, `medical_students` | labels from each group |
82
+ | `dnn_prediction` | the paper's neural network output, thresholded to 0 or 1 |
83
+ | `signal` | `float64`, shape `(12, 4096)` as (lead, sample), 400 Hz |
84
+ | `active_start`, `active_end` | first and last sample where any lead is non-zero |
85
+ | `is_empty` | true if every sample is zero (no exam here) |
86
+ | `preview` | PNG plot of the recorded portion |
87
+
88
+ ### Read before using the signals
89
+
90
+ - **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.
91
+ - **Signals are zero-padded to 4096 samples.** Recordings last about 7 s or 10 s and are centered, so use `active_start` and `active_end` to crop them.
92
+ - **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.
93
+ - **`datasets` NumPy formatting rounds this column.** `with_format("numpy")` returns `float32`. For exact values, use the default format as shown below.
94
+
95
+ ## Usage
96
+
97
+ ```python
98
+ # pip install datasets pillow numpy
99
+ import numpy as np
100
+ from datasets import load_dataset
101
+
102
+ ds = load_dataset("dronefreak/CODE-test", split="test")
103
+ row = ds[0]
104
+
105
+ signal = np.asarray(row["signal"], dtype=np.float64) # (12, 4096)
106
+ recorded = signal[:, row["active_start"]:row["active_end"] + 1]
107
+ avr = signal[row["lead_names"].index("AVR")]
108
+ labels = row["gold_standard"] # {"1dAVb": 0, "RBBB": 0, ...}
109
+ ```
110
+
111
+ ---
112
+
113
+ # Dataset Sources
114
+
115
+ ## Citation
116
+
117
+ ```bibtex
118
+ @article{ribeiro_automatic_2020,
119
+ title = {Automatic Diagnosis of the 12-Lead {{ECG}} Using a Deep Neural Network},
120
+ 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.},
121
+ year = {2020},
122
+ volume = {11},
123
+ number = {1},
124
+ pages = {1760},
125
+ doi = {10.1038/s41467-020-15432-4},
126
+ journal = {Nature Communications}
127
+ }
128
+ ```
129
+
130
+ ---
131
+
132
+ # License
133
+
134
+ 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.
assets/demo_banner.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d0636e01c4b9f72b4a7ea0ae089f65a34e877bdb1ee0fb78ac4f17078c89eba
3
+ size 679197
assets/demo_banner_poster.jpg ADDED

Git LFS Details

  • SHA256: 334043a565e45eed84961c08a60b77e57650818e62a38aa108100ce0a3a353aa
  • Pointer size: 131 Bytes
  • Size of remote file: 181 kB
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b4f51f1d27dcfd782dac516e4adb4c12bfeb819f2f9d451394caef8bb95b39c
3
+ size 298767169
original/data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00d32666adbdd9d34e028e84a4a627cdc2c970f3c794a52866f1c149ba58526f
3
+ size 218189452