Last updated: 2021-10-11
Checks: 7 0
Knit directory: false.alarm/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20201020)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version d63ddde. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: analysis/blog_cache/
Ignored: renv/library/
Ignored: renv/staging/
Staged changes:
New: .github/R-version
New: .github/depends.Rds
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/report.Rmd
) and HTML (docs/report.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 6b03f43 | Francisco Bischoff | 2021-10-11 | Squashed commit of the following: |
html | c19ec01 | Francisco Bischoff | 2021-08-17 | Build site. |
html | a5ec160 | Francisco Bischoff | 2021-08-17 | Build site. |
html | b51dba2 | GitHub Actions | 2021-08-17 | Build site. |
Rmd | c88cbd5 | Francisco Bischoff | 2021-08-17 | targets workflowr |
html | c88cbd5 | Francisco Bischoff | 2021-08-17 | targets workflowr |
html | e7e5d48 | GitHub Actions | 2021-07-15 | Build site. |
Rmd | 1473a05 | Francisco Bischoff | 2021-07-15 | report |
html | 1473a05 | Francisco Bischoff | 2021-07-15 | report |
Rmd | 7436fbe | Francisco Bischoff | 2021-07-11 | stage cpp code |
html | 7436fbe | Francisco Bischoff | 2021-07-11 | stage cpp code |
html | 52e7f0b | GitHub Actions | 2021-03-24 | Build site. |
Rmd | 7c3cc31 | Francisco Bischoff | 2021-03-23 | Targets |
html | 7c3cc31 | Francisco Bischoff | 2021-03-23 | Targets |
This research is being conducted using the Research Compendium principles:1
Data management is following the FAIR principle (findable, accessible, interoperable, reusable).2
The current dataset used is the CinC/Physionet Challenge 2015 public dataset, modified to include only the actual data and the header files in order to be read by the pipeline and is hosted by Zenodo3 under the same license as Physionet.
The dataset is composed of 750 patients with at least five minutes records. All signals have been resampled (using anti-alias filters) to 12 bit, 250 Hz and have had FIR bandpass (0.05 to 40Hz) and mains notch filters applied to remove noise. Pacemaker and other artifacts still present on the ECG.4 Furthermore, this dataset contains at least two ECG derivations and one or more variables like arterial blood pressure, photoplethysmograph readings, and respiration movements.
The event we seek to improve is the detection of a life-threatening arrhythmia as defined by Physionet in Table .
Alarm | Definition |
---|---|
Asystole | No QRS for at least 4 seconds |
Extreme Bradycardia | Heart rate lower than 40 bpm for 5 consecutive beats |
Extreme Tachycardia | Heart rate higher than 140 bpm for 17 consecutive beats |
Ventricular Tachycardia | 5 or more ventricular beats with heart rate higher than 100 bpm |
Ventricular Flutter/Fibrillation | Fibrillatory, flutter, or oscillatory waveform for at least 4 seconds |
The fifth minute is precisely where the alarm has been triggered on the original recording set. To meet the ANSI/AAMI EC13 Cardiac Monitor Standards,5 the onset of the event is within 10 seconds of the alarm (i.e., between 4:50 and 5:00 of the record). That doesn’t mean that there are no other arrhythmias before, but those were not labeled.
All steps of the process are being managed using the R package targets
6 from data extraction to the final report, as shown in Fig. .
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
The report is available on the main webpage,7 allowing inspection of previous versions managed by the R package workflowr
8, as shown in Fig. .
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
The project started with a literature survey on the databases Scopus, Pubmed, Web of Science, and Google Scholar with the following query (the syntax was adapted for each database):
TITLE-ABS-KEY ( algorithm OR ‘point of care’ OR ‘signal processing’ OR ‘computer assisted’ OR ‘support vector machine’ OR ‘decision support system’ OR ’neural network’ OR ‘automatic interpretation’ OR ‘machine learning’) AND TITLE-ABS-KEY ( electrocardiography OR cardiography OR ‘electrocardiographic tracing’ OR ecg OR electrocardiogram OR cardiogram ) AND TITLE-ABS-KEY ( ‘Intensive care unit’ OR ‘cardiologic care unit’ OR ‘intensive care center’ OR ‘cardiologic care center’ )
The inclusion and exclusion criteria were defined as in Table .
Inclusion criteria | Exclusion criteria |
---|---|
ECG automatic interpretation | Manual interpretation |
ECG anomaly detection | Publication older than ten years |
ECG context change detection | Do not attempt to identify life-threatening arrhythmias, namely asystole, extreme bradycardia, extreme tachycardia, ventricular tachycardia, and ventricular flutter/fibrillation |
Online Stream ECG analysis | No performance measurements reported |
Specific diagnosis (like a flutter, hyperkalemia, etc.) |
The current stage of the review is on Data Extraction, from the resulting screening shown in Fig. .
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
Meanwhile, the project pipeline has been set up on GitHub, Inc. 9 leveraging on Github A ions10 for the Continuous Integration lifecycle, the repository is available at,9 and the resulting report is available at7 for transparency while the roadmap and tasks are managed using the integrated Zenhub.11
As it is known worldwide, 2020 was hard on every project, which required changes on the timeline. In Fig. it is shown the initial roadmap (as of May 2020) and Fig. the modified roadmap (as of July 2021).
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
RAW Data
While programming the pipeline for the current dataset, it has been acquired a Single Lead Heart Rate Monitor breakout from SparkfunTM12 using the AD823213 microchip from Analog Devices Inc., compatible with Arduino(R),14 for an in-house experiment (Figs. and ).
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
The output gives us a RAW signal as shown in Fig. .
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
After applying the same settings as the Physionet database (collecting the data at 500hz, resample to 250hz, pass-filter, and notch filter), the signal is much better as shown in Fig. . Note: the leads were not placed on the correct location.
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
So in this way, we allow us to import RAW data from other devices and build our own test dataset in the future.
Detecting Regime Changes
The regime change approach will be using the Arc Counts, as explained elsewhere.15 The current implementation of the Matrix Profile in R, maintained by the first author of this thesis, is being used to accomplish the computations. This package was published in R Journal.16
A new concept was needed to be implemented on the algorithm in order to emulate (in this first iteration) the behavior of the real-time sensor: the search must only look for previous information within a time constraint. Thus, both the Matrix Profile computation and the Arc Counts needed to be adapted for this task.
At the same time, the ECG data needs to be “cleaned” for proper evaluation. That is different from the initial filtering process. Several SQIs (Signal Quality Indexes) are used on literature,17 some trivial measures as kurtosis, skewness, median local noise level, other more complex as pcaSQI (the ratio of the sum of the five largest eigenvalues associated with the principal components over the sum of all eigenvalues obtained by principal component analysis applied to the time aligned ECG segments in the window). By experimentation (yet to be validated), a simple formula gives us the “complexity” of the signal and correlates well with the noisy data is shown in Equation (1).
\[ \sqrt{\sum_{i=1}^w((x_{i+1}-x_i)^2)}, \quad \text{where}\; w \; \text{is the window size} \tag{1} \]
The Fig. shows some SQIs.
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
Finally, a sample of the regime change detection is shown in Figs. to .
Fig. shows that noisy data (probably patient muscle movements) are marked with a blue point and thus are ignored by the algorithm. Also, valid for the following plots, the green and red lines on the data mark the 10 seconds window where the “event” that triggers the alarm is supposed to happen.
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
In Fig. , the data is clean; thus, nothing is excluded. Interestingly one of the detected regime changes is inside the “green-red” window. But it is a false alarm.
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
The last plot (Fig. ) shows the algorithm’s robustness, not excluding good data with a wandering baseline, and the last regime change is correctly detected inside the “green-red” window.
Version | Author | Date |
---|---|---|
1473a05 | Francisco Bischoff | 2021-07-15 |
1. Research compendium. Published 2019. Accessed April 8, 2021. https://research-compendium.science
2. Wilkinson M, Dumontier M, Aalbersberg I, et al. The fair guiding principles for scientific data management and stewardship. Scientific Data. 2016;3(1). doi:10.1038/sdata.2016.18
3. Reducing false arrhythmia alarms in the icu - the physionet computing in cardiology challenge 2015. Published online March 24, 2021. doi:10.5281/ZENODO.4634014
4. Clifford GD, Silva I, Moody B, et al. The physionet/computing in cardiology challenge 2015: Reducing false arrhythmia alarms in the icu. In: Computing in Cardiology.; 2015. doi:10.1109/cic.2015.7408639
5. Association for the Advancement of Medical Instrumentation. Cardiac monitors, heart rate meters, and alarms. Association for the Advancement of Medical Instrumentation; 2002.
6. Landau W, Landau W, Warkentin M, et al. Ropensci/Targets, Dynamic Function-Oriented ’Make’-Like Declarative Workflows. Zenodo; 2021. doi:10.5281/ZENODO.4062936
7. Franzbischoff/false.alarm: Reproducible reports. Published 2021. Accessed April 8, 2021. https://franzbischoff.github.io/false.alarm
8. Blischak JD, Carbonetto P, Stephens M. Creating and sharing reproducible research code the workflowr way [version 1; peer review: 3 approved]. F1000Research. 2019;8(1749). doi:10.12688/f1000research.20843.1
9. Bischoff F. GitHub false.alarm repository. Accessed July 14, 2021. https://github.com/franzbischoff/false.alarm
10. GitHub Actions. Accessed July 14, 2021. https://github.com/features/actions
11. Zenhub workspace. Accessed July 14, 2021. https://app.zenhub.com/workspaces/phd-thesis-5eb2ce34f5f30b3aed0a35af/board
12. SparkFun Single Lead Heart Rate Monitor - AD8232 - SEN-12650 - SparkFun Electronics. Accessed July 14, 2021. https://www.sparkfun.com/products/12650
13. Analog Devices. AD8232 Single-Lead, Heart Rate Monitor Front End. Published online 2020. Accessed July 14, 2021. https://www.analog.com/media/en/technical-documentation/data-sheets/ad8232.pdf
14. Arduino. Accessed July 14, 2021. https://www.arduino.cc/
15. Gharghabi S, Yeh C, Ding Y, et al. Domain agnostic online semantic segmentation for multi-dimensional time series. Data Mining and Knowledge Discovery. 2018;33(1):96-130. doi:10.1007/s10618-018-0589-3
16. Bischoff F, Rodrigues PP. tsmp: An R Package for Time Series with Matrix Profile. The R Journal. 2020;12(1):76-86. doi:10.32614/RJ-2020-021
17. Eerikainen L, Vanschoren J, Rooijakkers M, Vullings R, Aarts R. 2015 computing in cardiology conference (cinc). In: IEEE; 2015. doi:10.1109/cic.2015.7408644
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] kableExtra_1.3.4 tibble_3.1.5 visNetwork_2.1.0 tarchetypes_0.3.1
[5] targets_0.8.0 workflowr_1.6.2 here_1.0.1
loaded via a namespace (and not attached):
[1] tidyselect_1.1.1 xfun_0.26 bslib_0.3.1 purrr_0.3.4
[5] colorspace_2.0-2 vctrs_0.3.8 viridisLite_0.4.0 htmltools_0.5.2
[9] yaml_2.2.1 utf8_1.2.2 rlang_0.4.11 later_1.3.0
[13] pillar_1.6.3 jquerylib_0.1.4 glue_1.4.2 withr_2.4.2
[17] lifecycle_1.0.1 stringr_1.4.0 munsell_0.5.0 rvest_1.0.1
[21] htmlwidgets_1.5.4 codetools_0.2-18 evaluate_0.14 knitr_1.36
[25] callr_3.7.0 fastmap_1.1.0 httpuv_1.6.3 ps_1.6.0
[29] fansi_0.5.0 highr_0.9 Rcpp_1.0.7 scales_1.1.1
[33] renv_0.14.0 promises_1.2.0.1 webshot_0.5.2 jsonlite_1.7.2
[37] systemfonts_1.0.2 fs_1.5.0 digest_0.6.28 stringi_1.7.5
[41] processx_3.5.2 rprojroot_2.0.2 cli_3.0.1 tools_4.1.1
[45] magrittr_2.0.1 sass_0.4.0 crayon_1.4.1 whisker_0.4
[49] pkgconfig_2.0.3 ellipsis_0.3.2 xml2_1.3.2 data.table_1.14.2
[53] svglite_2.0.0.9000 rmarkdown_2.11 httr_1.4.2 rstudioapi_0.13
[57] R6_2.5.1 igraph_1.2.6 compiler_4.1.1 git2r_0.28.0.9000