You are on page 1of 270

Ateneo de Zamboanga University

Portable Heart Attack Alert System (PHAAS):

An Objective-Based Approach in Detecting ST-elevated Myocardial

Infarction (STEMI) for Patients with Ischemic Heart Disease

A Senior Design Project

Presented to the Faculty of the Engineering Department

College of Science and Information Technology

ATENEO DE ZAMBOANGA UNIVERSITY

by

Camba, James Michael M.

Ramiso, Allysa Marie R.

BS Biomedical Engineering IV

Niño Christon Y. Lazarte, ECE, ECT

Adviser

May 2, 2023
Ateneo de Zamboanga University

APPROVAL SHEET
This thesis hereto entitled:

Portable Heart Attack Alert System (PHAAS): An Objective-Based Approach in


Detecting ST-elevated Myocardial Infarction (STEMI) for Patients with Ischemic
Heart Disease

Prepared and submitted by JAMES MICHAEL M. CAMBA and ALLYSA MARIE R.


RAMISO in partial fulfillment of the requirements for the degree of Bachelor of Science
in Biomedical Engineering has been examined and is recommended for acceptance
and approval for ORAL EXAMINATION.

NIÑO CHRISTON Y. LAZARTE, ECE, ECT


Adviser

Approved by the Committee on Oral Examination with a grade of PASSED on May 2,


2023.

LOUIE VIRGIL A. GALLARDO, ME-ECE


Panel Chair

ZAEEFA A. PANDANGAN, ECE, ECT BIANCA DANIELLE C. ORAA


Member Member

Accepted in partial fulfillment of the requirements for the degree of Bachelor of


Science in Biomedical Engineering.

LOUIE VIRGIL A. GALLARDO, ME-ECE


Chair
Engineering Department

JOCELYN D. PARTOSA, Ph.D.


Dean
College of Science, Information Technology and Engineering
Ateneo de Zamboanga University

ABSTRACT
Ischemic Heart Disease (IHD) is a cardiovascular disorder characterized by the

accumulation of plaque, commonly known as atherosclerosis. According to Philippine

Statistics Authority (2022) and Khan et al. (2020), IHD is a significant contributor to

mortality rates globally and locally. Individuals diagnosed with IHD are at an increased

risk of experiencing heart attacks, as well as associated complications, such as

cardiac failure, arrest, and death.

The detection of heart attacks primarily relies on identifying symptoms, which

can be subjective and may lead to delayed diagnosis. Hospital equipment and tests,

such as chest X-rays, ECG, and blood tests, can also aid in detection, but accessibility

is limited outside of medical facilities. Additionally, some heart attacks occur silently,

with no symptoms, making them unpredictable. Given the potential for significant

cardiac damage and mortality, timely diagnosis, and rapid response are crucial.

Therefore, early detection and intervention are critical in managing heart attacks,

emphasizing the importance of prompt action to mitigate potentially fatal

consequences.

With these in mind, the PHAAS (Portable Heart Attack Alert System) was

designed and developed as a real-time, portable device capable of detecting heart

attacks, particularly STEMI, using electrocardiography (ECG) and machine learning.

The device consists of six modules, including an acquisition and signal processing

unit, a data analysis module, a storage unit, an alert system module, a display system,

and a battery module. Mainly, it functions by using the elevation of the ST segment in

the ECG signal to detect heart attacks, and machine learning algorithms were trained
Ateneo de Zamboanga University

to enable automatic detection. The alert system, on the other hand, automatically

contacts the user and clinician upon detection, enabling prompt medical intervention

and improving outcomes.

Results from testing of the PHAAS device demonstrate its effectiveness in

detecting STEMI heart attacks. Machine learning algorithms used in both system and

beta testing showed a relatively high accuracy of 87% and 83%, respectively, under

acceptable conditions. When the device's modules were integrated and tested as a

whole, the PHAAS system demonstrated reliability and functionality, achieving a

success rate of 95% in normal and STEMI classification. However, certain factors

such as motion artifacts, limited sensor sensitivity, and data mismatch were found to

affect model performance. Further improvement of developed filters can address

these issues.

Additionally, the alert system of the PHAAS device functioned accordingly

during testing, initiating alerts only when STEMI ECG was detected. The SMS and

call alerts were directed to the assigned contacts upon detection of a heart attack.

However, network connection and sim registration to promos may affect the device's

ability to initiate alerts, and these factors should be considered when using the device

in practical settings.

Lastly, results from the post-survey conducted during the beta testing phase of

the PHAAS device indicate that participants strongly agree with the device's portability

and comfortability. This suggests that the device is well-designed for ease of use and

can potentially be integrated into everyday life.


Ateneo de Zamboanga University

In summary, a portable heart attack alert system for the automatic real-time

detection of STEMI heart attacks was successfully implemented. With further

improvements, the PHAAS device represents a promising development in the field of

medical devices for heart attack detection and intervention.


Ateneo de Zamboanga University

ACKNOWLEDGEMENTS

The success of this thesis would not have been possible without the support,

guidance, insights, and encouragement of others. We would like to take this

opportunity to express our deepest gratitude toward those who contributed to making

this accomplishment a reality. Their invaluable contributions have been instrumental

in shaping the direction and development of this thesis.

First and foremost, we would like to thank our thesis advisor, Niño Christon Y.

Lazarte, who provided us with constant assistance and direction in creating our

proposed device and writing this paper. This paper would not have been completed

without his aid and committed involvement at every stage of the process.

To Mr. Roel Rojas and the Zamboanga City Medical Center Biomedical

Unit, especially our BME seniors, we are grateful for the patience, understanding,

support, and motivation you continue to provide us. It has helped us tremendously in

pushing through despite the challenges we have encountered.

We would also like to express our gratitude to the volunteers of our beta testing,

and respected cardiologists, Dr. Amelyn S. Ulanghutan from Zamboanga Doctor’s

Hospital and Dr. Nurhaya A.Hadjail-Ismael from HRT Medical & Maternity Complex,

who took time off their day to help us further establish our paper. Without your

willingness to participate, especially with our doctors who gracefully provided us with

their expertise, we would not have been able to proceed in successfully completing

this paper.
Ateneo de Zamboanga University

We would also like to extend our deepest appreciation to our families, most

especially our parents, for their financial and emotional support. A special thanks goes

to our siblings who have assisted and adjusted to us in many ways.

To our friends and fellow BME peers of this batch, we are deeply thankful for

the encouragement, support, struggle, cheers, and tears that we shared with one

another. Working and communicating with all of you has been uplifting. Everybody’s

success and grit to push through, despite the struggles, gave us the motivation to

continue and eventually, allowed us to reach success.

Most importantly, to God Almighty, whom we have confided in during moments

of doubt and demotivation. We thank you for your presence and spiritual guidance.

We also thank you for the strength and wisdom you have bestowed upon us, enabling

us to persevere and overcome the challenges we faced throughout this journey.


Ateneo de Zamboanga University

TABLE OF CONTENTS
CHAPTER I ............................................................................................ 1
1.1 Background of the Study ......................................................................................... 1
1.2 Problem Statement .................................................................................................. 5
1.3 Conceptual Design ................................................................................................ 12
1.4 Objectives .............................................................................................................. 15
1.5 Scope and Delimitations ........................................................................................ 16
1.6 Significance of the Study ....................................................................................... 18

CHAPTER II ......................................................................................... 21
2.1 Current Preventive Methods for Myocardial Infarction ......................................... 21
2.2 Current Diagnostic Tests for Myocardial Infarction .............................................. 33
2.3 ECG Signal Acquisition Methods .......................................................................... 38
2.4 ECG Pre-processing Methods .............................................................................. 40
2.5 Machine Learning for Detection of Heart Attack ................................................... 42
2.6 Existing Real-Time Heart Attack Detection Device .............................................. 43
2.7 Existing Studies with Similar Approach ................................................................ 44

CHAPTER III ........................................................................................ 58


3.1 Requirements......................................................................................................... 58
3.1.1 Theoretical Considerations ............................................................................. 58
3.1.2 Hardware Requirements ................................................................................. 72
3.1.3 Software Requirements .................................................................................. 80
3.2 Functional Design .................................................................................................. 81
3.2.1 Functional Analysis of Hardware Component ................................................ 82
3.2.2 Functional Analysis of Software Components ............................................... 89
3.3 Testing and Validation ......................................................................................... 102
3.3.1 Functional Testing ......................................................................................... 102
3.3.2 System Testing.............................................................................................. 110
3.3.3 Beta Testing .................................................................................................. 116
Ateneo de Zamboanga University

CHAPTER IV ..................................................................................... 119


4.1 Hardware Design ................................................................................................. 120
4.2 Software Design .................................................................................................. 125
4.3 Set-up, Mounting, Casing .................................................................................... 162

CHAPTER V ...................................................................................... 166


5.1 Functional Testing ............................................................................................... 166
5.2 System Testing .................................................................................................... 185
5.3 Beta Testing ......................................................................................................... 194

CHAPTER VI ..................................................................................... 199

CHAPTER VII .................................................................................... 202

BIBLIOGRAPHY ................................................................................ 205

APPENDICES .................................................................................... 222


APPENDIX A .......................................................................................................... 222
APPENDIX B .......................................................................................................... 223
APPENDIX C .......................................................................................................... 224
APPENDIX D .......................................................................................................... 225
APPENDIX E .......................................................................................................... 226
APPENDIX F .......................................................................................................... 228
APPENDIX G .......................................................................................................... 230
APPENDIX H .......................................................................................................... 231
APPENDIX I............................................................................................................ 232
APPENDIX J ........................................................................................................... 233
APPENDIX K .......................................................................................................... 234
APPENDIX L........................................................................................................... 236
APPENDIX M ......................................................................................................... 237
APPENDIX N .......................................................................................................... 238
APPENDIX O .......................................................................................................... 239
Ateneo de Zamboanga University

APPENDIX P .......................................................................................................... 240


APPENDIX Q .......................................................................................................... 242
APPENDIX R .......................................................................................................... 243
APPENDIX S .......................................................................................................... 246
Ateneo de Zamboanga University

LIST OF FIGURES
Figure 1-1. Conceptual Design of Portable Heart Attack Alert System ..................... 13
Figure 3-1. Components of Normal ECG Reading (Biopac Systems, Inc., n.d.)....... 59
Figure 3-2. Comparison of ST segment variations (Chowdhury et al., 2019) ........... 59
Figure 3-3. Possible Hyperplanes in classifying data (Gandhi, 2018) ....................... 61
Figure 3-4. Optimal Hyperplane and Maximum Margin in SVM (Gandhi, 2018) ....... 61
Figure 3-5. Linearly separable data (MLMath.io, 2019) ............................................. 62
Figure 3-6. Non-linearly separable data (MLMath.io, 2019) ...................................... 62
Figure 3-7. Application of Kernel for non-linear classification (Sharma, 2019) ......... 63
Figure 3-8. Frequency Response of a Bandpass Filter (Electronics Tutorial, n.d.) .. 64
Figure 3-9. Sample of Simple Moving Average filter application (Salain, 2022) ....... 66
Figure 3-10. Variation of Power Spectral Density of normal, ST-elevation, and T-
wave inversion ECG traces (Chowdhury et al., 2019)................................................ 68
Figure 3-11. Wavelets with small and long scale factors (MathWorks, n.d.) ............. 71
Figure 3-12. Sparkfun Analog ECG Sensor Module Kit (Alibaba, n.d.) ..................... 73
Figure 3-13. iCare Disposable ECG Electrodes (iCare, n.d.) .................................... 73
Figure 3-14. Adafruit ADS1015 12-bit ADC (Makerlab Electronics, n.d.) .................. 74
Figure 3-15. Raspberry Pi 4 Model B (Raspberry Pi, n.d.)......................................... 75
Figure 3-16. 128 GB SanDisk Ultra Micro SD Card (Amazon, n.d.) .......................... 75
Figure 3-17. SIM800L V2 5V Wireless GSM GPRS Module (Maker-lab electronics,
n.d.) .............................................................................................................................. 76
Figure 3-18. 16x2 LCD Display (Maker-lab electronics, n.d.) .................................... 77
Figure 3-19. Digital Multimeter (Fluke, 2021) ............................................................. 78
Figure 3-20. Fluke Prosim8 Vital Signs Simulator (Fluke, n.d.) ................................. 79
Figure 3-21. ACER Predator Helios 300 Gaming Laptop (Carousel, n.d.) ................ 79
Figure 3-22. Block Diagram of PHAAS ....................................................................... 82
Figure 3-23. Preliminary Design of Portable Heart Attack Alert System ................... 83
Figure 3-24. Approximate Dimensions of Portable Heart Attack Alert System ......... 83
Figure 3-25. Chest Lead II Configuration (Sampson, 2018) ...................................... 84
Figure 3-26. Main flowchart of PHAAS ....................................................................... 89
Ateneo de Zamboanga University

Figure 3-27. Flow diagram of Acquisition and Signal Processing Unit ...................... 90
Figure 3-28. Flow Diagram of Data Analysis Module ................................................. 92
Figure 3-29. Flow Diagram of Training Machine Learning Process........................... 92
Figure 3-30. Flow Diagram of Alert System Module ................................................. 100
Figure 3-31. Flow Diagram of Storage Module ......................................................... 101
Figure 3-32. Flow diagram of Display System .......................................................... 101
Figure 4-1 Block Diagram of the Experimental Setup of the Proposed Device ....... 119
Figure 4-2. Complete Schematic Diagram of the Proposed Solution ...................... 121
Figure 4-3. Schematic diagram of Acquisition and Signal Processing Unit ............. 121
Figure 4-4. Schematic Diagram of the Storage Module ........................................... 123
Figure 4-5. Schematic Diagram of Alert System Module ......................................... 123
Figure 4-6. Schematic Diagram of Display Module .................................................. 124
Figure 4-7. ECG Plots of Different Window Sizes .................................................... 131
Figure 4-8. Frequency Response of Moving Average Filter with Window Size 7 ... 132
Figure 4-9. Frequency Response of Moving Average Filter with Window Size 11 . 132
Figure 4-10. Frequency Response of Moving Average Filter with Window Size 15 133
Figure 4-11. Application of Moving Average and Median Filters ............................. 136
Figure 4-12. Snippet of Manual Collection of Sample Ranges of Relevant Data ... 147
Figure 4-13. Actual Experimental Design of Prototype ............................................ 162
Figure 4-14. 3D Computer Aided Design of Prototype ............................................. 163
Figure 4-15. Interior of the Experimental Design of Prototype ................................. 163
Figure 4-16. Dimensions of Modules in the Interior of Enclosure ............................ 164
Figure 4-17. Prototype Connected to a User ............................................................ 164
Figure 4-18. Prototype Strapped on a User .............................................................. 165
Figure 5-1. Functional Test Trial 8 of ECG Acquisition ............................................ 167
Figure 5-2. Normal ECG with 100% Artifact Size Test Result ................................. 171
Figure 5-3. Frequency Spectrum of Normal ECG simulation and Filter Results ..... 172
Figure 5-4. Functional Test Trial 9 of Storage Unit .................................................. 180
Figure 5-5. Functional Test Trial 1-10 of Storage Unit ............................................. 182
Figure 5-6. Functional Test Trial of Storage Unit...................................................... 184
Figure 5-7. Functional Test Trial of Storage Unit...................................................... 185
Ateneo de Zamboanga University

Figure 5-8. System Testing, Case 1, Phase III, Trial 1............................................. 190
Figure 5-9. System Testing, Case 2, Phase III, Trial 4............................................. 192
Ateneo de Zamboanga University

LIST OF TABLES
Table 2-1. Comparison of Existing Studies ................................................................. 49
Table 2-2. Comparison of Features of Existing Studies, HeartBeam, and PHAAS .. 55
Table 3-1. Summary of functional testing ................................................................. 108
Table 3-2. Case 1 for System Testing ...................................................................... 113
Table 3-3. Case 2 for System Testing ...................................................................... 115
Table 3-4. Summary of Beta Testing ........................................................................ 118
Table 5-1. Acquisition Module Test Result Summary .............................................. 168
Table 5-2. Signal Processing Unit Test Result Summary ........................................ 170
Table 5-3. Confusion Matrix using Training Data ..................................................... 174
Table 5-4. Confusion Matrix using Testing Data ...................................................... 174
Table 5-5. Data Analysis Module Test Result Summary .......................................... 175
Table 5-6. Supporting Metric Results ........................................................................ 176
Table 5-7. Storage Module Test Result Summary ................................................... 179
Table 5-8. Alert System Module Test Result Summary ........................................... 180
Table 5-.9 Display System Test Result Summary .................................................... 183
Table 5-10. Battery Module Test Result Summary .................................................. 185
Table 5-11.ST-elevation Threshold Test Summary Result ...................................... 187
Table 5-12. Artifact Size Test Summary Result ........................................................ 188
Table 5-13. System Testing Case 1 Summary Result ............................................. 189
Table 5-14. System Testing Case 2 Summary Result ............................................. 191
Table 5-15. Model Performance Using System Testing Data .................................. 193
Table 5-16. Likert-Scale Result ................................................................................. 194
Table 5-17. Interpretation of Mean Score ................................................................. 195
Table 5-18. Model Performance Using Beta Testing Data....................................... 196
Ateneo de Zamboanga University

LIST OF LISTINGS
Listing 4-1. Set ADC Sampling Rate and Gain ......................................................... 126
Listing 4-2. Acquisition of 2500 samples................................................................... 126
Listing 4-3. Bandpass Filter Design using HeartPy .................................................. 128
Listing 4-4. Moving Average Filter Design using Pandas Library ............................ 129
Listing 4-5. Median Filter Design using Scipy Module.............................................. 135
Listing 4-6. Power Spectral Density Extraction using Scipy ..................................... 137
Listing 4-7. Continuous Wavelet Transform Extraction using pywt.......................... 138
Listing 4-8. Acquiring Synthetic Features using gplearn .......................................... 139
Listing 4-9. Accessing Annotations ........................................................................... 143
Listing 4-10. Accessing ECG records ....................................................................... 146
Listing 4-11. Collecting relevant data using sample ranges acquired ..................... 147
Listing 4-12. Overview of Pre-processing Data ........................................................ 150
Listing 4-13. Splitting data into a 70:30 ratio............................................................. 152
Listing 4-14. Finding Optimal Hyperparameter ......................................................... 153
Listing 4-15. Saving Scaling Model ........................................................................... 154
Listing 4-16. RFECV Feature Selection .................................................................... 155
Listing 4-17. Saving Model with a Minimum of 70% K-fold accuracy ...................... 156
Listing 4-18. Code for Predicting Class..................................................................... 157
Listing 4-19. Calculation of Evaluation Metrics ......................................................... 157
Listing 4-20. Function for saving data as CSV files .................................................. 159
Listing 4-21. Alert System Module ............................................................................ 160
Listing 4-22. Display System Code ........................................................................... 161
Ateneo de Zamboanga University

CHAPTER I
INTRODUCTION

1.1 Background of the Study

Ischemic heart disease (IHD), also known as coronary artery disease, is a

condition that develops due to the narrowing of the heart arteries (American Heart

Association, 2016). This type of disease is due to the development of atherosclerosis,

which is the build-up of plaque (such as fats and cholesterol) within the artery walls

(Institute of Medicine, 2010). Patients with this disease are at high risk of a heart

attack.

According to the Philippine Statistics Authority (2022), IHD is one of the leading

causes of death in the Philippines. From January to May 2022, there were around

38,707 cases recorded, accounting for 18.6 percent of the total deaths in the country.

Similarly, Philippine Statistics Authority (2021) also reported a total of 56.76 thousand

cases in the first half of 2021, representing 18.7 percent of all deaths in the country.

Both are relatively higher than the recorded data from 2020, which shows 48.34

thousand cases or 16.7 percent of total deaths.

This problem also extends globally. According to Khan et al. (2020), IHD is

internationally the leading cause of death, disability, and human suffering. In 2017,

their study estimated that IHD affected around 126 million individuals worldwide,

approximately 1.72% of the world population. Among those affected, 9 million is the

estimated record of deaths globally. Moreover, they stated that the global prevalence

of IHD is increasing. There is an expectation that by 2030, the estimated prevalence

rate of 1,655 cases per 100,000 will exceed 1,845.

1
Ateneo de Zamboanga University

As mentioned, patients diagnosed with IHD are at high risk of a heart attack.

According to the NHS (2019), IHD is the leading cause of its development. In the

United States, a heart attack occurs every 40 seconds, with an estimated yearly

occurrence of around 805,000 cases — 605,000 being first heart attacks and the

remaining 200,000 being recurrent (Centers for Disease and Control Prevention,

2022).

A heart attack, medically known as myocardial infarction, occurs when the heart

does not receive enough blood due to a partial or complete blockage of the arteries

(Mayo Clinic, 2021). It can cause significant damage to the heart muscles, resulting in

undesirable complications. Examples include arrhythmias, cardiogenic shock, heart

failure, pericarditis, cardiac arrest, and death (Mayo Clinic, 2022).

Numerous health advocates urge the prevention of heart attacks in light of their

severity and multiple complications. According to the American College of Cardiology

(2019), the 2019 Primary Prevention of Cardiovascular Disease guidelines from the

American College of Cardiology and the American Heart Association states that the

key recommendations for prevention include the use of risk assessments, the

incorporation of healthy lifestyle changes, and the use of medications (see sections

2.1.1 to 2.1.3). Also, spreading public awareness is encouraged (see section 2.1.4),

especially regarding the known symptoms of heart attack, as it is the primary approach

for early detection. The common symptoms are aches and heaviness in the chest,

pain that spreads to the arms, neck, jaw, or back, heaviness in the chest, nausea,

shortness of breath, and lightheadedness (Mayo Clinic, 2021).

2
Ateneo de Zamboanga University

Unfortunately, heart attacks may also occur with no pain or symptoms, known as

silent ischemia (American Heart Association, 2015). This type of heart attack is only

identifiable via diagnostic tests (Mayo Clinic, 2022). These diagnostic tests extend

from blood tests to chest X-rays, echocardiograms, coronary angiography, and

electrocardiogram (Mayo Clinic, 2022).

Blood testing is a method that measures a specific cardiac biomarker, namely

troponin from a given blood sample (see section 2.2.1). The presence of troponin

within the blood is indicative of a heart attack as it is released by the body when

cardiac damage has occurred.

Chest X-ray, on the other hand, is an imaging procedure where organs within the

chest are scanned to produce an image with the use of an X-ray (see section 2.2.2).

This procedure is used for ruling out other possible causes of conditions that may

present similar symptoms of a heart attack such as a pocket of air trapped between

the layers of the lungs (pneumothorax).

Another imaging technique used is called an echocardiogram (see section 2.2.3).

In this procedure, sound waves are used as its modality for generating images of the

heart. This procedure can help identify areas of the heart that have already been

damaged and their corresponding effects on heart function.

Meanwhile, coronary angiography is a minimally invasive procedure (see section

2.2.4). It involves inserting a thin tube (catheter), into one of the blood vessels in the

groin or arm. A special fluid, called a contrast agent, is then pumped into the catheter

which is a form of material that is highly visible when viewed through an x-ray. With

3
Ateneo de Zamboanga University

this, the vision of the flow of the fluid along the blood vessel or arteries allows the

identification of specific sites of blockage and narrowing.

Lastly, an electrocardiogram (ECG) is the measurement of the electrical activity of

the heart which is shown as a signal (see section 2.2.5). Any abnormalities that occur

within the heart reflect upon its electrical activity or ECG. With this, confirmation of an

ongoing heart attack can be provided.

ECG also extends to ambulatory applications; the specific device used for this is

called a Holter monitor (Mayo Clinic, n.d.). This mainly functions as a recording device

that stores the ECG reading continuously from a patient extending from 24 to 48 hours

of use. Another similar ambulatory device is the cardiac event monitor. It works

similarly to the Holter device but is used for longer periods of time (Cleveland Clinic,

2022). Both the Holter and event monitors are mainly used for the detection and

monitoring of arrhythmias.

Overall, IHD remains a common problem up to this day, and heart attack is an

unavoidable risk. Health advocates encourage risk assessment, incorporating healthy

lifestyle changes, and using medication as the most common and only available

preventive measures against it. Furthermore, diagnostic tests for heart attacks can

only be accomplished while inside the hospital. Not to mention, heart attack detection

mainly uses known symptoms as indicators, which can be limited in cases such as

silent ischemia.

4
Ateneo de Zamboanga University

1.2 Problem Statement

Considering the concerns stated in Section 1.1, the proponents recognize a

gap among the objective-based approaches in detecting heart attacks; First, none of

the mentioned methods offer portable real-time detection of heart attacks that can

extend services outside the vicinity of the hospital. Providing a real-time detection

approach that can be carried out during everyday activities is relatively important since

heart attacks can occur anywhere and anytime. Second, real-time detection can serve

as a pre-diagnostic tool resulting in lessened diagnostic time. This provides an

opportunity for early diagnosis and treatment which in turn, decreases the chances of

death and complications presented by heart attack to the victim. Third, real-time

detection addresses the dependence on symptoms for heart attack detection by using

objective-based parameters such as ECG. With this, subjectivity won't be a factor in

making assumptions about heart attack occurrences. Lastly, real-time detection can

help in reducing the response time in addressing heart attack victims. This can help

decrease the chances of further damaging the heart and increase the chances of

survival. The statements provided are further supported by the component problems

presented below.

1.2.1 Reliability on observation of symptoms in heart attack

A heart attack is assumed when a person showcases known symptoms

such as chest pain, pain that spreads to the arms, neck, jaw, or back, heaviness

in the chest, nausea, shortness of breath, and lightheadedness (Mayo Clinic,

2021). Among the symptoms provided, chest pain is considered the hallmark

5
Ateneo de Zamboanga University

of an impending heart attack (Aref, 2022). In line with this, seeking medical

attention is highly recommended for any suspicion of experiencing a heart

attack. However, according to the study by Mol et al. (2018), most patients who

displayed suspicion of having a heart attack were ruled out as non-cardiac

related. They have noted that of the 1,239 patients, around 60% referred to

emergency rooms for chest discomfort were released with non-cardiac chest

pain (NCCP). They have also stated that NCCP patients consume considerable

medical resources, which, in accordance, emphasizes the need for a good

prognosis to minimize unnecessary hospitalizations.

On the other hand, SCAI (2015) states that conditions that mimic heart

attacks exist. Examples include broken heart syndrome and musculoskeletal

pain. Broken heart syndrome induced chest pain due to a burst of stress

hormones because of severe emotional and physical trauma. Meanwhile,

musculoskeletal aches can exhibit chest pain due to a simple pulled chest

muscle. Accordingly, some psychological disorders may also cause similar

symptoms to heart attacks, such as panic disorders, anxiety, depression, and

emotional stress. Other examples of conditions also include angina,

esophageal spasm and pulmonary embolism.

Cases of misdiagnoses are also common — this is especially frequent

among women. According to Feinglass and Sun (2021), in the first year after a

heart attack, women in the United States have lower survival chances than

men. Within five years, there is an expectation that 47% of women either die,

develop heart failure, or suffer from a stroke. They claim that for women under

6
Ateneo de Zamboanga University

55, doctors are more inclined to discount heart attack symptoms as unrelated

to the heart. In support of this, the study conducted by Maserejian et al. (2009)

states that the diagnosis of conditions in middle-aged female patients results in

the least amount of confidence. Their results suggest that most younger women

with coronary heart disease symptoms are taken as gastrointestinal and mental

health conditions — misdiagnosis, such as this, can potentially lead to delayed

treatments. Furthermore, according to the study conducted by the Ross et al.

(2016), among the analyzed 1,180 claims against their internal medicine

physicians that closed from 2007–2014, 39% account for incorrect, delayed,

and failure in diagnosis — the most allegations, accounting for 6%, were related

to myocardial infarction incidents.

Moreover, heart attacks can occur with no symptoms, known as silent

ischemia (American Heart Association, 2015). This type of heart attack

provides cardiac damage, as a non-silent heart attack does, but with little to no

awareness on the victim's part. According to Mayo Clinic (2022), silent heart

attacks are only identifiable with diagnostic exams such as echocardiograms

and ECG. Gul and Makaryus (2019) state that the absence of pain in this

condition increases the risk of death and morbidity, given that patients do not

seek treatment on time. They have also emphasized the need for a

comprehensive diagnosis and treatment of patients with silent myocardial

infarction because they have a higher risk of developing new coronary events

than those without silent ischemia. One of the examples of coronary events

associated with silent myocardial infarction is sudden cardiac death. According

7
Ateneo de Zamboanga University

to Vähätalo et al. (2019), among the 5869 individuals who experienced sudden

cardiac death, the majority, around 42.4%, have experienced silent myocardial

infarction.

1.2.2 Unpredictability of heart attack

Atherosclerosis develops two types of plaque: a stable plaque and an

unstable plaque (Heart Research Institute, n.d.). From the name itself, stable

plaque stably builds over time, while unstable plaque builds over time but with

a degree of instability. Unstable plaque is considered the most dangerous and

challenging to address among the two.

Unstable plaques, also referred to as vulnerable plaques, are frequently

identified by their thin, inflamed, fibrous cap covering a huge lipid core

(Fishbein, 2010). Plaques of this type are considered dangerous because they

are prone to rupture and can happen suddenly. Upon rupture, it can lead to

thrombosis or blood clotting, leading to complete blockages of blood flow and

the occurrence of a heart attack or stroke. According to the Cardiosound (n.d.),

less than 20 percent of heart attacks are caused by severe obstruction of

plaque, 86 percent are due to vulnerable plaques that moments ago were

harmless but all of a sudden cause complete blockage upon rupture. That

means 86% of heart attack victims can pass their stress test the day before the

incident of a myocardial infarction occurs.

According to Hafiane (2019), approximately 70% of all cardiovascular

events are due to plaque developments, and the current clinical approach does

not provide accurate predictions of those prone to acute ischemic events. In


8
Ateneo de Zamboanga University

support of this, the study conducted by Fishbein (2010), using angiographic

data, has shown that the sites at which vulnerable plaques have ruptured

exhibited less drastic or substantial narrowing. However, upon further review,

it was found that more than 50% of the plaques considered had greater than

75% cross-sectional area stenosis. It is one of the main contributing factors to

why vulnerable plaques are unpredictable.

1.2.3 Cruciality of early diagnosis

As mentioned in section 1.2.1, heart attack detection is made via

observations of common symptoms such as chest pain. According to Xu (n.d.),

these kinds of symptoms showcase when significant narrowing (>70%) of the

arteries takes place. A heart attack, on the other hand, occurs when 100%

narrowing of the artery has been acquired (Ahmed, 2014). In line with the

blockage, little to no oxygen-rich blood is supplied to the heart, which, when left

untreated, can progress to cardiac damage, and certain complications may

occur (American Heart Association, 2016). Arrhythmia, heart failure,

cardiogenic shock, and heart rupture are some of the complications post-heart-

attack presents in which the majority require extensive treatment (NHS, 2019).

Heart attacks are also considerably costly, not just in terms of health but

also financially and mentally. According to Pierce (2021) from the Preventive

Diagnostic Center, aside from the hospital stay, other treatments involve the

use of medications, rehabilitation, physical and occupational therapy, nutrition

counseling, and regular bloodwork and monitoring, which can extend for

months or years. In terms of mental health, patients who experience heart


9
Ateneo de Zamboanga University

attacks are prone to depression. According to Williams (2011), in the general

population, depression is three times more common in heart attack victims

accounting for around 15-20% qualifying for a diagnosis of major depressive

disorder. Additionally, the emotional distress and suffering caused by a heart

attack may not only cause depression but can also lead to an increased risk of

another possible occurrence of heart attack over the next few months or years.

Aside from depression, Hashim et al. (2022) also stated that victims who

experienced myocardial infarction also have a relatively high association with

developing high anxiety levels.

In line with this, the emphasis on early diagnosis is crucial. According to

Vogel et al. (2019) and Gong et al. (2020), early diagnosis of heart attack is an

essential factor, given that it is crucial in improving outcomes, such as limiting

post-STEMI complications and early provision of medical care.

1.2.4 Cruciality of fast response time

In addressing heart attacks, especially in cases of sudden occurrence,

response time is a crucial factor needed to be taken into account. According to

Genesis Heart Institute (n.d.), the more time wasted, the more damage is

presented to the heart, and the more fatal it becomes — "During a heart attack,

lost time means lost heart muscle."

With this, the 2013 ACCF/AHA Guideline for the Management of ST-

Elevation Myocardial Infarction provided an ideal timeframe for addressing

heart attacks called the door-to-balloon time (O'Gara et al., 2013). The door-to-

balloon time is the time between the arrival of a patient with STEMI in the
10
Ateneo de Zamboanga University

emergency room and the application of recommended reperfusion therapy

called percutaneous coronary intervention, ideally within 90 minutes (Butt et al.,

2020). Reperfusion therapy is any form of procedure used to restore blood flow

through a suspected or known coronary artery that is blocked; procedure

includes intravenous thrombolysis, primary angioplasty, intracoronary

thrombolysis, or immediate coronary artery bypass grafting surgery.

Moreover, according to Menees et al. (2013), patients with a door-to-

balloon time of 90 minutes or less had a lower unadjusted mortality rate than

those with longer wait times. Additionally, Alizadeh et al. (2020) state that

adding early diagnosis and telecardiology, which is a modern medical practice

that uses telecommunications for remote diagnosis and treatment of heart

disease, can significantly reduce door-to-balloon time in STEMI patients. They

have also concluded that it can influence short-term and long-term mortality

rates.

On the other hand, according to Khowaja et al. (2021), total ischemic

time holds much more significance than door-to-balloon time. Total ischemic

time is represented by the time from the onset of the heart attack until treatment,

such as reperfusion. According to Denktas (2011), there is a strong correlation

between infarct size and mortality concerning total ischemic time and much less

with door-to-balloon time.

11
Ateneo de Zamboanga University

1.3 Conceptual Design

The current methods of heart attack detection primarily use symptoms as an

indicator of a heart attack. While diagnostic methods can also detect heart attacks,

they are only accessible upon hospital visitations. In both cases, silent ischemia is not

accounted for, and there are no methods that offer portable real-time heart attack

detection. With this, it can be said that there is a need for objective-based devices for

real-time heart attack detection that is portable. Hence, the proponents suggest the

development of a Portable Heart Attack Alert System (PHAAS).

Mainly, this suggested device will be designed to be a portable and wearable

device wherein users can carry it along with their day-to-day activities. A machine-

learning algorithm will be incorporated into the device which will provide the capability

to automatically detect heart attack occurrences, specifically STEMI. This feature

ensures the early preliminary diagnosis of heart attack and will be supported by the

intermittent monitoring of clinicians who will access, review, and confirm diagnosis

upon hospital visitation. Furthermore, considering the cases of unpredictable and

silent heart attacks, detection will be done in real-time. Additionally, to further ensure

the reliability of detection, an objective-based method, particularly with the use of

ECG, will serve as the basis for heart attack detection. The suggested PHAAS device

will also be incorporated with an alert system to allow fast response time in addressing

heart attack detected. Moreover, this can ensure the opportunity of providing early

diagnosis and treatment when needed.

Overall, this device will be composed of six modules: the acquisition and signal

processing unit, a data analysis module, a storage unit, a display system, an alert

12
Ateneo de Zamboanga University

system module, and lastly, a power source. The conceptual design of the suggested

design is provided in Figure 1-1.

Figure 1-1. Conceptual Design of Portable Heart Attack Alert System

The acquisition and signal processing unit will be responsible for the acquisition

and pre-processing of the acquired ECG data. In acquiring the ECG, three electrodes

following the chest lead II placement will be used. This setup provides the view of the

ECG reading within the angle of lead II, which observes the heart from an angle of 60

degrees (ACLS, n.d.). With this, STEMI is detectable when the ST-elevation is

displayed from the ECG. Additionally, an analog-to-digital converter will be used for

the conversion of analog ECG data into digital. Upon collection, 2500 samples are

expected per acquisition.

13
Ateneo de Zamboanga University

On the other hand, the pre-processing techniques involve the use of digital

filters and feature extraction methods. For digital filters, a bandpass filter will be

applied to ensure that the frequency ranges involved in the signal is within frequency

range. In terms of random noises, a moving average filter will be used. And lastly, a

median filter will be provided for removing the baseline wander. Regarding feature

extraction, continuous wavelet transforms, power spectral density, and synthetic

features will be used.

Concerning the data analysis module, a simple binary classification machine

learning algorithm will be designed. The chosen model to be used is the support vector

machine which will be trained for classifying STEMI and normal ECG.

In terms of the storage unit, it will be responsible for storing ECG data which

are namely the raw and filtered data, features, and the predicted ECG class. These

data are stored locally within the device and will be used by clinicians to further review

and diagnose the involved user. This can be done by manually accessing the local

storage upon hospital visits which is advised to be done weekly. Furthermore, future

technicians, and currently, the proponents can utilize the records for the evaluation of

the pre-processing techniques. The data can also be used to further training and

enhancement of the machine learning algorithm.

The display module, on the other hand, mainly serves to provide the ECG

status for user awareness via text display. There will only be two ECG statuses that

can be presented, which will be displayed depending on the result of the data analysis

module. If the data analysis module detects STEMI within the ECG, “STEMI detected”

will be provided. Meanwhile, if there is no detection of STEMI, “Normal” will be shown

14
Ateneo de Zamboanga University

on the screen. The main purpose of this module is to provide user awareness,

especially for possible cases of silent myocardial infarction.

Moving on to the alert system module, it will be responsible for sending

automated notifications regarding the ECG status of the us er. This will be done

particularly when heart attacks, specifically STEMI has been detected.

Communication means will be via SMS and voice calls wherein contacts include the

user and clinicians. In line with the notification, the clinician is expected to

communicate with the user and provide advice regarding what to do with their

situation. In terms of sending notifications to the user, this serves as a second layer in

ensuring user awareness is provided.

Lastly, the battery module serves as the power source of the PHAAS. This will

mainly provide power to secure functionality for each of the modules involved. Utilizing

a battery, specifically a power bank, allows the device to be portable.

1.4 Objectives

In this section, the general and specific objectives of the study are provided.

1.4.1 General Objective

This study aims to develop a Portable Heart Attack Alert System

(PHAAS); a real-time, pre-diagnostic heart attack (STEMI) detection device for

patients with ischemic heart disease.

1.4.2 Specific Objectives

More specifically, this study aims to:

15
Ateneo de Zamboanga University

1.4.2.1 Acquire real-time ECG equivalent of 2500 samples from the

user using three disposable electrodes following Chest Lead II

Placement with a sampling rate of 250Hz.

1.4.2.2 Pre-process ECG signal acquired through application of digital

filters and extraction of features.

1.4.2.2.1 Design bandpass filter, moving average filter, and

median filter for cleaning the ECG signal.

1.4.2.2.2 Extract continuous wavelet transform, power spectral

density, and synthetic features.

1.4.2.3 Design and train with the use of European ST-T database, a

Support Vector Machine model that can classify STEMI and normal

ECG with a target of at least 90% k-fold accuracy.

1.4.2.4 Design an alert system that can automatically send notifications

via SMS and voice call to designated contacts such as clinicians and

the user upon detection of STEMI.

1.4.2.5 Record and store acquired ECG data including filtered data and

features extracted.

1.4.2.6 Display the ECG status of the user using an LCD screen.

1.5 Scope and Delimitations

This study is limited to developing a portable heart attack alert system — an

automatic, real-time, pre-diagnostic heart attack detection device for individuals with

ischemic heart disease.

16
Ateneo de Zamboanga University

The device will mainly use a trained machine learning model, namely Support

Vector Machine. This model is only capable of binary classification wherein it can only

classify ST-elevated and normal ECGs. Furthermore, in training and testing the SVM,

an online open-sourced database, namely the European ST-T Database, will be used.

Moreover, the acquisition of ECG will be done using three disposable

electrodes following the chest lead II placement where ECG acquired is up to 2500

samples. In terms of the application of digital filters, a bandpass, moving average, and

median filters will be used. Regarding feature extraction, continuous wavelet

transforms, power spectral density, and synthetic features will be utilized.

In terms of the alert system module, automatic contact or sending of

notifications will only be done when STEMI is detected. Communication means are

via SMS and voice calls only, in which content only provides ECG status along with

date and time. The designated contacts considered are the user and an involved

clinician.

Regarding the storage of ECG data, it will be saved within the local storage of

the device which is the micro-SD card. It is where the data are accessed manually by

the clinicians which can be acquired during hospital visits by the user. There will be

specifically four types of data to be saved: raw data, filtered data, features, and the

predicted ECG class.

For the display of ECG status via the LCD screen, only two outputs will be

shown. If STEMI is detected, “STEMI detected” is displayed; if not, “Normal” will be

displayed. These statuses will only be shown via text. Additionally, a power bank will

17
Ateneo de Zamboanga University

be used as the power source of all integrated components. It is estimated to last for

approximately six hours upon continuous use.

Moreover, this study excludes addressing other cardiac events and only

focuses on providing detection for heart attacks, specifically ST-elevation myocardial

infarction only. Additionally, the device will mainly be used as a real-time, pre-

diagnostic device; the diagnosis is still yet to be conducted and confirmed by medical

professionals.

Regarding the application of beta testing, it must be noted that the participants

considered are in good health conditions. Testing the capability of the device in terms

of detecting STEMI will only be limited via the use of testing data acquired from online

databases and the use of an ECG simulator. The proponents opted for this given heart

attack is a critical condition that can be fatal; it cannot be voluntarily induced.

Additionally, the sole purpose of beta testing is to only test the user acceptance of the

device mainly in terms of portability and comfortability.

To determine the machine learning’s capability, exposure to new set of data is

conducted. The evaluation will be done using the system and beta testing data. This

test is solely to determine the extent the machine learning model can perform

accordingly.

1.6 Significance of the Study

The results of the development of the Portable Heart Attack Alert System

(PHAAS) would be significant for the following:

18
Ateneo de Zamboanga University

Individuals who are at risk of heart attacks

The most who will benefit from this study are the people who are prone

to experiencing heart attacks, such as those diagnosed with ischemic heart

disease. The device will serve as a safety net that will decrease the risk of

subjects suffering from the repercussions of experiencing heart attacks, such

as various health complications, expensive treatments, and death. The quality

of life would also be significantly improved by reducing anxiety, worry, and

stress, given that a device can be relied upon to detect unpredictable heart

attacks objectively.

Family of individuals susceptible to heart attacks

Similar to those who are prone to experiencing heart attacks, family

members would also greatly benefit from it. The device will provide ease and

reduce psychological stress knowing that the family member concerned has a

device they can rely on in an emergency, specifically when a heart attack

occurs.

Healthcare Providers

The study provides the development of a device that can lessen the

workload of medical professionals, given that the device is designed to provide

continuous remote monitoring. With this, fewer trips will be required when

visiting the hospital, and face-to-face contact for diagnosis is also limited, which

is especially important regarding today’s pandemic. Transactions and

19
Ateneo de Zamboanga University

diagnoses with a medical professional can also be made online, given that the

ECG data is stored and accessible within the device.

The PHAAS also incorporates an alert system that ensures fast

response by immediately sending a notification when a heart attack is detected.

This allows required medical attention to be provided as soon as possible,

which is ideal on any occasion of a heart attack happening.

Proponents of the Study

This study allowed the proponents to study a topic of great interest. Not

to mention, doing this paper allowed the proponents to develop their critical

thinking and writing skills further.

Future Researchers

The academic community can use this study as a reference, particularly

researchers working on heart attacks and heart attack-related devices. This

study can also guide further improvements with the device developed, such as

the hardware and software components. In terms of the machine learning

algorithm created, future researchers can use it as a basis for an improved

version covering a broader scope of heart diseases.

20
Ateneo de Zamboanga University

CHAPTER II
REVIEW OF RELATED LITERATURE

2.1 Current Preventive Methods for Myocardial Infarction

This section lists and discusses the current prevention methods for IHD, and

myocardial infarction as stated in the 2019 Primary Prevention of Cardiovascular

Disease guidelines. A list of local and international programs that advocate for cardiac

health is also included.

2.1.1 Risk Assessment

Risk assessment is the estimation of a person developing blockages in

their arteries (American College of Cardiology, 2019). It is considered crucial

given that blocked arteries can ultimately lead to a heart attack or stroke, which

can be fatal. The risks are determinable with the use of the tests listed below

(Medline Plus, n.d.).

2.1.1.1 Measuring Blood Pressure Level

Blood pressure is the force of blood that pushes against the walls

of the arteries each time the heart pumps blood (Medline Plus, 2020).

Accordingly, if the blood pressure remains high for a long time, it could

lead to serious health problems, such as heart attacks. According to

American Heart Association (2022), a heart attack occurs due to the tear

high blood pressure causes to the arteries. With this, LDL (bad)

cholesterol accumulates on the tear, where blockages develop on-site,

21
Ateneo de Zamboanga University

resulting in a possible heart attack. A heart attack is determined if the

systolic pressure exceeds the normal value of 120 and the diastolic

pressure of 80. The higher the blood pressure, the more dangerous it

becomes. Checking for blood pressure is done using a gauge, a

stethoscope or electronic sensor, and a blood pressure cuff. Treating

high blood pressure, on the other side, includes healthy lifestyle changes

and medications.

2.1.1.2 Measuring Cholesterol Level

Cholesterol is a fat-like substance found in all the cells in the body

(Medline Plus, 2020). To produce hormones, vitamin D, and to properly

digest food, the body needs cholesterol. It can either be produced by the

body or obtained through food.

There are three known types of cholesterol: HDL (high-density

lipoprotein), LDL (low-density lipoprotein), and VLDL (very low-density

lipoprotein). HDL is considered “good” cholesterol because it provides

proper delivery of cholesterol, from other parts of the body to the liver.

The liver will be removing the cholesterol from the body. On the other

hand, LDL and VLDL are considered “bad” cholesterol because high

levels can lead to plaque build-up in arteries. The build-up of plaque can

cause the development of IHD which can potentially lead to a heart

attack. A blood test can be taken to determine an individual’s cholesterol

level. Overall, the higher the LDL and VLDL level, and the lower the HDL

level, the more at risk the heart becomes. Healthy lifestyle changes such

22
Ateneo de Zamboanga University

as a healthy eating plan, weight management, regular physical activity,

and medicines can help reduce cholesterol levels.

2.1.1.3 Measuring Blood Sugar Level

Blood sugar level (also known as glucose) is a major source of

energy for most of the cells in the body. While fasting, the normal blood

glucose ranges from 70 to 99 mg/dL (3.9 to 5.5 mmol/L), and cases that

exceed the normal range could indicate pre-diabetes or diabetes

(Cleveland Clinic, 2018). Concerning this, individuals with high blood

sugar levels, especially those already diagnosed with diabetes, are

prone to developing heart diseases and heart attacks. This is because

high blood sugar concentration can damage blood vessels nerves that

control the heart and increase their risk of developing risk factors

(National Institute of Health, 2021). Such risk factors include high blood

pressure and high “bad” cholesterol levels that doubles the likelihood of

experiencing a heart attack (Center and Disease Control and

Prevention, 2022). Keeping the blood sugar level in check is one way of

keeping heart health in good condition which can be kept track via blood

sample tests (MedlinePlus, 2022).

2.1.1.4 Risk Calculators

Risk calculators are screening tools used to determine the risk or

likeliness of an individual to develop a heart disease in the next 10 years

(Medline Plus, n.d.). Accordingly, results are calculated using

23
Ateneo de Zamboanga University

information from clinical studies on heart disease and are expressed as

percentages. The likelihood of developing heart disease is low if the risk

calculator's percentage is low. However, a high percentage indicates a

high risk of development. Examples of risk calculators are the ACC/AHA

cardiovascular risk calculator, ASCVD (atherosclerotic cardiovascular

disease) risk calculator, Reynolds Risk Score, and Framingham General

CVD Risk Profile. The mentioned test calculators can either be used

individually via online, or, with the help of a medical practitioner.

Furthermore, the assessment includes answering questions related to

health and other considered parameters such as gender, height, weight,

blood pressure, cholesterol levels, activity level, and diet.

2.1.2 Lifestyle Changes

Improving overall health is one of the best ways to avoid cardiovascular

disease. This can be achieved by incorporating healthy lifestyle changes

extending from healthy diets, being physically active, and avoidance of

unhealthy habits (Mayo Clinic, 2022).

2.1.2.1 Healthy Diet

A healthy heart is achievable through a healthy diet as it can

improve blood pressure, cholesterol, and blood sugar levels, reducing

the risk of heart disease development (Mayo Clinic, 2022). Eating foods

such as fruits, vegetables, beans, legumes, lean meat, fish, low-fat or

dairy foods, whole grains, and healthy fats is highly recommended. On

24
Ateneo de Zamboanga University

the other hand, limiting the intake of salt, sugar, processed

carbohydrates, alcohol, saturated fat, and trans-fat is essential.

Furthermore, specific dietary plans that are heart-friendly are also

recommendable such as the Dietary Approaches to Stop Hypertension

(DASH) and the Mediterranean diet.

2.1.2.2 Regular Exercise

Regular physical activity can also help reduce the risk of having

a heart attack (Mayo Clinic, 2022). It can also reduce the risk of other

conditions such as high blood pressure, high cholesterol, and type 2

diabetes, which are all critical factors in developing heart diseases.

Experts advise regular exercises such as walking, swimming, and

cycling for at least 150 minutes a week or at least 10-minute bursts of

activity within a day. (American College of Cardiology, 2019).

2.1.2.3 Healthy Weight

Obesity is generally associated with high cholesterol, high blood

pressure, and an increased risk of heart diseases and stroke.

Maintaining a healthy weight can help in preventing heart disease as

being overweight, especially around the middle of the body, can

increase the chances of having high blood pressure, high cholesterol,

and type 2 diabetes (Mayo Clinic, 2022). The body mass index (BMI) or

measuring belly fat are two ways of determining whether a patient is

overweight or obese as they are generally associated with high

25
Ateneo de Zamboanga University

cholesterol, blood pressure, and an increased risk of heart disease and

stroke. Losing weight by 3% to 5% can help in decreasing certain fats in

the blood, lowering blood sugar, and reduce the risk of having type 2

diabetes.

2.1.2.4 Avoid Smoking

According to the Centers for Disease Control and Diseases (n.d.),

chemicals used in cigarettes can cause blood to thicken and form clots

in veins and arteries, which may result in a heart attack and sudden

death. Moreover, the damages smoking can do to the body can be

extensive such as: raising triglycerides, making blood sticky, damaging

blood vessel cells, increases build-up of plaque, and causes thickening

and narrowing of blood vessels (Centers for Disease Control and

Diseases, 2022).

2.1.2.5 Stress Management

Stress can be helpful to an extent, but excessiveness can affect

an individual's overall well-being, especially with their cardiovascular

health (American Heart Association, 2020). Long-term stress results in

a high level of cortisol, which according to the University of Rochester

Medical Center (n.d.), can increase cholesterol, triglycerides, blood

sugar, and blood pressure levels. Additionally, it may also cause poor

blood flow and thickening of the blood. Healthy stress management

26
Ateneo de Zamboanga University

habits, such as physical activity, relaxation exercises, or medication, can

help reduce stress and improve one's health (Mayo Clinic, 2022).

2.1.2.6 Good Quality Sleep

Sleep deprivation is associated with increased risk of heart

attack. Sleeping less than six hours increases the chance of a heart

attack by 20% (Daghlas et al., 2019). Furthermore, according to Suni

(2022), sleep disruptions also increase the risk of heart attacks.

Frequent interruptions can lead to cardiac stress, which may lead to a

heart attack because both heart rate and blood pressure spikes abruptly

upon unexpected awakening. Building a consistent sleeping schedule,

with at least seven hours of sleep every day is recommended for better

heart health (Mayo Clinic, 2022).

2.1.3 Medications

One fundamental approach to preventing and treating a heart attack is

medications (Mayo Clinic, 2022). This section lists and discusses the common

medications used to lessen the risk of heart attack by targeting parameters that

risk its development. The indicated medications are acquired from the Heart

and Stroke Foundation of Canada (n.d). It is important to take note that while

most of these medications are similar in function, they come with their own use

cases, risks, and specific instructions that healthcare providers give to the

patient.

27
Ateneo de Zamboanga University

As stated in section 2.1.1.1, high blood pressure is a considered risk

factor that can contribute to heart attack. The medications for addressing high

blood pressure include ACE inhibitors, which reduce the risk of heart attack by

opening blood vessels. Specifically, it will make the heart pump easier, lower

blood pressure, protect the heart and blood vessels, and protect the kidneys

for people with diabetes or kidney disease. Aldosterone Antagonists, also

known as aldosterone receptor blockers, are diuretics or “water pills” used to

treat high blood pressure and heart failure. Angiotensin Receptor Blockers

(ARB) treat blood pressure and heart failure by blocking the action of the

enzyme that narrows blood vessels, called Angiotensin II. Beta-blockers, also

known as beta-adrenergic blocking agents, treat heart attacks, angina, high

blood pressure, heart failure, and arrhythmia and protect the heart from stress

and abnormal heartbeats. It does this by lowering the heart rate and blood

pressure resulting in a lesser workload. Lastly, Calcium Channel Blockers

(CCBs), also known as calcium channel antagonists, are vasodilators that help

control high blood pressure and chest pain caused by heart disease and

arrhythmia. Patients taking this medication usually take other medications,

such as beta-blockers or diuretics.

High cholesterol level is another considered risk factor that can

contribute to developing heart diseases and potential occurrence of heart

attack. The following are the known medications that address it: Cholesterol

absorption inhibitors help lower the overall cholesterol level in the blood by

reducing the amount of cholesterol stored in the liver and improving how

28
Ateneo de Zamboanga University

cholesterol is cleared from the blood. Fibrates, also known as Fibric Acid

Derivatives, treat high cholesterol by lowering triglyceride levels, reducing the

bad cholesterol, and increasing the good cholesterol in the body. Similarly,

Niacin, also known as nicotinic acid, treats high cholesterol by slowing down

the liver's production of bad cholesterol and increasing the good cholesterol in

the body as well. Resins treat high cholesterol by tricking the body into

producing more bile using cholesterol. With more cholesterol being used to

create more bile (which passes in stool), it results in less bad cholesterol in the

blood. Lastly, Statins help lower the long-term risk of having a heart attack by

preventing plaque from building up in the arteries and preventing existing

plaque from getting worse.

Blood clots, caused by ruptures of plaque, can eventually lead to a heart

attack. There are only two medications used in treating blood clots:

Anticoagulants, also known as blood thinners, help reduce the risk of

developing blood clots by preventing existing clots from getting bigger. When

taking this medication, patients should expect regular blood tests to check that

their blood is not too thin (which can cause bleeding) or too thick (which can

lead to clots). Antiplatelets can also be taken for anti-blood clotting. They are

taken mainly by patients who had a cardiac event. When platelets rush to a

wound when someone gets a cut, it makes the blood sticky as they bind

together and form a clump to help stop the bleeding. This leads to blood clots,

clogged arteries, heart attack, or stroke. Antiplatelets counter this by making

29
Ateneo de Zamboanga University

the blood less sticky, preventing arteries and stents from being plugged by

clots.

2.1.4 Health Programs and Advocacies

According to the Institute of Medicine (2010), one of the certain actions

that needs to be executed to address global cardiovascular disease is the

implementation of advocacy and leadership at global and national levels. In line

with these, international and local advocacies for preventing cardiovascular

disease, including heart attack and stroke are listed below.

2.1.4.1 HEARTS

The HEARTS technical package developed under the Global

Hearts Initiative led by WHO and the US Centers for Disease Control

and Prevention provides a strategic approach to improving

cardiovascular diseases in countries. It supports ministries of health to

strengthen CVD management in primary healthcare settings (World

Health Organization, 2020). It comprises six modules: Healthy lifestyle

counseling, evidence-based treatment protocols, access to essential

medicines and technology, risk-based CVD management, and team-

based care. With these six modules comes an implementation guide that

provides a strategic approach to improving cardiovascular health in

countries.

30
Ateneo de Zamboanga University

2.1.4.2 Million Hearts

Million Hearts is a national initiative that began in 2012 with the

purpose of "saving more of the lives taken and protecting more of the

lives impacted by heart disease and stroke in the United States" by

averting one million preventable cardiovascular diseases (CVD) events

in the next five years (Million Hearts, n.d.). It is co-led by the Centers for

Disease Control and Prevention (CDC) and the Center for Medicare and

Medicaid Services (CVS). The main priorities of this initiative are to build

healthy communities, optimize care, and focus on health equity.

2.1.4.3 WISEWOMAN

The Well-Integrated Screening and Evaluation for Women Across

the Nation, also known as WISEWOMAN, is a program that allows

qualifying women (with low income, uninsured, underinsured, and aged

40 to 64 years) to receive free screenings and counseling about their

risk for heart disease and stroke (Centers for Disease Control and

Prevention, 2022). Additionally, these women are also supported to

participate in evidence-based lifestyle programs, individual health

coaching, or referred to other community resources. From the year 2008

to 2013, this program served almost 150,000 women, with 91% having

at least one risk factor of heart disease or stroke, which led to almost

101,000 women participating in a healthy lifestyle service to reduce the

risk of heart disease and stroke.

31
Ateneo de Zamboanga University

2.1.4.4 Philippine Heart Association Advocacies

The Philippine Heart Association (PHA), established in 1952, has

the mission of ensuring compassionate and quality cardiovascular care

(Philippine Heart Association, n.d.). Along with their programs and

campaigns, are eight advocacies which aim to improve cardiovascular

health. Advocating for healthier habits, the PHA released vibrant and

entertaining education videos about the “Let’s Do 52100 Daily!”

movement which can be played in gatherings and events (Philippine

Heart Association, n.d.). These healthy habits include having five

servings of fruits and vegetables, two hours of screen time, one hour of

moderate physical activity, zero sugary or sweetened beverages, and

zero smoking or secondhand smoke. In relation to the 52100

advocacies, the PHA launched a campaign called “Sneakers Friday''

which, according to David D’Angelo (2018), promotes physical activity

in the workplace by encouraging personnel to wear sneakers, casual

tops and pants every Friday as a “dress down day.” A similar campaign

launched by the PHA called Fit Heart Minute, also advocates for physical

activity (Philippine Heart Association, 2018). According to the creator of

FhM, Doc Nannette, “It is a practical alternative for people who are not

capable of walking 10,000 steps a day as what Sneaker Friday requires.”

Advocating for being CPR ready, the PHA launched Save a Life, Learn

CPR (Philippine Heart Association, n.d.). It is a basic life support and

advanced cardiac life support training program which comes in the form

32
Ateneo de Zamboanga University

of a refresher course held virtually. In order to provide remote referral

and diagnosis of patients suspected of ST Elevation Myocardial

Infarction (STEMI), the PHA launched the mobile application

STEMIConsult which is available for free in the Apple Play Store and

Google Play Store (Philippine Heart Association, n.d.). Other

advocacies launched by the PHA include Pusong Pinay which is an

event about “The Heart Truth about Women,” World Heart Day which is

an event held every September 29, and the Angina Awareness Initiative

which spreads awareness about keeping angina under control.

2.2 Current Diagnostic Tests for Myocardial Infarction

Healthcare providers conduct diagnostic tests to check the heart's overall

health (Mayo Clinic, n.d.). This section lists and discusses the current diagnostic tests

for myocardial infarction.

2.2.1 Blood Test

According to Medical News Today (2021), doctors can determine

whether a person has experienced a heart attack through a blood test. This is

conducted by measuring the cardiac markers, known as troponin, that are

released by the heart during a heart attack. Troponins, most commonly

Troponin I and Troponin T, are released as early as 4 hours after a heart attack

making it an ideal marker for diagnosing a heart attack. It is important to take

note that doctors also perform other tests along with blood tests, as elevated

levels of troponin alone cannot solely indicate that a person had a heart attack.

33
Ateneo de Zamboanga University

This usually involves physical examination, asking for the patient's medical

history, and an evaluation of ECG. The level of troponin will indicate whether a

heart attack has occurred, along with its specific type; if there is an increase

from the normal range of 0–0.04 ng/ml, heart attack is considerable (Villines,

2022). Besides diagnosing a heart attack, other blood tests can be used to

diagnose and manage heart disease (Mayo Clinic, 2022). These blood tests

include cholesterol, high-sensitivity C-reactive protein, lipoprotein, and

natriuretic peptides tests.

2.2.2 Chest X-ray

According to NHS (2019), a chest X-ray can be used if diagnosis of a

heart attack is uncertain due to other possible causes of heart attack

symptoms, such as a pocket of air trapped between the layers of the lungs

(pneumothorax). It can also be used to check for complications caused by the

occurrence of a heart attack such as the build-up of fluid in the lungs

(pulmonary oedema). Besides diagnosing for the occurrence of heart attack,

chest X-rays can be used to reveal the condition of the lungs, heart-related lung

problems, the size and outline of the heart, blood vessels, calcium deposits,

fractures, postoperative changes, and medical devices inside the body, such

as a pacemaker, defibrillator, and catheter (Mayo Clinic, 2022).

2.2.3 Echocardiogram

According to NHS (2019), an echocardiogram is an imaging technique

that utilizes sound waves as its modality for creating images of the heart. This

34
Ateneo de Zamboanga University

procedure can help identify areas of the heart that have already been damaged

and their corresponding effects on heart function, such as those caused by

blocked arteries or heart attacks. There are several types of echocardiogram

tests, each with its use cases and risks, and will be conducted depending on

the information needed by the doctor (Mayo Clinic, 2021).

The most common type of echocardiogram test is the transthoracic

echocardiogram. This test is conducted by placing a transducer on the patient's

chest, recording the sound wave echoes in the heart, resulting in moving

images displayed on a monitor. In the case that the doctor needs clearer

images or there is difficulty in getting a clear picture with the transthoracic

echocardiogram, a transesophageal echocardiogram test is to be conducted.

This test involves sending a flexible tube down the throat and into the tube

connecting the mouth to the stomach before viewing it on a monitor. In the case

the doctor needs to check for blood flow problems and blood pressure in the

arteries in the heart, a doppler echocardiogram test is to be conducted. This

test is generally used along with transthoracic and transesophageal

echocardiogram tests. Lastly, a stress echocardiogram test is conducted to

check for coronary artery problems which only occur during physical activity.

This test is conducted by taking images of the heart before and immediately

after the start of the physical activity. In the case that physical activity is not an

option, medication delivered by injection will make the heart pump as hard as

with physical activity. The risk involved in this procedure is that it may cause an

irregular heartbeat which may cause serious complications, though rare.

35
Ateneo de Zamboanga University

After the procedure, people can resume normal activities (regardless of

the type), especially when the result is normal and further testing is not

required. On the other hand, doctors may require more tests if the results are

not normal.

2.2.4 Coronary Angiography

A coronary angiogram is an imaging procedure for checking heart blood

vessels (Mayo Clinic, 2021). This is conducted with the use of a dye that is

visible via X-ray, and an X-ray machine. During the procedure, a catheter is

inserted into the patient's artery, and the dye is injected into the catheter. As

the dye flows through the blood vessels, corresponding blockages, and

constricted areas are identifiable when viewed using X-ray. After conducting

the procedure, it should show how many coronary arteries are blocked or

narrowed, the location of these blockages, and the amount of blood flow

blocked. Due to the risk of complications, angiograms are conducted only after

noninvasive diagnostic tests, such as electrocardiogram or echocardiogram.

2.2.5 Electrocardiogram

An electrocardiogram (ECG or EKG) is a noninvasive test that acquires

the electrical activity of the heart. ECG can provide information about the

heart’s status and determine if there are underlying conditions such as

arrhythmias and coronary artery disease. Furthermore, ECG can also

determine if a person has experienced a heart attack (Mayo Clinic, 2022).

36
Ateneo de Zamboanga University

In general, the ECG is acquired through the use of sensors, which are

attached to the patient’s skin, and records the heart impulses with the use of

an ECG machine. There are three main methods in conducting ECG tests:

resting, stress, and ambulatory (NHS, 2021). Resting ECG is the acquisition of

ECG while the subject is at rest; no movement is involved. Stress ECG, on the

other hand, involves movement, where ECG is acquired after a strenuous

activity such as exercise. Lastly, ambulatory ECG, is acquiring ECG while the

patient is going through their normal day-to-day activities. The recording

devices used for this type of ECG are small portable machines such as Holter

and event monitors.

According to Mayo Clinic (n.d.), a Holter monitor is used to detect or

determine the risks of arrhythmias. It does this by continuously recording

electrical signals from the heart of the patient for one to two days. The patient

is expected to wear a Holter monitor for the entire duration of recording, even

while sleeping. They can do most of their daily activities unless their healthcare

provider tells otherwise. A form will also be given to record all daily activities

and symptoms such as pounding, fluttering, or skipped beats, shortness of

breath, chest pain, and lightheadedness. On the other hand, a cardiac event

monitor is for patients whose symptoms of arrhythmias do not happen that often

(Cleveland Clinic, 2022). There are four types of cardiac event recorders, each

with their own use cases and functionality: a patch recorder, symptom event

monitor, loop memory monitor, and implanted loop recorders. Cardiac event

monitors can be worn by a patient for up to a month which is ideal for recording

37
Ateneo de Zamboanga University

arrhythmias that do not happen every day. Just like the Holter monitor, the

patient is expected to keep track of their activities, the medications they are

taking, and symptoms that may occur when they are active for the entire

duration of using the device.

Furthermore, it is important to note the types of heart attacks ECG can

detect. There are namely three: ST-segment elevation myocardial infarction

(STEMI), non-ST segment elevation myocardial infarction (NSTEMI), and

unstable angina (Roland, 2020). ST-segment elevation myocardial infarction

(STEMI) is the most serious type of heart attack. It indicates a prolonged

interruption of blood supply within the heart caused by a complete blockage of

an artery, which can result in extensive damage to a large area of the heart.

NSTEMI heart attack, on the other hand, is a less serious condition than

STEMI. Instead of a completely blocked artery, the obstruction has only

partially developed, and a small section of the heart is damaged. When left

untreated, NSTEMI can progress to STEMI. Lastly, unstable angina is the least

serious type of heart attack. Blood supply is restricted, but no permanent

damage has yet been developed. When left untreated, it can progress to

NSTEMI.

2.3 ECG Signal Acquisition Methods

Before data acquisition, it is important to take note of the several electrode

placements for acquiring ECG. The first most used electrode placement is the 3-

electrode system which uses three electrodes placed on the right arm (RA), left arm

38
Ateneo de Zamboanga University

(LA), and left leg (LL) with the monitor displaying the bipolar leads (I, II, and III)

(Cadogan, 2022). The second most used electrode placement, the 5-electrode

system, is similar to the previous electrode placement. It also has electrodes placed

in the right arm, left arm, and left leg with an additional two electrodes placed on the

right leg (RL), and the chest (C). This placement will also display the bipolar leads (I,

II, III) and a single unipolar lead depending on the position of the chest lead. Lastly,

the 12-lead ECG placement uses a total of 10 electrodes with four electrodes placed

on all four limbs (RA, LA, RL, LL) and six electrodes on the precordium (V1 - V6). This

placement will allow for interpretation of the inferior (II, III, aVF), lateral (I, aVL, V5,

V6), and anterior (V1-V4) areas of the heart. Other electrode placements such as the

right sided ECG electrode placement, the V4R ECG lead placement, posterior leads,

the Lewis lead configuration, and the fontaine bipolar precordial leads are used for

recording specific ECG data required by the doctor.

In terms of acquisition methods used by existing studies, the study of

Chowdhury et al. (2022) uses dry electrodes as they are preferable in obtaining ECG

signals compared to wet electrodes because dry electrodes are reusable and non-

disposable. On the other hand, wet electrodes degrade over time since the gel present

dries as time passes which effectively increases the impedance and affects the overall

quality of the ECG signal derived. Additionally, regarding electrode placement, Chest

Lead II and Chest Straight Lead were suggested, given that they yielded a similar

quality comparable to clinical-grade ECG traces. In the study made by Gusev et al.

(2017), they used ECG clips to acquire the ECG signals. However, given that the

acquisition was made using an ECG simulation, it is not desirable for human

39
Ateneo de Zamboanga University

application. On the other hand, another method using a wireless, mobile, and

wearable ECG biosensor is another mode of ECG acquisition. Ahmed & El-Metwally

(2015) suggested this method to enable wireless transmission. The data transmission

between the wearable ECG sensor and the smartphone is via Bluetooth.

2.4 ECG Pre-processing Methods

Concerning the acquisition of ECG, the quality of the signal is an essential

consideration. Hence, preprocessing techniques are needed.

One of the many ways that can effectively remove noises from signals such as

ECG is digital filters. According to the method used by Chowdhury et al. (2019),

average moving filters and median filters are applicable. The average moving filter

removes the random noises and allows the smoothing of signals. On the other hand,

the median filter addresses the baseline wander — it fixes the ECG signal to be

consistent on the isoelectric line. In feature extraction, a quadratic time-frequency

distribution (QTFD) using an extended modified b-distribution (EMBD) kernel was

proven effective. This method has significantly contributed to achieving a 97.4%

accuracy for STEMI detection and 96.3% for NSTEMI detection using SVM machine

learning. In addition to the digital filters and feature extraction, biorthogonal wavelet

transformation was included for synthesizing ECG signals and labeling significant

events (such as R peak detection) from the data.

Another method of noise filtering is the use of simple DSP filters. According to

the suggested approach by Ahmed & El-Metwally (2015), two DSP bandpass filters

are enough. The first DSP bandpass filter takes the ECG signal that ranges from 5-20

40
Ateneo de Zamboanga University

Hz to reduce feature space. The other one uses a frequency range from 0.5-30Hz to

eliminate noises. Regarding feature extraction, the method suggested is the adaptive

differential technique, which can detect the R peak in the ECG signals. Accordingly,

additional morphological processes can be applied to detect QRS length, PQ, and ST

segments.

Furthermore, one of the widely used methods for ST-segment detection,

extraction, and analysis is wavelet transformation. According to Alharbey et al. (2021),

wavelet transform is applicable for feature extraction and can be combined with

statistical parameters such as standard deviation and Shannon energy for additional

features. Six combinations of the statistical parameter with the continuous wavelet

transform have been tested. The result suggests that the continuous wavelet

transform with standard deviation taken for the third sub-signal had been the most

suitable.

The wavelet transforms, specifically the discrete wavelet transform, is also

applicable for extracting the ST segment from the ECG (You et al., 2015). In this

approach, the use of empirical mode decomposition (EMD) for denoising of the ECG

signal is incorporated. The method is tested with real exercise ECG data acquired

using a twelve-lead ECG recorder. The results showed the feasibility of the approach,

and it has been emphasized that it is effective in ECG recordings heavily affected by

noises.

Moreover, discrete wave transform has also been demonstrated to be

applicable for denoising purposes. Using various DWT coefficients representing

41
Ateneo de Zamboanga University

specific frequency ranges, noises such as baseline wander and 60Hz line interference

was effectively filtered (Haddadi et al., 2017).

Another approach is with the use of fast continuous wavelet transformation

(fCWT). According to Art & Broek (2022), fCWT provides an improved signal analysis

balance between speed and accuracy. With this, a real-time, wide-band, high-quality,

time-frequency analysis of non-stationary noisy signals is possible. When the method

was tested, it was concluded that “fCWT is shown to have the accuracy of CWT, to

have 100 times higher spectral resolution than algorithms equal in speed, to be 122

times and 34 times faster than the reference and fastest state-of-the-art

implementations…”.

2.5 Machine Learning for Detection of Heart Attack

Machine Learning is a computer algorithm capable of analyzing and drawing

inferences from a set of data. The utilization of machine learning in addressing heart

attacks holds potential and is widely considered in research. Various machine-learning

approaches have been developed and tested in terms of detecting heart attacks.

In the study conducted by Chowdhury et al. (2019), they tested linear

classification and twenty-two machine learning algorithms. The machine learning

algorithms are namely three decision trees, two discriminant analysis, six support

vector machines (SVM), six k-nearest neighbors (KNN), and five ensemble classifiers

with the use of Massachusetts Institute of Technology-Beth Israel Hospital (MIT-BIH)

ST Change Database. Among all those tested, the two best algorithms identified were

SVM and KNN. To further improve the application of the algorithm, time, frequency,

42
Ateneo de Zamboanga University

and time-frequency domains were extracted. The methods involved are Wigner–Ville

distribution (WVD), Spectrogram (SPEC), and extended modified B-distribution

(EMBD). The best candidate that stands is the SVM algorithm with the EMBD method.

They showed the highest accuracies of 97.4% and 96.3% for detecting STEMI and

NSTEMI, respectively.

In another study conducted by Gupta et al. (2021), random forest, decision tree,

gradient boosting, and logistic regression machine learning algorithms were tested out

in detecting heart attacks. They utilized the datasets from the Framingham database

and UCI Heart repository. The most suitable algorithm was found to be gradient

boosting classifiers that yielded the highest accuracy, with an average percentage of

85.5%.

Logistic regression, naïve Bayes, decision tree, random forest, support vector

machine, and k-nearest neighbor were also tested by Aravindh et al. (2021). The

utilized dataset is from Kaggle, an online source also adopted by the World Health

Organization (WHO). The result shows that the logistic regression algorithm was the

most effective among all the algorithms tested, with an accuracy of 91.8 %.

2.6 Existing Real-Time Heart Attack Detection Device

Currently, only one existing device has been developed for objective-based

heart attack detection. This device is called HeartBeam. HeartBeam is a telehealth

system that consists of a credit card-sized, 12-lead capable, 3D vectors collection

device that detects electrical signals from the heart (HeartBeam, 2022). Patients can

use this device anywhere to help physicians assess whether the chest pain

43
Ateneo de Zamboanga University

experienced by the patient is a result of myocardial infarction (MI). The patient is

guided through the collection process with the help of a smartphone app allowing

communication between the physician and patient. It allows the signals recorded to

be sent to the HeartBeam cloud, where the signals are analyzed and compared to the

patient's asymptomatic baseline recording. Signal analysis, along with the patient's

history and reported symptoms, are combined into a proprietary algorithm that

provides information and diagnostic recommendation to the patient's physician. The

physician determines whether a heart attack has occurred or not and informs the

patient.

A few limitations are observed in this device. Continuous monitoring of patient

is not provided since patients are only expected to use the device when heart attack

symptoms are observed, silent ischemia are not considered in this case. Additionally,

internet connection is required to access the algorithm used to make diagnostic

suggestions that is provided by their cloud system. Furthermore, it is important to note

that this product is not cleared by the Food and Drug Administration (FDA) and is not

yet available in the market.

2.7 Existing Studies with Similar Approach

Since heart attack is a widely recognized concern in the medical field, various

methods, and approaches to addressing this issue have been explored. This section

discusses the existing designs of heart attack assistive devices with similar

approaches to the proposed device, the portable heart attack alert system. A summary

of the comparison between the existing designs is provided in Table 2-1.

44
Ateneo de Zamboanga University

The first existing design is a wearable real-time heart attack detection and

warning system to reduce road accidents (Chowdhury, et al., 2019). The authors

aimed to design a real-time heart attack alert system device to avoid and reduce road

accidents related to heart attacks. While driving, the device strives to monitor the

driver, particularly their ECG signal. If the device detects a heart attack indicated by

the ECG, the driver would immediately be notified and suggested to seek medical

assistance. Alongside the notification, automatic communication of designated

contact personnel is also conducted.

The device comprises two subsystems: a wearable sensor and an intelligent

heart attack detector system. The wearable sensor is made using the RFduino

microcontroller. It acquires the ECG with dry electrodes, which are attached to the

driver's chest. Filters are incorporated with this subsystem, such as moving average

and median filters, for removing random noises and baseline wander. Biorthogonal

wavelet transformation was also used to detect the R peak and synthesize the ECG

signal.

On the other hand, the intelligent system, built using a Raspberry Pi 3, utilizes

a trained machine-learning algorithm to detect heart attacks. The support Vector

Machine (SVM) algorithm was determined to be the most effective in the detection of

heart attack, with a 98.3% precision and 97.4% accuracy in identifying ST-elevation

Myocardial Infarction (STEMI) and 98.7% precision and 96.3% accuracy in identifying

non-ST-elevation Myocardial Infarction (NSTEMI). Furthermore, a GSM module is

used, and it serves as the alert system responsible for sending notifications to

designated contact persons and notifying the driver upon detection. Both subsystems

45
Ateneo de Zamboanga University

communicate via Bluetooth. In terms of power supply, the wearable sensor subsystem

is powered by a battery, while the intelligent subsystem is powered through the DC

socket splitter of the car. The recognized limitations of this device include the

following: the limit in portability (given that the device is limited for the use of drivers),

the bulkiness of the design, the limited power source for the wearable subsystem, and

lastly, the reliability of the power source of the intelligent subsystems in cars.

ECGAlert is another existing design consisting of a cloud-based system

method for heart attack alert detection (Gusev et al., 2017). This device includes a

wearable sensor, a smartphone, and an intelligent cloud-based server. The wearable

sensor is a wireless ECG electrode capable of acquiring and transmitting ECG signals

via Bluetooth. The receiving end of the data transmission is the smartphone which

serves as the storage where the ECG data is saved. The smartphone also partially

processes the signal, such as using DSP filters to remove noise. The data is then

transmitted to the cloud-based server via LAN/WAN. It is where the ECG can be

accessed for complete analysis and diagnosis of a heart attack. The cloud server is

also made accessible to doctors and other authorized users.

Despite the unique approach, various limitations can be observed. It includes

reliability on local storage media of the patient’s smartphone for storing ECG data.

Another is the reliability of the internet connection for the analysis of data. Without an

internet connection, the analysis feature would be inaccessible, and heart attack

occurrences cannot be detected. Lastly, when data is accessed by smartphone, only

pre-processing can be done, such as filtering out the noises — data is fresh, and no

useful information regarding potential heart attack is provided.

46
Ateneo de Zamboanga University

For a more integrated approach, the study of Ahmed and El-Metwally (2015)

uses ZigBee wireless receiver modules established in nearby hospitals, designed to

receive alarms from a portable, low-cost heart attack detection system worn by the

patient. This system uses an Arduino shield kit coupled with ECG electrodes for data

acquisition from the patient. Once the data is acquired, it is processed to be classified

as either normal or abnormal. If the data is classified as abnormal, it will generate an

alarm transmitted via a ZigBee module connected to the Arduino kit. On the receiving

end is another ZigBee module that receives the alarm and starts contacting a list of

designated contacts given by the patient in case of an emergency. In testing the

system, a heart attack simulator was used to produce abnormal ECG signals at

specific intervals. Results show that the receiver established at a range of 1.24 km

away from the transmitter could receive accurate alarm signals in short time delays

with an accuracy of 89% of correct data transfer.

Overall, the solution allows for remote or distanced patient monitoring,

immediate intervention upon heart attack detection by contacting nearby hospitals and

designated emergency contacts, and early transmission of snippets of abnormal ECG

readings for early analysis. Despite these advantages, there is no filtering of data

acquisition incorporated in the design, in which movement from the patient can

contribute to noise in the ECG. In identifying a heart attack, the device is limited to

using a programmed ECG simulator to produce abnormal ECG signals at specific

intervals. Unlike the first previously mentioned study, the algorithm's accuracy in

determining whether a heart attack occurred was not provided. In terms of data

transmission, the limit of correct transmission is up to 1.2 km as distances greater than

47
Ateneo de Zamboanga University

that will result in an error in data transmission. Lastly, the study does not mention how

the patient will be notified that a heart attack is indeed occurring, despite being able

to send an alarm to the receiving module in the hospital and alert the designated

contacts of the patient.

The last approach is a minimally invasive solution that utilizes a biosensor that

can detect whether a heart attack has occurred by identifying two cardiac markers:

Myoglobin (Myo) and Myeloperoxidase (MPO) (Mondal et al., 2017). The device uses

a sensor fabricated on Whatman filter paper that is functionalized with glutaraldehyde

and a homo-bi functional crosslinker before the covalent attachment of the antibodies

specific to each biomarker is coated with polyaniline. AC impedance measurement of

the filter paper allows detection when the target proteins are bound to the specific

antibody changes in the impedance between the electrodes. This impedance is

measured using a frequency response analyzer with an AC excitation voltage of 100

mV in the frequency range of 100 Hz to 100 kHz. The biomarkers can be detected in

the buffer solution within the concentration range of 100 ng/mL to - 50 ug/mL. The

detection limit obtained for these biomarkers spiked in human serum is one ug/mL

and further blocking using human serum improves the detection limit to 500 ng/mL.

This method results in a biosensor made of inexpensive materials and

fabrication techniques that can detect the occurrence of heart attack with two

biomarkers within 20 minutes and can be disposed of in an eco-friendly manner

making this sensor more suitable for diagnostic applications. However, this method of

detecting the occurrence of heart attack is an invasive solution compared to the

48
Ateneo de Zamboanga University

previously mentioned solutions that are noninvasive. It is also the only solution that

does not involve continuous patient monitoring.

Table 2-1. Comparison of Existing Studies


Authors
and Date Features/Design Components Capabilities Limitations
Published

Chowdhury - uses dry - Dry - allows real time - system


et al., 2019 electrodes in Electrodes detection of heart designed are
acquiring ECG - RFduino attacks which can limited for the
signals that is - Raspberry help drivers in use of drivers
incorporated with Pi 3 preventing (portability is
FIR filters for - SIM 908 accidents and limited and
removing noise GSM Module immediately only drivers
and baseline - Lithium Ion address the issue can use it)
wander and the Battery - incorporated - prototype is
use of with an alarm bulky and
biorthogonal system that can involves a lot
wavelet inform the driver of
transformation of heart attack components
for synthesis of occurrence - the power
signal - incorporated source of the
- Machine with automatic intelligent
learning contacting of pre- heart attack
algorithm defined contact detection and
(support vector personnel to alarm
machine with which the subsystem is
extended time– message derived from
frequency includes the the car (DC
features using driver’s location

49
Ateneo de Zamboanga University

extended - upon acquisition car socket


modified B- of ECG signals, splitter)
distribution significant pre-
(EMBD)) with processing
high rate of methods such as
accuracy and filtering of noises
precision is and feature
utilized in extraction is
detection of heart provided
attack - uses machine
- incorporated learning in heart
with the alert attack detection
system with the to which the best
use of determined
GSM/GPRS to algorithm yields
send a 98.3% precision
notification to and 97.4%
designated accuracy in
contact person identifying ST-
and also to elevation in ECG
inform user and 98.7%
precision and
96.3% accuracy
in identifying T-
wave inversion in
ECG

Gusev et - uses ECG - Wearable - can be used for - data storage


al., 2017 signal in ECG Sensor remote patient is reliant on
determining heart monitoring local storage

50
Ateneo de Zamboanga University

attack that is - Dew Server - system presents media of


acquired through (Smartphone) prediction of an patient’s
the use of a - Cloud- onset heart smartphone
wireless ECG based Server attack to which - initial
biosensor can reduce analysis of
- the wireless response time for data are only
ECG biosensor addressing it provided
transmits data to - data in the when
smartphone via cloud-based transmitted to
Bluetooth server are the
- use of accessible by smartphone
smartphone for doctors - requires
pre-processing internet
signals such as connection to
application of access cloud-
DSP filters for based
noise removal processing
- from architecture in
smartphone, data order to
is sent to cloud- access a
based system more
architecture via extensive
LAN/WAN for the data
analysis, processing
prediction, and
detection of heart
attack

51
Ateneo de Zamboanga University

Ahmed & -Uses ECG - Two - allows remote - no filtering of


El- signal to Arduino or distanced data
Metwally, determine if a Shield Kits patient acquisition
2015 heart attack is - XBee RF monitoring was
occurring using Transmitter - allows incorporated
ECG sensors and Receiver immediate in the design
connected to Modules intervention upon (movement of
Arduino shield kit - ZigBee detection of heart patient can be
-The ZigBee Wireless attack by a factor in
wireless Transmitter automatically contributing
transmitters can and Receiver contacting nearby noise to the
transfer data Modules hospitals and ECG signal)
from the patient designated - no accuracy
to the nearest person as contact or further
hospital including emergency testing was
the designated - allows early provided
contacts in the transmission of particularly in
case of an snippets of ECG the algorithm
emergency readings used for
-The system is (particularly that determining if
integrated inside are abnormal) for there is a
the hospital for early analysis of heart attack
quick response medical (such as
time personnel accuracy rate)
- the mode of
alarm is
limited to
contacting
hospital and
contact

52
Ateneo de Zamboanga University

personnel (no
built-in alert
system to
notify patients
involved).
- in terms of
data
transmission,
the limit of
correct
transmission
begins at
around 1.2 km
distance
(particularly
with the 3-
second
transmission
of ECG
record);
greater than
1.2km results
in error in
data
transmission

Mondal et -Uses a - Impedance- - Can detect - the solution


al., 2017 biosensor to based biomarkers within is invasive
detect cardiac biosensor 20 minutes
biomarkers to

53
Ateneo de Zamboanga University

determine - inexpensive
whether a heart materials and
attack has fabrication
occurred techniques are
-AC impedance used to make the
spectroscopy can biosensor
detect when the
target proteins
(Myo and MPO)
are bound to the
specific antibody
changes in the
impedance
between the
electrodes.
-Impedance is
measured using
a frequency
response
analyzer. The
biomarkers can
be detected in
the buffer
solution within
the concentration
range of 100
ng/mL to - 50
ug/mL

54
Ateneo de Zamboanga University

In relation to the comparison provided in Table 2-1, the existing studies are also

compared to PHAAS. Table 2-2 provides the summary and comparison in terms of

each study and PHAAS's available features. Each feature considered is incorporated

with guide questions.

Table 2-2. Comparison of Features of Existing Studies, HeartBeam, and PHAAS


(Chowdhury et

(Mondal et al.,
(Ahmed & El-
(Gusev et al.,

Metwally,
al., 2019)

PHAAS
Beam
2017)

2015)

2017)

Heart
Portability
(Can the device be
✗ ✓ ✓ ✓ ✓ ✓
carried around by
the subject?)

Continuous
Remote
Monitoring
(Is it capable of ✓ ✓ ✓ ✗ ✗ ✓
continuous and
remote
monitoring?)

Application of
Machine Learning
(Does it use
automatic ✓ ✗ ✗ ✗ ✓ ✓
detection,
specifically with the
use of ML?)

55
Ateneo de Zamboanga University

Utilization of ECG
as data
(Given its
✓ ✓ ✓ ✗ ✓ ✓
reliability, is ECG
the parameter
used?)

Non-Invasive
(Is it non- ✓ ✓ ✓ ✗ ✓ ✓
invasive?)

Alert System
(Is it incorporated
with an alert
system? Can it ✓ ✗ ✓ ✗ ✗ ✓
contact personnel
in cases of
emergency?)

Pre-processed
data
(Are there ✓ ✓ ✗ N/A N/A ✓
application of
filters?)

Independence to
Internet
Connection
✓ ✗ ✓ ✓ ✗ ✓
(Will the device still
function, in terms
of detection,

56
Ateneo de Zamboanga University

without internet
connection?)

Incorporated with
Storage
✓ ✓ ✓ N/A N/A ✓
(Can the device
save the results?)

57
Ateneo de Zamboanga University

CHAPTER III
METHODOLOGY

3.1 Requirements

This section discusses the theoretical considerations, and the hardware and

software requirements necessary for the development of the Portable Heart Attack

Alert System (PHAAS).

3.1.1 Theoretical Considerations

This section explains the theories and concepts in designing the PHAAS

device as an objective-based preventive measure for heart attacks.

3.1.1.1 Electrocardiogram

Electrocardiogram (ECG) is a procedure that measures a heart's

electrical signal (American Heart Association, 2015). ECG readings

primarily consist of waves, segments, and intervals. Each component is

an indication of specific heart activity, which, when the reading does not

fall on the normal pattern can indicate heart problems such as heart

attacks. The main parameter that determines the occurrence of a heart

attack from an ECG reading is the ST segment and T wave (Chowdhury

et al., 2019).

ST segment, as shown in Figure 3-1, is the distance between the

S wave's end and the T wave's start (Biopac Systems, Inc., n.d).

Typically, in a normal ECG reading, it lasts less than 0.20 seconds and

58
Ateneo de Zamboanga University

is displayed along the isoelectric line. This segment represents the

interval or period between the ventricles' depolarization and

repolarization.

Figure 3-1. Components of Normal ECG Reading (Biopac Systems, Inc., n.d.)

The T wave, on the other hand, is the last waveform shown within

a single cardiac cycle and is typically displayed with a modest upward

waveform representing ventricular repolarization. Normal amplitude

values fall less than 0.5 mV with a duration of 0.10 to 0.25 seconds.

Figure 3-2. Comparison of ST segment variations (Chowdhury et al., 2019)

As mentioned, abnormalities along the ST segment and T wave

mainly indicate a heart attack (Chowdhury et al., 2019). Furthermore,

according to Roland (2020), STEMI is considered to be the most severe

59
Ateneo de Zamboanga University

type of heart attack. With this, the proponents chose to focus the PHAAS’

heart attack detection on STEMI.

As shown in Figure 3-2, specifically under letter (B), STEMI is

determined in the ECG reading with an ST elevation (Chowdhury et al.,

2019). The ST elevation shows the J point, which is the junction of the

QRS complex and the ST segment, to be abnormally above the

isoelectric line alongside the ST segment. According to Kashou et al.

(2021), the threshold for ST elevation is 0.25mV for adult males and

0.15mV for adult females. Furthermore, along with the ST-elevation, T-

wave inversion is also observed. A downward waveform passing below

the isoelectric is shown to be displayed, instead of a typical upward

waveform.

3.1.1.2 Support Vector Machine (SVM)

Support Vector Machine is a supervised machine learning model

primarily used for classification and regression analysis. It is considered

one of the most widely used state-of-the-art machine-learning

techniques (Mahesh, 2019). In one of the studies by Chowdhury et al.

(2019), SVM yielded the highest accuracy rating in detecting heart

attacks, namely STEMI and NSTEMI — 97.4 percent and 96.3%,

respectively. With this, it is proven that SVM is a suitable machine-

learning model for detecting heart attacks.

SVM mainly functions by objectively finding the optimal

hyperplane between different datasets (Gandhi, 2018). A hyperplane is

60
Ateneo de Zamboanga University

a decision boundary that helps classify data points. It can be in any

direction and orientation as long as it is in the position where it separates

the data classes into their respective groups, as shown in Figure 3-3.

Figure 3-3. Possible Hyperplanes in classifying data (Gandhi, 2018)

Figure 3-4. Optimal Hyperplane and Maximum Margin in SVM (Gandhi, 2018)

On the other hand, the optimal hyperplane is considered the best

among all possible hyperplanes. It is an ideal decision boundary that will

yield the maximum margin, as shown in Figure 3-4. The maximum

margin is the maximum distance between the two classes of data points

closest to the hyperplane — these data points are called support

vectors. The support vectors dictate the optimal hyperplane's position

and orientation. In addition, according to Gandhi (2018), the greater the

determined maximum margin is, the greater the reinforcing confidence

for the SVM's classification capability will be.

61
Ateneo de Zamboanga University

Figure 3-5. Linearly separable data (MLMath.io, 2019)

Figure 3-6. Non-linearly separable data (MLMath.io, 2019)

SVM is capable of conducting both linear and non-linear

classification. Linear classification is any data group separable by a

straight line. It is done by finding the hyperplane between two classes.

An example is separating a data group in a 2D plane, as shown in Figure

3-5. Non-linear classification, on the other hand, is a data group that

cannot simply be classified using a straight line, as shown in Figure 3-6.

In order to address this, SVM makes use of kernel tricks.

The kernel trick is a method used to bridge linearity and non-

linearity (Sharma, 2019). The application of a kernel function converts

non-linear dimension space into a higher dimension space where linear

classification can be made, as shown in Figure 3-7. A varying number

of kernel tricks are available, some of which include linear, polynomial,

and radial basis functions.

62
Ateneo de Zamboanga University

Figure 3-7. Application of Kernel for non-linear classification (Sharma, 2019)

3.1.1.3 Digital Filters

ECG signals, like other biomedical signals, are susceptible to

noises. Noises or artifacts are common, undesirable, and unavoidable

interferences that affect the quality of an ECG. A good quality ECG

provides a clear visual representation of the waves, segments, and

intervals that composes the ECG signal. A bad-quality ECG, on the other

hand, provides the opposite — the waves, segments, and intervals are

indistinguishable and unidentifiable. The known predominant noises in

ECG include baseline wander, power-line interference, and muscle

artifacts (Chatterjee et al., 2020). To address this concern, digital filters

are required.

3.1.1.3.1 Bandpass Filter

A bandpass filter is a frequency domain filter that mainly

functions to clean signals by limiting the allowed frequencies from

passing through (Electronics Tutorial, n.d.). This mainly works by

choosing a specific range of frequencies, called a bandwidth, to

pass whilst attenuating and rejecting the other frequencies.

63
Ateneo de Zamboanga University

Figure 3-8. Frequency Response of a Bandpass Filter (Electronics


Tutorial, n.d.)

The main parameter considered in a bandpass filter are

the cut-off frequencies. These are the boundaries, typically

expressed as Hz, where attenuation of unwanted frequencies

begins (Lyn, n.dd). For a bandpass filter, two cut-off frequencies

are required: a lower and a higher cut-off frequency (Rajiv, 2022).

The lower cut-off frequency is the frequency point at which the

filter begins to reject lower frequency components. As shown in

Figure 3-8, any frequency below this given point will have higher

attenuation than the pass band (a range of frequency that can

pass through the filter with little to no attenuation). The higher cut-

off frequency, on the other hand, works similar as the low cut-off

frequency but the attenuation or rejection is applied on higher

frequencies. The bandpass filter is basically a combination of a

low pass and a high pass filter.

64
Ateneo de Zamboanga University

3.1.1.3.2 Moving Average Filter

A moving average filter is a simple low-pass Finite Impulse

Response (FIR) filter meant for smoothing purposes that include

addressing short-term overshoots or noisy fluctuations

(Mathuranathan, 2010; Salain, 2022). This type of filter enables

the retention of the true signal representation and has a sharp

step response.

The moving average filter takes a number of samples from

the input and gives a single output point by calculating the

average of the chosen samples. According to Mathuranathan

(2010), the difference equation represented by the moving

average filter is shown as


𝐿−1
1
𝑦[𝑛 ] = ∑ 𝑥[𝑛 − 𝑘] (3.1)
𝐿
𝑘=0

The x[n] represents the signal input, the L represents the

number of samples taken from the input for averaging (also called

window length), and lastly, the y[n] is the single average output

calculated. An example of a 5-point moving average FIR filter is

provided below. It is shown as

1
𝑦[𝑛 ] = (𝑥[𝑛 ] + 𝑥 [𝑛 − 1] + 𝑥 [𝑛 − 2] + 𝑥 [𝑛 − 3] + 𝑥 [𝑛 − 4]) (3.2)
5

The window length provided in the equation above (2) is

five indicating that the number of samples or values in calculating

the average value is also five. In calculating the average, the sum

65
Ateneo de Zamboanga University

of the sample values is divided by the number of chosen samples.

After the first point, the filter moves to another set of samples and

outputs the average value until it is able to tackle all parts of the

input signal. The overall result of applying the moving average

filter to a noisy signal would be similar to what is shown in Figure

3-9. It is essential to take note that the window length is inversely

proportional to the smoothing effect the filter provides. Hence, the

larger the window length, the clearer the signal becomes or the

more denoising effect it has (Salain, 2022).

Figure 3-9. Sample of Simple Moving Average filter application (Salain,


2022)

3.1.1.3.3 Median Filter

The moving average filter only addresses noises involving

powerline interferences and muscle movements; baseline wander

remains in the ECG signal. In order to address it, a median filter

will be used (Chowdhury et al., 2019).

The median filter is a non-linear digital filtering technique

(Poynton, 2012). The main objective of this filter is to output the

66
Ateneo de Zamboanga University

median from a set of input data points, aiming to reduce the

intensity variation between values within a signal (Felicity, 2022).

This filter is commonly used in image processing (signals in the

spatial domain) for smoothing purposes, especially when dealing

with salt and pepper noises.

It mainly works similarly to a moving average filter using

window lengths. However, the output it yields is in terms of the

sample’s median rather than the average. Statistically speaking,

a median is a middle value in a data set arranged in an ascending

or descending order (Khan, n.d.). According to Monalakis and

Ingle (2011), an example of a five-point median filter is

represented as

𝑦[𝑛 ] = 𝑚𝑒𝑑𝑖𝑎𝑛 (𝑥[𝑛 − 1], 𝑥 [𝑛 − 2], 𝑥 [𝑛 ], 𝑥[𝑛 + 1] , 𝑥 [𝑛 + 2]) (3.3)

The number of samples or window length provided in the

equation above (3.3) is five. Therefore, five values from the input

signal (x[n]) will be considered, and among all the chosen values,

after arranging them in the proper order, the median or the middle

value will be considered as the sole output (y[n]).

3.1.1.4 Feature Extraction

Feature extraction is an essential process in the application of

machine learning. With this, the following theoretical consideration, in

this specific application are listed below.

67
Ateneo de Zamboanga University

3.1.1.4.1 Power Spectral Density

Power spectral density is the distribution or measurement

of a signal’s power in relation to its frequency (Siemens, 2020).

This is calculable using wavelet transform.

Figure 3-10. Variation of Power Spectral Density of normal, ST-elevation, and


T-wave inversion ECG traces (Chowdhury et al., 2019)

According to Chowdhury et al. (2019), calculating the

power spectral density (PSD) is sufficient in classifying the ECGs.

Shown in Figure 3-10 are the variation in PSD peaks displayed

by the normal, ST-elevated, and T-wave inversion ECG traces.

For the case of normal ECG (A&D), the frequencies appeared up

to 30Hz; the peak is approximately at 5Hz with a PSD of

300V2/Hz. On the other hand, the ST-elevated ECG trace (B&E)

shows a dense PSD from less than 5Hz. The peak is around 2Hz,

with a PSD of greater than 400V 2/Hz. Lastly, for the T-wave

inversion (C&F), the peaks are also around less than 5Hz, but

with a peak at approximately 4Hz at 400V 2/Hz.

3.1.1.4.2 Continuous Wavelet Transform

The Continuous Wavelet Transform is a signal processing

technique for analyzing non-stationary signal content in both time

68
Ateneo de Zamboanga University

and frequency domains (Sadowsky, n.d.). This method allows the

representation of the time-frequency relationship of the signal

(Thiamchoo & Phukpattaranont, n.d.). One of the applications of

continuous wavelet transform is R peak detection from ECG

signals (Chowdhury, 2019; Thiamchoo & Phukpattaranont, n.d.).

It is also applied as a feature extraction method and used as a

technique for data analysis (Alharbey et al., 2021; Arts & Broek,

2022).

The continuous wavelet transform enables time-frequency

representation with the use of wavelets. Wavelets, by the name

itself, means small waves, which are in the form of oscillations

that decay quickly (Sifuzzaman et al., 2009).

There are two conditions that wavelets must follow: first,

the wavelet must have a zero mean; and second, it should have

a finite energy (Kirsanov, 2022). A zero mean indicates that the

sum of areas under the curve on both the positive and negative

sides must be equivalent to zero — this ensures that the wavelet

is an oscillation or a wave. This rule is called the admissibility

condition, and it is mathematically represented as


+∞
∫ 𝜓(𝑡)𝑑𝑡 = 0 (3.4)
−∞

On the other hand, for having finite energy, the area under

the curves of a squared wavelet must yield a finite value — this

69
Ateneo de Zamboanga University

ensures that the wavelet is localized in time. This condition is

mathematically represented as
+∞
∫ |𝜓 (𝑡)|2 𝑑𝑡 < ∞ (3.5)
−∞

The general idea of how continuous wavelet transform

works is by a family of wavelets as a basis for comparison from

the input signal. The acquired differences in each wavelet and

input signal enable the acquisition of what frequencies are

present from the input signal at specific times. There are two

parameters considered in applying this process: scale and

translation.

1 +∞ 𝑡−𝑏
𝐶𝑊𝑇 (𝑎, 𝑏 ) = ∫ 𝑥(𝑡)𝜓 ( ) 𝑑𝑡 (3.6)
√𝑎 −∞ 𝑎

The equation above (3.6) is the mathematical

representation of a continuous wavelet transform. x(t) represents

the input signal, 𝜓(t) represents the wavelet function, a represents

the scale parameter, and lastly, b represents the translation

parameter (Sifuzzaman et al., 2009.; Thiamchoo &

Phukpattaranont, n.d.). The scale parameter indicates the degree

of compression, while the translation parameter indicates the time

location of the wavelet.

It is essential to take note of the general relationship

between the scale and translation parameters (MathWorks, n.d.).

When the scaling factor is high, the translation or time-width is

70
Ateneo de Zamboanga University

smaller — this means that the wavelet is of high frequency and is

meant to collect rapidly changing fine details from the input signal.

When the scaling factor is low, on the other hand, the translation

or time-width is larger — this entails that the wavelet is of low

frequency and is designed to collect slowly changing coarse

features. An example of a small and long-scale wavelet is shown

in Figure 3-11. The relationship, as mentioned earlier, shows that

the wavelengths have time widths adapted to their frequencies,

enabling the representation of the signal in the time-frequency

domain.

Figure 3-11. Wavelets with small and long scale factors (MathWorks,
n.d.)

3.1.1.4.1 Synthetic Features

Synthetic feature or data, from the word synthetic itself, is

a form data that is artificially generated (Saeed, 2022). These

types of data are commonly produced through various methods

such as mathematical simulations or application of machine

learning algorithms.

According to Singh (2021), in general, there are mainly two

ways to create synthetic data: first is drawing numbers from a

distribution and second is using agent-based modeling. The

71
Ateneo de Zamboanga University

former works through observation of the statistical distribution of

real-world data and creating replications of it. The latter, on the

other hand, also observes the statistical distribution of the real

world but instead, random data is reproduced.

The use of synthetic features or data are preferred for a

various of reason. Shah (2023) stated that one of the reasons

include is due to faster and cheaper datasets creation.

Additionally, chances of facing issues regarding bias, privacy,

and licensing are lessened. It also provides complete control over

data.

3.1.2 Hardware Requirements

This section lists and discusses the hardware requirements for

developing the PHAAS device. Additionally, laboratory testing equipment is

also included.

3.1.2.1 Hardware Components of PHAAS Device

This section discusses the hardware components involved in

designing the PHAAS device. These components include an Analog

ECG Sensor, an Analog to Digital Converter, a Raspberry Pi 4 Model B

microprocessor, a Micro SD card, a GSM module, an LCD Display, and

a Power bank.

3.1.2.1.1 Analog ECG Sensor

In the study the proponents will require the use of an

Analog ECG Sensor which comprises three components:

72
Ateneo de Zamboanga University

disposable electrodes, lead cables, and the sensor chip. The

corresponding components are shown in Figure 3-12.

Figure 3-12. Sparkfun Analog ECG Sensor Module Kit (Alibaba, n.d.)

The disposable electrodes, shown in Figure 3-13, will be

used to acquire the subject’s ECG data. To be specific, the

disposable electrodes must be compatible to a snap-on type lead

to connect to the sensor chip using the lead connector cable.

Figure 3-13. iCare Disposable ECG Electrodes (iCare, n.d.)

The sensor chip shown in Figure 3-12 is responsible for

measuring the ECG signals from the subject. It should be able to

interface with the Raspberry Pi 4 and has an output voltage that

can be read by an analog to digital converter before being fed to

the Raspberry Pi 4 to process.

73
Ateneo de Zamboanga University

3.1.2.1.2 Analog to Digital Converter (ADC)

In this study, the proponents will require the use of an

analog-to-digital converter (ADC) that can be interfaced with the

Raspberry Pi 4. This ADC will convert the analog signals to digital

signals for the microprocessor to process. Specifically, the ADC

must have 12-bits of resolution and be capable of 250 Hz

sampling frequency to match the acquisition parameters used

from the European ST-T database to train and test the machine

learning algorithm. Figure 3-14 shows the analog-to-digital

converter to be used for this study.

Figure 3-14. Adafruit ADS1015 12-bit ADC (Makerlab Electronics, n.d.)

3.1.2.1.3 Raspberry Pi 4 Model B Microprocessor

In this study, the proponents will require the use of the

Raspberry Pi 4 Model B Microprocessor to integrate all modules

into a single system which includes the acquisition and signal

processing unit, data analysis module, alert system module, and

display system. The microprocessor features a 64-bit quad-core

processor, up to 8 GB of RAM, a micro-SD card slot for local

storage, 40 GPIO pins, and uses a USB C port for power delivery.

74
Ateneo de Zamboanga University

To ensure smooth performance and avoid performance issues,

the proponents recommend using a variant with a minimum of 4

GB of RAM. Figure 3-15 shows the microprocessor to be used for

this study.

Figure 3-15. Raspberry Pi 4 Model B (Raspberry Pi, n.d.)

3.1.2.1.4 Micro SD Card

In this study, the proponents will require the use of a micro-

SD card to store the operating system of the microprocessor,

codes required for each module to function, and subject’s ECG

data. To ensure optimum performance and sufficient storage

capacity, the proponents recommend using a micro-SD card with

a speed class of Class 10, a UHS speed class of U1, and a

capacity of 128 GB of storage. Figure 3-16 shows the micro-SD

card to be used for this study.

Figure 3-16. 128 GB SanDisk Ultra Micro SD Card (Amazon, n.d.)

75
Ateneo de Zamboanga University

3.1.2.1.5 GSM Module

In this study, the proponents will require the use of a

GSM Module that can be interfaced with the Raspberry Pi 4. It

should also have the capability of being programmed to send text

messages via SMS and make voice calls. This will enable the

PHAAS device to notify designated contacts when STEMI ECG

is detected. Figure 3-17 shows the GSM Module to be used for

this study.

Figure 3-17. SIM800L V2 5V Wireless GSM GPRS Module (Maker-lab


electronics, n.d.)

3.1.2.1.6 LCD Display

In this study, the proponents will require the use of an LCD

Display which can be interfaced with the Raspberry Pi 4. It should

also have the capability of being programmed to display the

necessary text the proponents require. This will enable the LCD

Display to display the ECG status of the subject in terms of

whether Normal ECG or STEMI ECG has been detected. Figure

3-18 shows the LCD Display to be used for this study.

76
Ateneo de Zamboanga University

Figure 3-18. 16x2 LCD Display (Maker-lab electronics, n.d.)

3.1.2.1.7 Power Bank

In this study, the proponents will require the use of a power

bank with a capacity of 10,000 mAh, an output voltage of 5.0V

and a current of 3.0A, meeting the power requirements of the

microprocessor (Raspberry Pi, n.d.). This will allow the power

bank to power the microprocessor and all modules integrated to

it.

3.1.2.2 Laboratory Testing Equipment

This section elaborates on the laboratory testing equipment

needed to test PHAAS.

3.1.2.2.1 Digital Multimeter

A digital multimeter is an industry-standard tool for

troubleshooting electrical and electronic systems (Fluke, 2021).

They can precisely measure voltage, current, and resistance. The

measurements are typically displayed in a digital display allowing

the values to be read quickly by the user. This device will be used

77
Ateneo de Zamboanga University

to avoid the use of faulty components and ensure that the

hardware-based materials and circuitry are in proper condition if

it is to be used. The device is shown in Figure 3-19.

Figure 3-19. Digital Multimeter (Fluke, 2021)

3.1.2.2.2 Fluke ProSim8 Vital Signs Simulator

The ProSim8 vital signs simulator, shown in Figure 3-20,

allows for a complete preventive maintenance testing of a patient

monitor, which can take less than 5-minutes (Fluke, n.d.). It has

specialized stay-connected ECG posts for lead connections to be

secured and has physiologically synchronized pulses across all

parameters. This simulator has multiple functions and can

simulate various physiological signals and vital signs such as

respiration, temperature, IBP, cardiac output, NIBP, SpO2, and

many more. Aside from that, this device can also simulate known

physiological outputs of common health concerns such as

bradycardia, tachycardia, and arrhythmias — the most significant

simulation the device can provide concerning this study, are

78
Ateneo de Zamboanga University

normal ECG, ECG with artifacts, and ECG with varying ST-

elevations.

Figure 3-20. Fluke Prosim8 Vital Signs Simulator (Fluke, n.d.)

3.1.2.2.3 Laptop

Windows 10 Laptop with a 15.6-inch display and a

resolution of 1920x1080 is to be used for verification and testing

purposes (Carousel, n.d.). The laptop is powered by an Intel Core

i5-9300H and has Nvidia GeForce RTX 2060 graphics. It also has

16 GB of RAM, 256 GB of SSD storage, and 1TB of HDD storage.

The laptop will mainly be used to run software such as MATLAB

and python programming software, to test the accuracy of the

machine learning algorithm, verify the codes programmed, and

for accessing RPI for the development and testing of PHAAS.

Figure 3-21 shows the laptop to be used.

Figure 3-21. ACER Predator Helios 300 Gaming Laptop (Carousel,


n.d.)
79
Ateneo de Zamboanga University

3.1.3 Software Requirements

This section lists and discusses the software requirements for

developing the PHAAS device.

3.1.3.1 Raspberry Pi OS

The Raspberry Pi OS will serve as the operating system for

running the function of the PHAAS device. Mainly it will allow the device

to run the software programs to process the signal acquired from the

subject, implement the machine learning algorithm, send the alert using

the GSM module in the occurrence of the heart attack, and display the

status of the ECG.

3.1.3.2 WFDB (Waveform Database) Toolbox

WFDB (Waveform Database) Toolbox for MATLAB/Octave is an

open-source toolbox that allows access to data provided by PhysioNet

Databases (Silva and Moody, 2014). It provides various functions that

allow the reading, writing, and processing of signals from the mentioned

database (PhysioNet, 2017).

3.1.3.3 Python

Python is a simple, yet powerful programming language widely

used in various applications. Such applications include web

development, automation or scripting, software testing and prototyping,

data analysis and visualization, machine learning, and many more

(Coursera, 2022). According to Python Institute (n.d.), it is beginner


80
Ateneo de Zamboanga University

friendly, object-oriented, high-level with dynamic semantics, and a

general-purpose programming language. It is also free and hosts

thousands of third-party modules both from Python's standard library

and those contributed by the community (Python Software Foundation,

n.d.).

3.1.3.4 Scikit Learn

Scikit learn is an open-sourced machine learning library that uses

the python language and supports supervised and unsupervised

learning. It has various tools at its disposal for model-fitting, data pre-

processing, model selection, model evaluation, and more (scikit-learn,

n.d.), which will help create the chosen machine learning algorithm for

this study.

3.1.3.5 LiquidCrystal library

The LiquidCrystal library will be used to control the LCD

displaying the status of the subject's processed and analyzed ECG

signal.

3.2 Functional Design

This section discusses the functionalities of each module involved in designing

the PHAAS, specifically in terms of the hardware and software components. The block

diagram of the PHAAS device is shown in Figure 3-22.

81
Ateneo de Zamboanga University

3.2.1 Functional Analysis of Hardware Component

This section elaborates on the functionalities of modules involved in

hardware components. The modules involved in the PHAAS device are the

acquisition and signal processing unit, data analysis module, alert system

module, storage unit, display system, and battery module. These components

are confined in a single enclosure that is portable enough for the subject to

carry around. The preliminary design and approximate dimensions of the

PHAAS are provided in Figures 3-24 and 3-25, respectively.

3.2.1.1 Acquisition and Signal Processing Unit

On the hardware side, the primary function of the acquisition and

signal processing unit is to allow the acquisition of ECG data from the

subject. Mainly, this is composed of the analog ECG sensor and analog-

to-digital converter.

Figure 3-22. Block Diagram of PHAAS

82
Ateneo de Zamboanga University

Figure 3-23. Preliminary Design of Portable Heart Attack Alert System

Figure 3-24. Approximate Dimensions of Portable Heart Attack Alert System

3.2.1.1.1 Analog ECG Sensor

In the data acquisition process, Chest lead II configuration

is followed in acquiring the ECG from the subject, as shown in

Figure 3-25. According to Chowdhury et al. (2017), chest lead II

placement along with chest straight lead were comparable to

clinical grade ECG traces when acquired and are suitable for

83
Ateneo de Zamboanga University

comfort in terms of portability. Additionally, a maximum of three

electrodes are only used in the provided set-ups which is

preferable given that it simplifies the ECG acquisition process.

With this, the proponents adapted the use of chest lead II

configuration. Each electrode represents a specific electrical

charge, which are namely positive, negative, and neutral. The

positive electrode will be attached aligned to the right arm while

the negative electrode will be aligned along the left arm. The

neutral electrode, on the other hand, is aligned unto the left leg.

All placements are within the premises of the subject’s chest. It is

important to take note that disposable ECG electrodes were

chosen by the proponents due to the unavailability of dry ECG

electrodes.

Figure 3-25. Chest Lead II Configuration (Sampson, 2018)

The ECG electrodes serve as the medium where the

electrical activities of a subject's heart are measured. Three lead

84
Ateneo de Zamboanga University

connectors will correspondingly be used, allowing connection

between the electrodes and the analog ECG sensor.

The analog ECG sensor chip receives the analog

measurements of electrical impulses of the heart acquired by the

disposable electrodes connected via lead connectors. This

hardware component is connected to the analog-to-digital

converter for further processing.

3.2.1.1.2 Analog to Digital Converter

The Analog to Digital Converter allows the conversion of

analog ECG signals measured using the ECG sensor into digital

data. It will enable easy access by microprocessors like the

Raspberry Pi 4, as its GPIO pins can read digital signals only.

The analog ECG sensor is routed through the analog-to-digital

converter, which is connected to the microprocessor as it lacks

an integrated analog-to-digital converter. This is the receiving

point of the digitized ECG signal and is where the data analysis

module accesses the data.

3.2.1.2 Data Analysis Module

The main function of this module is to integrate all the hardware

and software components of the proposed device. Additionally, it makes

use of the machine learning algorithm to analyze ECG signals and

detect for heart attacks, specifically STEMI.

85
Ateneo de Zamboanga University

3.2.1.2.1 Raspberry Pi 4 Model B Microprocessor

The microprocessor allows the machine learning algorithm

system to run or work in the PHAAS device. Raspberry Pi 4 Model

B has the processing power to run multiple processes

simultaneously with its 64-bit quad-core CPU and up to 8GB of

RAM (Raspberry Pi, n.d.). Additionally, unlike microcontrollers, it

is easier to run machine learning algorithms on microprocessors

like the Raspberry Pi.

Furthermore, the microprocessor is the main component

of the overall system of the proposed device, the Portable Heart

Attack Alert System (PHAAS). This component serves as the

integration point of all modules involved in the hardware and

software aspects — the control system of the whole PHAAS.

3.2.1.3 Storage Unit

The storage unit’s main function is to store information regarding

the analysis of ECG data. It also serves as the access point where

medical professionals can acquire the ECG recordings for further

diagnosis locally on the device. This module involves the use of a Micro-

SD card.

3.2.1.3.1 Micro SD Card

A Micro-SD card would be used as storage for the PHAAS

device. The recommended speed classes are Class 10 and U1,

86
Ateneo de Zamboanga University

while the capacity is at least 128 GB to ensure optimum

performance of the system and sufficient storage capacity for

data to be stored. Specific folders within the SD card would be

created in order to manually access the saved ECG data

acquired. There are four types of data to be saved such as the

subject’s ECG and corresponding status, the filtered results, and

features extracted in each reading. All the mentioned data are

saved as a file with appropriate file names and information such

as date and time of each acquisition.

3.2.1.4 Alert System Module

The alert system module’s main function is to notify the

designated contacts, the user and involved clinician, when a heart attack

is detected. This module involves the use of a GSM Module.

3.2.1.4.1 GSM Module

The microprocessor controls the GSM module and

decides when to send the notifications based on the decision

made by data analysis module. When a heart attack is detected,

the GSM module will notify the designated contacts through SMS

and voice calls.

87
Ateneo de Zamboanga University

3.2.1.5 Display Module

The display module’s main function is to show whether the device

was able to detect a heart attack or not. This module is mainly composed

of an LCD Display.

3.2.1.5.1 LCD Display

The LCD Display, which is integrated with the

microprocessor, allows for the display output based on the

conclusion reached by the data analysis module. When the

acquired data results in a heart attack being detected, the status

“STEMI ECG Detected” will be displayed on the LCD Display for

user awareness. If heart attack is not detected, the status “Normal

ECG” should be displayed.

3.2.1.6 Battery Module

The battery module is the device's power source, making it

portable. The main component of this module is a Power Bank.

3.2.1.6.1 Power Bank

The power bank is a portable power supply that is to be

connected to the microprocessor allowing it to power the modules

integrated to it. It must have a capacity of 10,000 mAh, a voltage

output of 5.0V, and 3.0A current.

The estimated length of time a 10,000 mAh power bank

can support the PHAAS device is approximately six hours. The

88
Ateneo de Zamboanga University

total current to be utilized by the overall integration of modules is

approximately 1500mA (see appendix H). The following formula

(3.7) is used to calculate the expected battery life of the power

bank upon incorporation of other modules included.

𝐵𝑎𝑡𝑡𝑒𝑟𝑦 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 (𝑖𝑛 𝐴ℎ)


𝐵𝑎𝑡𝑡𝑒𝑟𝑦 𝐿𝑖𝑓𝑒 (𝑖𝑛 ℎ𝑜𝑢𝑟𝑠) = (3.7)
𝐿𝑜𝑎𝑑 𝐶𝑢𝑟𝑟𝑒𝑛𝑡 (𝑖𝑛 𝐴)

3.2.2 Functional Analysis of Software Components

This section elaborates on the functionalities of modules involved in the

software aspect of the PHAAS device. The main flowchart of the functional

analysis of software components is provided in Figure 3-26. It shows the overall

interaction between modules upon operation of PHAAS.

Figure 3-26. Main flowchart of PHAAS

89
Ateneo de Zamboanga University

3.2.2.1 Acquisition and Signal Processing Unit

The Signal Processing and Acquisition Unit of PHAAS will first

acquire the ECG data up to 2500 samples. Upon acquisition, the raw

data will then be pre-processed with the application of digital filters for

the removal of noise which are namely bandpass, moving average, and

median filters. Feature extraction methods, on the other hand, are also

applied for the purpose of highlighting and simplifying essential features

or components of the ECG signal, wherein, continuous wavelet

transforms, power spectral density, and synthetic features are

considered. The data, now pre-processed, will then be forwarded to the

data analysis module for further processing. The flow diagram of the

acquisition and signal processing unit is provided in Figure 3-27.

Figure 3-27. Flow diagram of Acquisition and Signal Processing Unit

90
Ateneo de Zamboanga University

It must be taken note that the acquired raw data and the

corresponding pre-processed data are considered for storing for the

reason that it can be reused for further development of the suggested

device. It also serves as a method at which the doctor or clinician can

access the user’s data for further review. The mentioned data that are

meant for storing are forwarded for the storage module to address.

3.2.2.2 Data Analysis Module

For this module, a machine learning algorithm is trained using the

Support Vector Machine (SVM) model to analyze the data. Upon

analysis of the received pre-processed data, either of the two

classifications can be provided — either the processed ECG data is

normal or STEMI. For the latter, the information would be redirected to

the alert system module, saved in the storage module, and displayed by

the display module. If it is the former, it would only be redirected to the

storage and display modules. Figure 3-28 shows the flow diagram of the

data analysis module.

In terms of training the machine learning model, various

procedures are conducted prior to the actual training. The procedures

extend from collection, balancing, pre-processing, and splitting of data.

Upon the actual training, supporting procedures such as finding optimal

hyperparameter, scaling, and feature selection are applied. This is to

increase the chances of developing models exhibiting good

performance. The flow of this overall procedure is shown in Figure 3-29.

91
Ateneo de Zamboanga University

Figure 3-28. Flow Diagram of Data Analysis Module

Figure 3-29. Flow Diagram of Training Machine Learning Process

92
Ateneo de Zamboanga University

3.2.2.2.1 Data Collection for Model Construction and

Validation

The datasets for training and testing the machine learning

algorithm will be acquired from PhysioNet’s open online-source

European ST-T Database. The database consists of ambulatory

ECG recordings from 70 men aged 30 to 84, and 8 women aged

55 to 71 (PhysioNet, 2000a). Each recording is 2 two hours long

and contains two ECG signals sampled at 250 Hz with 12-bit

resolution over a nominal 20 mV input range.

Additionally, it offers string annotations (annotation that

provides the start, peak, and end of an event) and interpretations

are available in the annotation notes provided by PhysioNet. In

accessing this database, WFDB Toolbox will be used, which is a

an open-source toolbox for analyzing and processing PhysioNet

databases in MATLAB and octave.

This dataset is suitable for building the machine learning

model given it provides normal and ST-elevated ECG cases

which are the relevant data being considered in this study. This

mainly contributes to the development of the machine learning.

Given the available data, training of the model for binary

classification of normal and STEMI ECG is made possible.

93
Ateneo de Zamboanga University

3.2.2.2.2 Balancing Dataset

According to Ali et al. (2019), when a dataset is

imbalanced, it can hinder the learning process of classifiers by

creating a bias towards the majority class and disregarding the

minority class. To tackle this issue, two primary methods were

proposed in the dealing the imbalance problem: upsampling and

downsampling. The upsampling approach attempts to balance

out the underrepresented minority class by generating new

samples through the duplication of existing ones. Conversely,

downsampling reduces the size of the majority class by removing

samples, thereby balancing the amount of class distribution.

In the case of this paper, the downsampling method is the

preferred way to address imbalanced data due to its simplicity.

Additionally, Ali et al. (2019) pointed out, that the replication of

samples in the upsampling process may lead to classifiers

overfitting the data. The upsampling method would also increase

the total number of datasets, making it computationally

demanding and time-consuming to use.

3.2.2.2.3 Pre-processing Data

The procedures applied for pre-processing data is the

same or similar to what is proposed to be used for the PHAAS

device: the application of digital filters stated under section

94
Ateneo de Zamboanga University

3.1.1.3 and the extraction of the stated features under section

3.1.1.4.

3.2.2.2.4 Splitting Training and Testing Data

When the necessary data are secured and pre-processed,

it will then be split into two groups: one set for training and another

for testing or validation. The distribution of data follows a ratio of

70:30 where 70% of the data will be allotted for the training and

the rest of the 30% are for testing.

Both the training dataset includes labeled data which will

be the guide of the machine learning model in determining the

difference between normal ECG and ECG with ST-elevation. On

the other hand, the testing or validation dataset will be used to

evaluate the classification performance of the trained SVM.

For each data class, a minimum of 50 entries will be

utilized. The length of each ECG data will be made of 2500

samples which is equivalent to 10 seconds at a sampling rate of

250Hz.To ensure that there is a proportional distribution of

classes between training and testing dataset, stratified sampling

is considered. This sampling technique ensures that the

distribution is a close representation of the overall population of

the data collected (Baeldung, 2022). Furthermore, this method

can contribute to improving machine learning model accuracy.

95
Ateneo de Zamboanga University

3.2.2.2.5 Training Machine Learning Algorithm

Training the machine learning simply involves the process

of feeding it with labeled training dataset (Banoula, 2023). The

model, Sector Vector Machine (SVM), will educate itself and

develop its own algorithm in classifying the provided classes

which in the case of this paper, is STEMI and normal ECG. For

the whole process of machine learning training, please refer to

Figure 3-29.

To guarantee optimal performance of the machine

learning model, necessary measures were considered.

According to Baylon and Usama (2022), the following methods

are effective in increasing machine learning performance:

3.2.2.2.5.1 Finding Optimal Hyperparameters

Hyperparameters are adjustable parameters that

greatly affect the learning process of a machine learning

model (Rouse, 2022). Hyperparameters are conditions

that the machine learning model have no control over.

Unlike parameters, which are internal, hyperparameters

are explicit which can only be controlled and managed by

the developers (Nyuytiymbiy, 2020). There are various set

of hyperparameters that can be considered, but those that

should be used should depend on the type of model to be

96
Ateneo de Zamboanga University

developed. For Support Vector Machine, kernel sizes, C,

gamma, and degree are examples (Amy, 2022).

The kernels are mainly functions that initially allow

non-linear classification to be linear through mapping of

input data into a higher-dimensional feature space (Afonja,

2017). This is commonly known as the kernel trick. Some

kernels are influenced by the hyperparameter degree such

as the polynomial kernel. The Degree hyperparameter

mainly settles degrees of freedom the kernel will use.

On the other hand, C (Regularization) is the

hyperparameter that indicates how much of

misclassification will be allowed based on a provided

margin (Barua, 2022). It mainly controls the trade-off

between maximizing the margin and minimizing the

classification error. For the gamma, it mainly directs the

shape of the decision boundary by considering the

influence the data points at a certain distance from the

hyperplane will have.

In summary, the choice of kernel size, C, gamma,

and degree in SVM can significantly affect its

performance, and these hyperparameters should be

carefully tuned based on the specific problem and data at

hand.

97
Ateneo de Zamboanga University

3.2.2.2.5.2 Scaling Data

Feature scaling is a technique used to normalize

data to a common range or scale, with the aim of mitigating

the impact of outliers on model performance (Chong,

2020). It involves transforming the data so that it has a

uniform scale, which helps in reducing the disparity in

magnitude between outliers and other data points. This

promotes generalization in machine learning models by

allowing them to make consistent conclusions based on a

standardized scale of values. Example of scaling method

includes z-score and min-max normalization

(Codecademy, n.d.).

Min-Max normalization works by squeezing values

to fit a specific range, such as from 0 to 1. The minimum

value within the set of data is set to 0, while the maximum

value is set to be represented by 1. every other value gets

transformed into a decimal between 0 and 1. On the other

hand, the z-score, conducts normalization by making the

set of data have a mean equal to zero and the standard

deviation by 1.

The trade-off between the two methods is that min-

max normalization has a set range to fit the data but does

98
Ateneo de Zamboanga University

not handle the outliers well. Z-score, on the other hand, is

the opposite.

3.2.2.2.5.3 Feature Selection

Feature selection is a method that selects a set of

features that best improves a model’s performance

(Menon, 2023). This means that the features don’t have

much contribution to model performance are removed,

and those that provides relevance are retrained.

Furthermore, this method is beneficial because it can

remove features that doesn’t significantly provide

important information, or worse, that causes discrepancies

to the model. Also, limiting the features involved also

makes the algorithm less computationally extensive.

3.2.2.3 Storage Unit

The Storage Module is where the ECG data are saved. It is stored locally

wherein four types of data are considered: the raw data, filtered data, features,

and class label predicted. All the indicated data are to be saved as files in an

allotted folder within the SD card. It is where authorized personnel such as

medical professionals can access the data for further review and diagnosis.

Figure 3-30 provides the flow diagram of the storage module.

99
Ateneo de Zamboanga University

Figure 3-30. Flow Diagram of Storage Module

3.2.2.4 Alert System Module

The alert system module of PHAAS mainly involves using a GSM

module. This module is only utilized when a STEMI is identified within the ECG

data. The alert system module is responsible for sending notifications to

designated contacts, which are the user and the clinician. The notification will

mainly include the status of the subject along with the date and time and relayed

via SMS and voice call. The alert system module flow diagram is shown in

Figure 3-31.

100
Ateneo de Zamboanga University

Figure 3-31. Flow Diagram of Alert System Module

3.2.2.5 Display Module

The display system mainly displays the result presented by the data

analysis module via LCD. As shown in Figure 3-32, the message or text

displayed on the LCD screen mainly depends on the result. It will either display

with "STEMI detected" when an ST-elevation is detected within the ECG or a

text display of "Normal" when the ECG is classified as normal.

Figure 3-32. Flow diagram of Display System

101
Ateneo de Zamboanga University

3.3 Testing and Validation

This section describes the process of how the system would be tested which

should provide validation for the results in evaluating the PHAAS device.

3.3.1 Functional Testing

This section explains the process involved in alpha testing. Alpha testing

evaluates the functionality of individual modules involved in the design of

PHAAS. Six modules are involved in the device: a signal acquisition unit, a data

analysis module, an alert system module, a storage module, a display system,

and a battery module. Functional testing is conducted to ensure that all

modules are correctly implemented and operational. Table 3-1 shows the

summary of the functional test for each module.

3.3.1.1 Testing Acquisition and Signal Processing Unit

The goals in testing the acquisition and signal processing unit are

to check if the sensor can acquire an ECG signal and if the digital filters

work effectively.

In testing the sensor, the proponents will serve as the subject for

gathering ECG signals. The three disposable electrodes are placed on

the subject following the chest lead II setup, and the leads are attached

to the corresponding electrodes. An ADC is incorporated with the sensor

to convert the signal from analog to digital.

The user’s ECG signal will be acquired using a pre-programmed

algorithm encoded using python and applied using Rpi. The

102
Ateneo de Zamboanga University

corresponding data will be digitally viewed via the terminal and visually

verified if a signal is acquired. If ECG was acquired a score of 1 is given,

if not, a score of 0 will be provided instead. The expected success rate

for testing the acquisition is around 95% after conducting ten test trials.

The electrode placement quality and the unavoidable presence of

impedance caused by skin were considered.

On the other hand, the Prosim8 Vital Signs simulator will be used

to test the digital filters. The ECG artifacts from the Prosim8 simulator

include respiration, baseline wander, muscle movement, and power line

interference. For every noise, three artifact sizes can be generated

which are represented in terms of percentages namely 25, 50, and 100

percent. Given that there will be ten trials for this test, five of them will

use Normal ECG; the fifth noise for the fifth trial will be chosen randomly

from the four available noises. The remaining trials will use STEMI with

random ST-elevation values that extends from +0.5mV to +0.80mV,

wherein the tenth trial also chooses a random artifact. Visual comparison

will be made between the unfiltered and filtered ECG simulations; to

evaluate the results, the following scoring will be applied: 0 for not

effective, 0.5 for fairly effective, and 1 for most effective. A success rate

of at least 90% is expected after ten trials. Factors such as the quality

and design of the filters are considered.

103
Ateneo de Zamboanga University

3.3.1.2 Testing Data Analysis Module

Prior to implementation of machine learning model, the

classification performance will be tested using training and testing data

acquired from European ST-T Database. There will be two stages of

testing.

The initial test will include the use of 5-fold cross-validation for

testing the generalization or estimation of performance of the built SVM

model on unseen data. This is conducted to maximize available data

and avoid overfitting tendencies when building the machine learning

model. With this, the average accuracy of the 5-fold cross-validation will

be the main metric for evaluating of the performance of the model.

True positive rate (TPR) (3.8), false positive rate (FPR) (3.9),

specificity (3.10), precision (3.11), f-measure (3.12), and general

accuracy (3.13) of the model will also be calculated in support of average

k-fold accuracy. The following equations of the parameters chosen are

shown below.

𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠
𝑇𝑃𝑅 = 𝑅𝑒𝑐𝑎𝑙𝑙 = (3.8)
𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠 + 𝐹𝑎𝑙𝑠𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒

𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠
𝐹𝑃𝑅 = (3.9)
𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠 + 𝑇𝑟𝑢𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒

𝑇𝑟𝑢𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒𝑠
𝑆𝑝𝑒𝑐𝑖𝑓𝑖𝑐𝑖𝑡𝑦 = (3.10)
𝑇𝑟𝑢𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒𝑠 + 𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠

𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = (3.11)
𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠 + 𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠

2 𝑥 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 𝑥 𝑅𝑒𝑐𝑎𝑙𝑙
𝐹 − 𝑠𝑐𝑜𝑟𝑒 = (3.12)
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 + 𝑅𝑒𝑐𝑎𝑙𝑙
104
Ateneo de Zamboanga University
𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒𝑠 + 𝑇𝑟𝑢𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒𝑠
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = (3.13)
𝑇𝑜𝑡𝑎𝑙 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝐸𝑥𝑎𝑚𝑝𝑙𝑒𝑠

Once the model's performance is satisfactory, final testing will

occur by testing the model using the testing dataset. The main parameter

for evaluating the performance of the model in this setting is the general

accuracy (3.13). The rest of the parameters indicated above will be used

to support the main metric considered.

The initial test expects at least 90% K-fold accuracy. Accuracy is

the rate of overall correct predictions among the provided sample. The

higher the value of the accuracy, the better the performance of the model

is. The same accuracy value is also expected with the final test using

the testing dataset. In setting the success rate, the variables such as the

availability and quality of datasets used, and the quality of filters were

considered.

In terms of the other statistical parameters, the TPR, specificity,

precision, and f-score are preferable to yield high values. The true

positive rate (TPR), also known as recall and sensitivity, indicates the

correct predictions in the positive class. A high TPR value is, the

indicates that the model is good at correctly predicting the positive class,

which in this study is the STEMI ECG. On the other hand, specificity,

also known as the true negative rate (TNR), indicates the correct

predictions in the negative class. It indicates how good the model is at

classifying normal ECG. Regarding the precision, it provides the ratio of

true positives among the predicted positive class. It tells how consistent

105
Ateneo de Zamboanga University

the model can predict STEMI. Furthermore, the f-score is the harmonic

mean between precision and recall which sums up the predictive

performance of the model.

Regarding the FPR, it is preferable to yield a lower value. The

false positive rate (FPR) indicates the incorrect predications in the

positive class. The lower the FPR is, the better the model is in classifying

STEMI.

3.3.1.3 Testing Storage Module

Manual checking will be conducted if the ECG data has

successfully been stored in the local storage. It will be done by first

acquiring an ECG sample which will be saved as a file. It will then be

accessed and viewed if the ECG data is present and saved within the

allotted folder within the SD card with an appropriate label or file name.

All factors involved in testing this module can be guaranteed to be fixed,

therefore, after ten trials, the expected success rate is 100%.

3.3.1.4 Testing Alert System Module

In testing the alert system module, it would be set by default to

send a message via SMS and voice call using a python-coded algorithm.

It is expected to be received by the designated contact person. The time

interval when the message and call is received will also be considered.

With the parameters involved in testing this module, stability can be

106
Ateneo de Zamboanga University

ensured. Hence, the expected success rate is 100% for each of the ten

trials.

3.3.1.5 Testing Display System

To evaluate if the display system functions accordingly, text or

message indicators must be provided or displayed on the LCD screen.

Random messages are set in a python-coded algorithm to be displayed

on the LCD. The output message shown in the LCD must match the

inputted message. Given that all variables can be guaranteed to be

secured, it is expected to have 100% success rate after ten trials.

3.3.1.6 Testing Battery Module

In evaluating the battery module, it must be tested to determine

whether the power bank can power up the other modules involved in

PHAAS upon use — all modules must be functional. Simple connection

between the modules and the power bank is required in doing this

testing; hence, the success rate is expected to be 100% after testing it

ten times.

On the other hand, the length of time as to how long the battery

can support the modules will be tested; it will be done by recording the

time from when the battery module began to power up the other modules

until the time the power runs out. The estimated amount of time it can

support the modules is around six hours; the calculation of the estimated

value is provided in section 3.2.1.6. The result of the test is expected to

107
Ateneo de Zamboanga University

be around the same value from the estimation, yet it may be different in

actual application as some unconsidered factors may appear; hence a

95% success rate after ten trials.

Table 3-1. Summary of functional testing

No. of Trials
Objective

Expected

Success
Method
Module

Output

Rate
Test

Acquisition Determine if Visual 10 Module can At least


and Signal ECG is confirmation acquire ECG 95%
Processing acquirable of ECG signal and is
Unit and digitally using accessible
accessible python- digitally
coded
algorithm

Determine if Visual 10 Simulated At least


capable of comparison ECG noises 90%
filtering ECG of filtered are filtered
noises and clean (filtered ECG
ECG using is closely
python- similar to
coded clean ECG)
algorithm

Analysis Determine if 5-fold cross 10 Model shows At least


Module model shows validation generalization 90%
generalization using

108
Ateneo de Zamboanga University

training
dataset

Determine if Using 10 Model At least


final model testing displays good 90%
effectively dataset performance
classify
normal from
STEMI ECG

Alert Determine if Attempt 10 Messages 100%


System GSM can sending are received
send random by assigned
messages via messages contact via
SMS and to assigned SMS and
voice call contact via voice call
SMS and
voice call

Storage Determine if Manual 10 ECG files are 100%


Unit acquired checking of found in the
ECGs are files in allotted folder
saved in local micro-SD in micro-SD
storage card card

Display Determine if Attempt 10 Texts 100%


System LCD can randomly displays
display showing accordingly
messages messages
on screen

109
Ateneo de Zamboanga University

Battery Determine if All modules 10 All modules 100%


Module power bank that are are working
can support integrated
the are fully
integration of functional
all modules

Determine Record 10 Power bank 95%


how long the length of is expected to
power bank time from last around 5
can support start of use hours
the device until power
is out

3.3.2 System Testing

This section elaborates the process involved in system testing. It is the

evaluation of the device's overall functionality in which the individual modules'

functions are tested as an integrated system. The test will be conducted using

the Fluke Prosim8 Vital Signs simulator.

Fluke Prosim8 Vital Signs simulator is an equipment capable of

simulating various ECG conditions such as normal and ST-elevated ECGs. It

can also add artifacts, such as muscle movement, wandering baseline,

powerline interference, and respiration.

In terms of the ST-elevated ECGs, the ST-elevation value that it can

generate range from +0.05 to +0.80mV. On the other hand, for the artifacts

provided, an option for controlling the size is provided. The artifact sizes are

110
Ateneo de Zamboanga University

represented in terms of percentages wherein the options extend to 25%, 50%,

and 100%.

To ensure consistency in the expected results when applying the system

testing, finding the ST-elevation threshold the machine learning model can

detect and the effect of various artifact size to the machine learning prediction

is needed. To conduct this test, five trials will be considered where each trial is

composed of a specific simulation. For each trial the following test cases are

considered:

Test case 1: ECG simulation without artifacts

Test case 2: ECG simulation with 60Hz powerline interference

Test case 3: ECG simulation with baseline wander

Test case 4: ECG simulation with respiration artifact

Test case 5: ECG simulation with muscle artifacts

For each trial, all the three available artifact cases and all available nine

ST-elevation, including normal ECG are considered. The results of this test will

decide the parameters considered under system testing. The ST-elevation

threshold will be determined in terms of the total STEMI predicted; a success

rate of 90% is considered, the least values that passes the success indicated

success rate will be chosen. As for the artifact size, its influence on the

prediction of the machine learning algorithm will be determined via the accuracy

of prediction. The average accuracy, per each artifact size is calculated and

compared. A success or accuracy rate of 90% is expected, the largest artifact

111
Ateneo de Zamboanga University

size that meets the expected success rate will be considered. Upon acquiring

these parameters, system testing can be proceeded.

Proceeding towards system testing, there will be two cases of test. The

first case includes the simulation and testing of ECG with ST-elevation. The

second case, on the other hand, tests and simulates normal ECG. In each

case, there will be a total of three phases or integration of modules. Phase 1

integrates the acquisition and signal processing unit along the data analysis

and battery modules. Phase 2 combines the modules involved in phase 1 with

the storage and display modules. Lastly, phase 3 is the integration of all the

modules involved in the PHAAS device.

Per each phase, at least a 90% of success rate is expected in both

cases. Factors such as type of electrode used, the electrode placement, quality

of dataset used in training the machine learning, and quality of filters and

feature extraction are considered in the estimation of the success rates. Per

module, five trials will be conducted where each follows the test cases from the

previous test conducted which is determining ST-elevation and artifact size

threshold.

Each phase will be evaluated in terms of how each module responds to

their assigned simulated ECG. Each modules involved are expected to yield

appropriate outcomes, which are provided in tables 3-2 and 3-3. The

corresponding procedures in verifying the results per each module will adapt

the methods indicated in section 3.3.1; except for the data analysis module

wherein k-fold cross validation will not be included anymore given the input

112
Ateneo de Zamboanga University

signal will not be from the online database but from an ECG simulator. The

function of the data analysis module will be determined by the prediction it

provides per trial. In addition to this, after the test, the data acquired will be

used and collected to determine model performance.

For the summary of details per each system testing, refer to Tables 3-2

and 3-3. The phase group, modules involved, number of trials to be conducted,

expected output, and expected success rate are included in the tables.

Table 3-2. Case 1 for System Testing


Case 1: ECG with ST-elevation

No. of Success
Phase Modules involved Expected output
Trials rate

I (1) Acquisition and - ECG is acquired and 5 At least


Signal Processing filtered 90%
Unit

(2) Analysis - Correctly predicts


Module ECG with heart attack

(3) Battery Module - Battery can power up


the modules involved

II (1) Acquisition and - ECG is acquired and 5 At least


Signal Processing filtered 90%
Unit

(2) Analysis - Correctly predicts


Module ECG with a heart attack

113
Ateneo de Zamboanga University

(3) Battery Module - Battery can power up


the modules involved

(4) Storage Unit - Saves ECG acquired


to local storage

(5) Display System - Displays in


accordance with what is
predicted by the data
analysis module

III (1) Acquisition and - ECG is acquired and 5 At least


Signal Processing filtered 90%
Unit

(2) Analysis - Correctly predicts


Module ECG with a heart attack

(3) Battery Module - Battery can power up


the modules involved

(4) Storage Unit - Saves ECG acquired


to local storage

(5) Display System - Displays in


accordance with what is
predicted by the data
analysis module

(6) Alert System - Course of action in


accordance with what is
predicted by the data
analysis module

114
Ateneo de Zamboanga University
Table 3-3. Case 2 for System Testing
Case 2: Normal ECG

Modules No. of Success


Phase Expected output
involved Trials rate

I (1) Acquisition and - ECG is acquired and 5 At least


Signal Processing filtered 90%
Unit

(2) Analysis - Correctly predicts


Module Normal ECG

(3) Battery Module - Battery can power up


the modules involved

II (1) Acquisition and - ECG is acquired and 5 At least


Signal Processing filtered 90%
Unit

(2) Analysis - Correctly predicts


Module Normal ECG

(3) Battery Module - Battery can power up


the modules involved

(4) Storage Unit - Saves ECG acquired to


local storage

(5) Display - Displays in accordance


System with what is predicted by
the data analysis module

115
Ateneo de Zamboanga University

III (1) Acquisition and - ECG is acquired and 5 At least


Signal Processing filtered 90%
Unit

(2) Analysis - Correctly predicts


Module Normal ECG

(3) Battery Module - Battery can power up


the modules involved

(4) Storage Unit - Saves ECG acquired to


local storage

(5) Display - Displays in accordance


System with what is predicted by
the data analysis module

(6) Alert System - Course of action in


accordance with what is
predicted by the data
analysis module

3.3.3 Beta Testing

This section explains the application of user acceptance towards the

PHAAS device, mainly in terms of portability and comfortability. This type of

testing involves a real user using the device. This test aims to expose the

developed PHAAS device to a realistic setting of applications such as common

everyday activities like walking and sitting. Moreover, five healthy volunteers

are expected to participate with a duration trial of three hours within their day.

116
Ateneo de Zamboanga University

The beta testing will be done in three phases: pre-test, during the test, and

post-test.

In the pre-test, providing the consent form, acquisition of the participant’s

profile, and orientation about the test will be conducted. The consent form will

first be given where the participant must provide her consent in his/her

participation in the test to be conducted, see Appendix D. Afterward, if

consented, the participant’s profile will be acquired. This is mainly to confirm

that the involved individual is in good health. This will be done by answering a

set of questions as shown in Appendix E. On the other hand, the orientation

will inform the participants regarding the purpose of the test. Additionally, the

function of the device will also be explained and also what to expect during the

testing.

During the test, the proponents will guide the participants throughout the

process. The proponents will make the participants conduct a list of activities,

which in total are six namely sitting, standing, laying down, walking, running,

and jumping. For every activity, five trials are conducted. Results including the

raw data, filtered data and the ECG predictions are saved.

After the trial, the participants are expected to answer a survey regarding

their experience and assessment of the device. The post-survey will utilize a 5-

Likert scale and open-ended questions mainly revolving around the portability

and comfortability of the device as shown in Appendix F. In terms of evaluating

the survey results, this will be done only in terms of the 5-Likert scale, wherein

117
Ateneo de Zamboanga University

the acceptable range of value is around 3.41 to 5.00 which is representative of

the overall participants agreeing with the provided statements.

In terms of determining the capability of the machine learning model to

correctly detect the type of ECG, collected data from the healthy volunteers are

used. Furthermore, the details regarding the beta testing are summarized in

Table 3-4. The corresponding perimeters and procedures are provided.

Table 3-4. Summary of Beta Testing


Beta Testing Perimeters
No. of Participants 5 Healthy Volunteers
Beta Testing Procedure
Test Phase Action
- Acquiring participant profile and health condition
using a questionnaire
- Orienting the participants about the purpose of the
Pre-test
test, the function of the device, expectation of
intermittent monitoring, and listing of activities for
during the trial.

- Volunteers conduct the list of activities.


During Test
- ECG status, raw and filtered data are recorded

- Participant to answer the evaluation survey; it is


made using 5-likert scale supported by open ended
Post-test
questions. Survey is mainly about portability and
comfort of use by the volunteer.

118
Ateneo de Zamboanga University

CHAPTER IV
ENGINEERING DESIGN
This chapter discusses the implementation of the modules of the Portable Heart

Attack Alert System, including the hardware and software used and the integration of

each module.

Figure 4-1 Block Diagram of the Experimental Setup of the Proposed Device

Shown in Figure 4-1 is the block diagram of the experimental setup of the

proposed device. Before the acquisition of ECG data, ECG electrode patches are

attached to a user following the Chest Lead II set-up. Once the user is set-up,

acquiring and pre-processing ECG data will be done with the use of the acquisition

and signal processing unit which consists of the Analog ECG Sensor and the

ADS1015 Analog to Digital Converter. After data acquisition, filtering of data, and

119
Ateneo de Zamboanga University

extraction of features, the SVM machine learning algorithm will classify whether the

ECG acquired is Normal or STEMI. The storage unit, which consists of the 128GB

Micro-SD Card, is responsible for storing the ECG data. This data includes the raw

and filtered data, features, and the predicted ECG class; all are stored locally within

the device and can be used by the clinicians for further review and diagnosis of the

user. The display module, which consists of the 16x2 LCD Display, will display the

ECG status for the user’s situational awareness, especially for possible cases of silent

myocardial infarction. The ECG status that are to be displayed depending on the result

of the data analysis module is either Normal ECG or STEMI ECG. In the case that

Normal ECG is detected, the LCD Display will display “Normal ECG”. On the other

hand, in cases if a STEMI ECG has been detected, the LCD will display “STEMI ECG

Detected” and the alert system module which consists of the GSM Module, will be

activated. Once activated, the GSM Module will send a text message via SMS and

make a call to the designated contacts which includes the user and the involved

clinician before repeating the entire process once again. Lastly, the battery module

which consists of the power bank, is the power source of proposed device. This

module is what allows the proposed device to be portable.

4.1 Hardware Design

This section discusses the development of the hardware components under

each module. Figure 4-2 shows the complete wiring diagram of the proposed device.

120
Ateneo de Zamboanga University

Figure 4-2. Complete Schematic Diagram of the Proposed Solution

4.1.1 Acquisition and Signal Processing Unit

The hardware components used in the acquisition and signal processing

unit include the ADS1015 12-bit ADC and Analog ECG Sensor. Shown in

Figure 4-3 is the schematic diagram of the acquisition and signal processing

unit.

Figure 4-3. Schematic diagram of Acquisition and Signal Processing Unit

121
Ateneo de Zamboanga University

4.1.1.1 Analog ECG Sensor

In this study, the Analog ECG Sensor was used to acquire raw analog

ECG data from the user. The output pin of the sensor is connected to the

analog output channel of the ADC. This allows the analog signals to be fed to

the ADC for conversion.

4.1.1.2 ADS1015 12-bit ADC

In this study, the ADS1015 12-bit Analog to Digital Converter was used

to automatically convert the analog signals from the Analog ECG Sensor to

digital signals before feeding that data to the Raspberry Pi 4.

4.1.2 Data Analysis Module

In this study, the Raspberry Pi 4 microprocessor serves as the main

component. It features a 64-bit quad-core processor running at 1.5 GHz, up to

8GB of RAM, a micro-SD card slot for storage, has 40 GPIO pins to control or

interface with other hardware components, and uses a USB C power to power

the device.

4.1.3 Storage Unit

The hardware component used in the storage unit includes a Micro-SD

Card placed in the micro-SD card slot of the Raspberry Pi 4. This micro-SD

card features a speed class of Class 10 and U1, and a capacity of 128 GB of

storage, all of which are compatible with the Raspberry Pi 4. Stored inside the

micro-SD card is the operating system, the necessary software, libraries, and

122
Ateneo de Zamboanga University

files to make the proposed solution run as a whole. Shown in Figure 4-5 is the

schematic diagram of the storage module.

Figure 4-4. Schematic Diagram of the Storage Module

Figure 4-5. Schematic Diagram of Alert System Module

123
Ateneo de Zamboanga University

4.1.4 Alert System Module

The hardware components used in the alert system module include the

GSM Module connected to the Raspberry Pi 4. This will notify the designated

contacts of the subject through SMS and call that STEMI ECG has been

detected. Shown in Figure 4-5 is the schematic diagram of the alert system.

4.1.5 Display Module

The hardware component used in the display module includes the 16x2

LCD Display connected to the Raspberry Pi 4. This will display the ECG Status

of the subject in terms of whether Normal or STEMI ECG is detected. Shown

in Figure 4-6 is the schematic diagram of the display module.

Figure 4-6. Schematic Diagram of Display Module

124
Ateneo de Zamboanga University

4.1.6 Battery Module

In this study, the power bank utilized is power bank with a capacity of

10,000 mAh with an output voltage of 5V and a maximum output current of 3A,

all of which fit the power requirements of the Raspberry Pi 4.

4.2 Software Design

This section discusses the development of the software components under

each module.

4.2.1 Acquisition and Signal Processing Unit

This module involves the acquisition of ECGs and the application of

filters and feature extraction methods. The indicated functions involved are

discussed as follows.

4.2.1.1 Acquiring ECG Data

The acquisition of ECG data mainly involves two hardware

components which are namely the ECG sensor and ADC. The ECG

sensor is responsible for collecting the Analog ECG signal from either

an ECG simulator or an actual user following the chest lead II placement.

Meanwhile, the ADC will be receiving the analog signal values directly

from the sensor, and automatically converts them to their digital

equivalent. With this, digital signal is now accessible by the software,

mainly the Python ran by the microprocessor. To access it, Listing 4-1

shows the corresponding codes.

125
Ateneo de Zamboanga University

Listing 4-1. Set ADC Sampling Rate and Gain

Line 54 initializes the I2C bus and specifies the pins used for I2C

communication; in this case, that is the SCL and SDA pins on the Raspberry

Pi 4. Line 55, on the other hand, initializes the ADS1015 12-bit ADC with the

argument “i2c” indicating that the ADC will use the I2C pins to interface with

the Raspberry Pi 4. Furthermore, line 56 uses the instance “AnalogIn” to read

the analog signals from the ADC. In this case, the arguments “ads” and

“ADS.P0” are indicated to specify that the analog input is to be taken from

Channel 0 of the ADS1015 12-bit ADC. Lines 57 and 58 set the data rate and

the gain of the ADC. The data rate, which specifies the sampling frequency of

the ADC is set to 250 while the gain which specifies the gain of the

programmable gain amplifier used to amplify the signal before it is converted

to a digital signal is set to 16 or +/- 0.256 V. For choosing the stated data rate

and gain of the ADC, the values are based on acquisition parameters used

from the European ST-T database with the goal of inputting conditions that is

closest to what is provided. In this case, the provided sampling rate is 250Hz

and the gain in which the signal is amplified for every 1mV is 200 adu/mV.

Listing 4-2. Acquisition of 2500 samples

126
Ateneo de Zamboanga University

In terms of code provided under Listing 4-2, it indicates the

acquisition of 2500 samples acquired. A loop was used to ensure the

correct number of samples were collected, unless met, the loop will not

stop.

The use of 2500 samples was mainly adapted from the 10-

second interval of ECG acquisition used by Chowdhury et.al (2022) but

due to limitations of processing time of the Raspberry Pi to used, the

equivalent samples were utilized to ensure consistency in the amount of

data fed to the analysis module during application or use. This also

ensures that the input signal is in alignment to what is expected by the

machine learning algorithm used to train it, which is also in terms of 2500

samples. In calculating the corresponding samples from the indicated

time, the provided equation 4.1 is used.

1
𝑓𝑠 = (4.1)
𝑇

From the provided equation, to calculate the corresponding

samples from the indicated time (represented as seconds), it can be

simply done by multiplying the time by the sampling frequency. As

mentioned, 10 seconds was adapted, if it is multiplied to 250Hz, the

result is 2500 samples.

4.2.1.2 Designing Filters

In the proposed design of PHAAS, filters were applied after

acquiring the ECG data. This is to remove unwanted noises present in

127
Ateneo de Zamboanga University

the ECGs such as random spikes and baseline wander. To address the

noises; bandpass, moving average, and median filters were designed.

In designing of the filters, the main platform used was Python.

Furthermore, the data from the European ST-T database were used to

provide initial test regarding filter performance to ensure the application

of filters is set to work as to how it is intended.

4.2.1.2.1 Bandpass Filter

The bandpass filter mainly functions to ensure that the

frequencies involved in the acquired signal are mainly within the

frequency range of ECG, which is around 0.5 to 100Hz

(Appathurai et al., 2018).

The bandpass filter was developed using the Heartpy

module available in Python. The module provides a wide variety

of function that allows the analysis, visualization, and pre-

processing of bio signals (Python Heart Rate Analysis Toolkit,

n.d.). In addition to this, filters are available which are utilized by

the proponents. The following function used is shown in Listing

4-3 and the main parameters considered are the cutoff

frequencies, sampling rate, the data to be processed, and the

filter type desired.

Listing 4-3. Bandpass Filter Design using HeartPy

128
Ateneo de Zamboanga University

4.2.1.2.2 Moving Average Filter

On the other hand, for the moving average filter, the main

purpose is for smoothing effects, or simply, the removal of

random spiking noises. In designing the filter, the Pandas

module, which is an open-source library available in Python will

be used. Pandas allow data manipulation and analysis of data

and are supported by a wide variety of mathematical operations

(pandas, n.d.). The corresponding code for creating the moving

average filter is shown in Listing 4-4.

Listing 4-4. Moving Average Filter Design using Pandas Library

As can be seen from Listing 4-4, the filter was designed as

a function that is callable when the filter is ready for application.

Under these, a series of codes are provided that primarily allows

moving average filter to work. The main parameter involved in

129
Ateneo de Zamboanga University

designing the filter is the window size as shown in code line 11.

From line 21, the data acquired was converted in a series format.

This allowed the window size to be set in motion (can move from

one sample to another) and calculate the corresponding mean of

the values included within the window size; these are represented

by code lines 24 and 27, respectively. Typically, the output of the

rolling window includes missing values represented by NaN,

specifically for the first ‘window_size – 1’ values. This is due to

the indicated window size - unless the values involved are

equivalent to the provided window size, missing values will be

returned. Nawale (2022) stated that missing values in the dataset

can affect model performance by encouraging bias. With this,

removal of the missing value was necessary which was done

along code line 30. To retain the 2500 samples length of the data,

appending of the first encountered non-missing value was

conducted which was made possible by code lines 33, 36, and

39.

In terms of choosing the value for the main parameter, the

window size, two methods will be used. First is in terms of time-

domain observations, and second is in terms of frequency

domain.

Given that the filter is applied along the time-domain, the

window size will be chosen through visual inspection of the

130
Ateneo de Zamboanga University

effects of the filter via random sample ECGs from the online

open-source dataset. Initially, window sizes yielded the most

smoothing effect at around 7, 11, and 15; these values are then

used as options for the window sizes.

Figure 4-7. ECG Plots of Different Window Sizes

Figure 4-7 shows the plots of various window sizes

applied. As can be seen, the first plot shows the randomly chosen

raw data and it shows that there are random noises present. The

second plot, with a window size of 7, is shown to be able to

smooth out noises, yet some are still retained. In comparison to

the third plot, with a window size of 11, the ECG can smooth it

more effectively but slight distortion from the original pattern is

observed. Lastly, for the fourth plot, with a window size of 15,

evident change of pattern from the original, specifically the R-

wave was shown.

From the observed effects of window sizes, the

proponents opted to initially choose window size 11 by prioritizing

131
Ateneo de Zamboanga University

and maximizing the smoothing effects. Despite the slight

distortion observed, no relevant ECG part was removed and no

major changes in the pattern occurred. Nevertheless, given that

the filter designed are both applied during training of the model,

and prior to application of the trained model, it can be said

compensation is expected as the same effects will occur upon

application.

To further confirm if the window size chosen is appropriate,

analysis of the frequency domain is provided. The frequency

distribution and magnitude response are acquired and compared.

The corresponding plots per each window size chosen are

provided under Figures 4-8, 4-9, and 4-10, respectively.

Figure 4-8. Frequency Response of Moving Average Filter with


Window Size 7

Figure 4-9. Frequency Response of Moving Average Filter with


Window Size 11

132
Ateneo de Zamboanga University

Figure 4-10. Frequency Response of Moving Average Filter with


Window Size 15

The plot that showcases the main difference among the

application of various window size is the magnitude response: for

filter with window size 7, the attenuations occur at approximately

35Hz; for the filter with window size 11, attenuation are more

evident at frequencies around 22 Hz and 50Hz; lastly for window

size 15, the frequencies attenuated are around 18 and 32Hz. This

indicates that for each window size involved, unique or varying

frequencies are attenuated. Furthermore, the corresponding

frequency spectrum supports the indicated attenuation in the

magnitude response as the same frequencies displayed on the

frequency spectrum plot, showcased removal or reduction in

amplitude.

In choosing the window size using the frequency domain

acquired, the basis would be in terms of the unwanted

frequencies, namely noises. According to Abbaspour and Fallah

(2014), a common random noise such as electromyogram or

muscle noise contains the highest frequency power between 20

133
Ateneo de Zamboanga University

Hz and 150 Hz. Supported by Chatterjee et.al (2020), the muscle

artifact’s spectrum range falls between 20 to 1000Hz.

Additionally, upon removal, the effects were stated to conduct

modifications of a signal’s local waveform.

Another form of common random noise is the powerline

interference which ranges to less than 1Hz where the band in

local terms is along 60Hz. Accordingly, removal of the noise may

result to distortion in amplitude, duration, and shape of low-

amplitude local waves of the ECG signal. The factors that have

contributed to the mentioned effects are due to the overlapping

ranges of frequency between EMG, ECG, and 60Hz powerline

interference. Nevertheless, the removal of the mentioned noises

are necessary given ECG signals provides important information

that ensuring reliable interpretation of the heart's electrical activity

for both medical personnel and machine learning training.

From the indicated ranges of frequencies, specifically from

muscle noise, it can be said that the most suitable window size is

11 given attenuation begins closest to 20Hz and continues

onwards. Therefore, from considering suitability and effects on

both time and frequency domain, 11 will be the chosen window

size.

134
Ateneo de Zamboanga University

4.2.1.2.3 Median Filter

Last but not the least filter to be designed is the median

filter, which is mainly for addressing baseline wander. According

to Chowdhury et al. (2022), the combination of two median filters

with width sizes of 200ms and 600ms is an optimal way of

acquiring the baseline wander. By subtracting the ECG signal

from the resultant of the median filters, baseline wander can be

removed. With the use of the SciPy module available in Python,

the median filters were designed. SciPy offers a wide variety of

scientific computing algorithms that allows multiple application,

such as, but not limited to signal processing and analysis (SciPy,

2023).

Listing 4-5. Median Filter Design using Scipy Module

The main parameter in designing the median filters is the

kernel size or the window width as shown in Listing 4-5, code

lines 49 and 52. To acquire the window sizes in terms of samples,

the provided window width of 200ms and 600ms is simply

multiplied by the known sampling rate of 250Hz. With this, we get

135
Ateneo de Zamboanga University

window sizes of 50 and 150 samples. Unfortunately, one of the

limitations of the median filters of the SciPy module is that it only

accepts kernel sizes of odd numbers. With this, the proponents

opted to subtract the kernel sizes by 1, which gives 49 and 149

samples for the kernel sizes. The final application of both filters is

shown under code line 55 where the results of median filter were

subtracted to the original data.

Figure 4-11 shows the results of the application of the

moving average and median filters to a sample from the online

database that displays evident baseline wander. As can be seen

in the third plot, the baseline wander was addressed by the

designed median filter and the ECG sample aligns along zero

millivolts of the y-axis.

Figure 4-11. Application of Moving Average and Median Filters

136
Ateneo de Zamboanga University

4.2.1.3 Feature Extraction

After designing the filters, feature extraction was conducted.

Feature extraction is a vital procedure in aiding machine learning

algorithms to increase the chances of good performance by acquiring

new numerical data from considered datasets. As suggested for the

PHAAS design, the feature extraction methods include the extraction of

power spectral density, continuous wavelet transform, and synthetic

features of the filtered ECG samples. The corresponding methods used

in extracting the features are discussed below.

4.2.1.3.1 Power Spectral Density

In the extraction of power spectral density, the Scipy

module offers a function that enables the calculation of it. The

following code is shown in Listing 4-6.

Listing 4-6. Power Spectral Density Extraction using Scipy

The function, shown in code line 33, extracts the sample

frequencies (f), and the power spectral density (S) from the input

data (filtered data); the necessary output needed is only the

power spectral density (S). In terms of parameters, it includes the

sampling frequency of 250Hz, and setting the scale to ‘density’

dictates the function to calculate the power spectral density. With

137
Ateneo de Zamboanga University

input data of 2500 samples (ECG data), the power spectral

density acquired consists of around 1251 samples.

4.2.1.3.2 Continuous Wavelet Transform

The continuous wavelet transform, on the other hand, is

extracted with the help of the PyWavelets module available in

Python. PyWavelets is an open-source wavelet transform

software that allows the use and application of wavelets for

various purposes (PyWavelets, n.d.).

Listing 4-7. Continuous Wavelet Transform Extraction using pywt

The main parameters involved in acquiring the continuous

wavelet transform are the type of wavelet to be used and the

scales of the corresponding wavelets. According to Xie et al.

(2015), the use of the Mexican Hat wavelet is an effective and

efficient way to extract features of ECG. Accordingly, scales of 2 3

and 25 enable the extraction of QRS and P/T waves, respectively.

The proponents followed the parameters accordingly and the

resulting CWT wavelet and scales yielded a total of 5000 sample

features (2500 samples per each scale). The main code used for

this extraction is shown on Listing 4-7.

138
Ateneo de Zamboanga University

4.2.1.3.3 Gplearn Synthetic Features

In acquiring the synthetic features, on the other hand, the

gplearn (genetic programming) module is used, which is also

available in Python. The function used to conduct this process is

the Symbolic Transformer which initially utilizes a supervised

transformer that uses random formulas to represent relationships

between the original features in order to generate new ones

(gplearn, n.d.). The code for acquiring synthetic features is shown

in Listing 4-8.

Listing 4-8. Acquiring Synthetic Features using gplearn

To acquire the formula for calculating the synthetic

features, the gplearn function is trained using all the initial

features acquired from the training data (see code line 25). The

original features acquired are namely the filtered data, the power

spectral density, and the continuous wavelet transform; a total of

8751 samples of features. After training the gplearn model, it is

then saved as a ‘-.sav’ file as provided in code lines 27 and 28,

which can be called later on to calculate the synthetic features.

139
Ateneo de Zamboanga University

For the indicated codes from lines 17 to 20, ‘function_set’ and

‘SymbolicTransformer’ were applied following the default values

of the parameters.

Furthermore, the total number of synthetic features

calculated was set to 100 as shown in code line 14, which is the

maximum number of synthetic features that can be acquired. This

then leads us to a total of 8,851 samples of features to be used

for training the SVM machine learning algorithm.

4.2.2 Data Analysis Module

The main development conducted under this module is the training and

testing of the SVM machine learning in the binary classification of STEMI and

Normal ECG. Other procedures included data collection, pre-processing, and

splitting of data. Mainly, the data used were acquired from the European ST-T

database.

4.2.2.1 Data Collection

Given the proposed machine learning algorithm used an online

open-source database namely European ST-T database, appropriate

data collection and analysis were required. With this, the following

methods were executed.

140
Ateneo de Zamboanga University

4.2.2.1.1 Analysis of Database

The European ST-T Database, upon analysis, consists of

a total of 90 annotated patient records each diagnosed or

suspected of Myocardial Ischemia. Per patient record, two ECG

signals were recorded from two different channels. This entails

that from the 90 patient records provided, a total of 180 ECG

recordings are available, each with a two-hour duration.

In terms of the conditions used in the acquisition of the

provided ECGs, consistency was observed; all records followed

a sampling frequency of 250Hz, a gain of 200adu/mV, and an

ADC resolution of 12 bits.

Additionally, further analysis of the database was

conducted via PhysioBank ATM, which is an online toolbox

accessible on web browsers that allows the exploration of

PhysioNet databases (PhysioBank ATM, n.d.). The proponents

explored the general information regarding each record such as

the plots of the ECG data. A variety of ECG records were

provided in the database, where readings acquired extended

from V1, V2, V3, V4, V5, and V6, down to modified lead

placements. Unfortunately, none of the records provided includes

Lead II placements. Despite this, according to Dr. Hadjail-Ismael,

a cardiologist from the HRT Medical & Maternity Complex, ST

elevation is a consistent characteristic for all ECGs despite the

141
Ateneo de Zamboanga University

electrode placement. Therefore, the proponents proceeded to

use the chosen database, but heavy consideration of the

similarity of the pattern to Lead II reading was conducted.

The criteria on how to choose the ECG records included

an upright display of R-wave (the R-wave is located on the

positive side of the y-axis in plots) and an observed display of P-

wave, QRS wave, and T-wave. Following the stated criteria, from

a total of 180 ECG readings from the database, 60 were chosen.

4.2.2.1.2 Data Extraction

After analyzing and acquiring the necessary information

from the database, extraction of the data was performed. In this

method, The WFDB (Waveform Database) Toolbox via

MATLAB/Octave was used. The necessary files that allowed the

extraction of the necessary data (ST-elevated and normal ECGs)

were the annotation file and ECG records which are in ‘. atr’ and

‘.dat’ format, respectively. The ECG records mainly contain the

values that make up the amplitude of the recorded ECG signal

while the annotation file contains the annotations that indicate

certain events that have occurred from the ECG such as ST-

Elevated or Normal cycles. Under this method, accessing

annotation file, accessing ECG file, and extraction of relevant

data was initiated. The main platform used in this method is

MATLAB.

142
Ateneo de Zamboanga University

4.2.2.1.2.1 Accessing Annotation File

As mentioned, the annotation file provides the

annotation that allows the interpretation of the type of ECG

present in the provided records from the online dataset.

With this, the proponents were able to recognize what part

of the reading are Normal and ST-elevated.

Listing 4-9. Accessing Annotations

Listing 4-9 shows the code used for reading the

annotation file and acquiring the information available. The

main function that allows this is the use of ‘rdann’ shown

in code line 7. On the other hand, for lines 10 to 11, there

are six outputs provided by the function. The most relevant

of all are namely ‘ann’ and ‘comments.’ The ‘ann’ output

provides the sample value of the corresponding

annotation, while the ‘comments’ are string annotations

that provide labels for the start, peak, and end of events

present in the ECG.

There were various string annotations for various

ECG events provided in PhysioNet’s interpretation file. In

143
Ateneo de Zamboanga University

the case of this study, the relevant string annotations were

as follows:

(N Normal sinus rhythm

(ST... Beginning of the ST episode

AST... The peak of the ST episode

ST...) End of ST episode

From the list of annotations provided, each

character indicated a specific meaning (PhysioNet, n.d.).

As can be observed in the provided list, the open

parenthesis indicates the beginning of an event. The

closed parenthesis, on the other hand, indicates the end

of an event while the letter ‘A’ indicates the peak of an

event where peak values are also included.

The labels ‘N’ and ‘ST’ indicates the event involved

in the ECG. With ‘N’, the ECG is indicated as a normal

ECG while if ‘ST’, it indicates episodes related to ST

segments.

In addition to this, for the ST-episode-related

annotations, the type of deviation is indicated using ‘+’ and

‘-’ symbols; the plus symbol for ST-elevation, and minus

symbol for ST-depression. In the case of this paper, only

the plus symbol is considered given that the proponents

144
Ateneo de Zamboanga University

aim to acquire ST-elevated ECGs, which are indications of

a potential STEMI.

Furthermore, a signal number is also included,

given that each patient record consists of two ECG

readings. The first ECG signal is labeled as ‘0’, and the

second ECG signal is labeled as ‘1’.

Overall, if a ‘(ST0+’, annotation is encountered, it

indicates the beginning of an ST-elevation at signal

channel 0. If ‘AST0+200’ is encountered, it indicates the

peak of the ST-elevation at signal channel 0, with a peak

value of 200 microvolts. Lastly, if the ‘ST0+)’ annotation is

encountered, the ST-elevation at signal channel 0 has

ended.

Aside from reading the annotations, the proponents

also opted to save each annotation file as a ‘.csv’ file as

shown in code lines 12 and 16 from Listing 4-9. This is

done for easier accessibility especially when conducting

the manual acquisition of segments or sample ranges of

relevant data (further discussion is provided in section

4.2.2.1.2.3).

4.2.2.1.2.2 Accessing ECG Records

The process for accessing the ECG records was

simpler compared to the annotation file. It simply involves

145
Ateneo de Zamboanga University

reading the file and saving the data stored as a ‘.csv’ file

as shown in lines 5 to 6 under Listing 4-10. Conversion of

the file to ‘.csv’ is conducted for the same reason indicated

in the previous section.

Listing 4-10. Accessing ECG records

The main function that enables the reading of ECG

records is ‘rdsamp’ as shown in code line 4 from Listing 4-

10. The contents of the output ‘data’ mainly include two

columns: both columns provide the amplitudes of ECG

readings from two different channels.

4.2.2.1.2.3 Extracting Relevant Data

Using the accessed annotations, the segments of

the relevant data via samples, are manually acquired and

noted on a Google Sheet. Figure 4-12 showcases some

examples of the manually acquired ranges of the relevant

data with respect to their corresponding ECG record and

ECG type. Overall, from the 60 ECG records, only 7

showcased ST-elevations while all 60 records contain

normal ECGs.

146
Ateneo de Zamboanga University

Figure 4-12. Snippet of Manual Collection of Sample Ranges


of Relevant Data

Moving on, the corresponding sample ranges

obtained were used as the basis for acquiring the relevant

data from the ECG records. The sample code used for

doing so is shown in Listing 4-11, which showcases the

acquisition of normal ECG data at lines 15 to 16 (a similar

code is used for acquiring the ST-elevated ECG); the

corresponding samples used are shown on lines 11 to 12.

Listing 4-11. Collecting relevant data using sample ranges


acquired

Furthermore, as shown in code lines 19 to 23, the

relevant data are saved as ‘.csv’ files. This is to ensure that

Python can access the corresponding data when further

processing or development of the algorithm is conducted.

147
Ateneo de Zamboanga University

4.2.2.1.2.4 Downsampling the Majority Class

Based on the obtained data, there are only 7

records of ST-elevated ECGs compared to 60 records of

normal ECGs, indicating an overwhelming majority of

normal ECG data. Therefore, it is concluded that the

dataset is imbalanced in terms of data distribution. Python

was the platform used for implementing this method; also,

for the rest of the methods that comes after, python was

also used.

To determine the appropriate level of

downsampling, all the ST-elevation ECG records are first

segmented into 2500 samples. Upon doing so, a total of

269 segmentations were collected. To maximize all the

available normal ECG records and keep a close

distribution to the STEMI class, the proponents aimed to

collect 300 segmentations of the normal ECG; a total of 5

segmentations (the first 12,500 samples) from each of the

60 normal ECG records were used.

After the downsampling process, a total of 569

segmentations were collected, wherein 47% of the data

represents the STEMI ECG class and 53% represents the

normal ECG class. Based on the guidelines from Google

Machine Learning Education (n.d.), if the minority class

148
Ateneo de Zamboanga University

makes up 20-40% of the dataset, imbalance is only

considered mild. On the other hand, if the minority class

comprises 1-20% of the total dataset, the degree of

imbalance is considered moderate. If a minority class is

less than one percent, it is at an extreme. Given the

distribution percentage of the selected ECG data, it can be

initially said that the classes are balanced enough and

suitable for further processing. To further prove that the

distribution of data, the skewness is calculated.

Skewness is a statistical parameter that can

measure how evenly distributed or symmetrical the

distribution of data is (Chen, 2023). According to SPS

(2016), as a rule of thumb, the interpretation of calculated

value is as follows: values between -0.5 and 0.5 indicates

a fair symmetry; values between -1 and -0.5 or 0.5 and 1

indicates a moderately skewness; lastly, values less than

-1 or greater than 1 indicates high skewness. Upon

calculation, a value of 0.11 was acquired. Following the

provided range by SPS (2016), it can be said that the data

is fairly symmetrical, hence the distribution of class is

considerably balanced.

Before moving to the next procedure, the signals

are first segmented into 2500 samples. All segmentation

149
Ateneo de Zamboanga University

were saved in one ‘.csv’ file with each of their

corresponding class labels: 1 for the ST-elevated ECG

class, and 0 for the normal ECG class.

4.2.2.2 Pre-processing Data

In processing the data, the stated filters and feature extraction

methods are provided in sections 4.2.1.2 and 4.2.1.3, respectively were

applied. As an overview, the raw data was first processed with the use

of filters in which noises were removed with the use of bandpass, moving

average, and median filters. Afterward, feature extraction was

conducted specifically collecting the power spectral density, continuous

wavelet transforms, and gplearn synthetic features. To increase the

speed of training and testing of machine learning, the resulting data after

the pre-processing were saved into a ‘.csv’ file.

Listing 4-12. Overview of Pre-processing Data

150
Ateneo de Zamboanga University

Listing 4-12 showcases the overall filters and features utilized in

pre-processing the data. Given that all were designed as functions, the

codes were called upon application. For the filters, ‘bandpass’, ‘mov_av’,

and ‘median’, are the variables representing the application of the

bandpass, moving average, and median filters, respectively as shown in

lines 86 to 90. For the feature extraction, ‘psd’, ‘cwt_0’, ‘cwt_1’ were first

extracted which were respectively power spectral density, continuous

wavelet transforms at scale 2 3, and continuous wavelet transforms at

scale 25 shown on lines 106 to 107. Prior to finding the synthetic

features, compilation of all initial features acquired were first done as

shown on code lines 96 to 99. Afterwards all the compiled filters were

used to generate the synthetic features which was conducted under line

101 to 102 and is appending along the other filters at line 105.

4.2.2.3 Splitting Training and Testing Data

In section 3.2.2.2.4, it was indicated that the splitting of data is

done following a 70:30 ratio for training and testing the machine learning

model. This means that 70% of the data were allocated for training the

model, while the remaining 30% of the data were for testing the trained

model. Listing 4-13 shows the code used for splitting the data into

training and testing datasets.

151
Ateneo de Zamboanga University

Listing 4-13. Splitting data into a 70:30 ratio

The splitting was mainly conducted using the train_test_split()

from sklearn module as shown on lines 26 to 27. The test_size was set

to be at 0.3 which indicates 30% of the provided data were for testing.

The same goes for the train_size set to 0.7 which indicates 70% of the

data were for training. In addition to this, stratification was considered in

the splitting of data which is represented by the parameter ‘stratify’.

Stratification ensures a uniform distribution between classes upon

splitting — the same proportions of each class is distributed among the

split dataset (Menon, 2020). Following the data splitting process, as

illustrated in code lines 30 to 38, the training and testing data are saved

as separate '.csv' files.

4.2.2.4 Training Machine Learning Model

The fundamental process of training a machine learning model,

such as Support Vector Machines (SVM), involves providing the model

with labeled data that serves as the basis for self-education, enabling it

to make predictions on new, unseen data. To ensure the chances of

developing a good model, procedures were conducted prior to actual

152
Ateneo de Zamboanga University

training. According to Baylon and Usama (2022), the following methods

are effective in increasing machine learning performance:

4.2.2.4.1 Finding Optimal Hyperparameter

One effective method available in Python for finding the

best hyperparameters is using the GridSearchCV function from

the scikit-learn library. GridSearchCV performs an exhaustive

search over a provided set of hyperparameter values to identify

the optimal combination (scikit learn, n.d.).

Listing 4-14. Finding Optimal Hyperparameter

Listing 4-14 showcases the code used for finding the best

combination of hyperparameters. The model is set in code line 28

wherein the kernel is set to be linear. This is set as a default due

to the limitations of the RFECV feature selection function, which

is further discussed in section 4.2.2.4.3 In terms of the set of

hyperparameters chosen, it is indicated in code lines 31 to 34

which is represented by the variable ‘param_grid’. The chosen

hyperparameters are C, gamma, kernel, and degree which were

153
Ateneo de Zamboanga University

provided hyperparameters from the scikit library available for

SVM models.

After running the GridSearchCV, which are shown under

lines 36 to 41, the acquired optimal set of parameters were as

follows: SVC (C=0.1, degree=1, gamma= ‘scale’, kernel='linear').

4.2.2.4.2 Standard Scaling of Features

In this method, standard scaling from the sklearn library

were used. The scaling is conducted through removal of the

mean and scaling the values to unit variance.

Listing 4-15. Saving Scaling Model

Listing 4-15 includes the code that demonstrates the use

of a scaling model. In line 17 of the code, the function

'StandardScaler()' is used for scaling, allowing for standard

scaling of the input values. The '.fit(X)' function is used to expose

the training data, denoted as X, to the scaler, which will be used

as a reference for scaling new values. After fitting the scaling

model using the training data, it can be saved as a '.sav' file using

Python's joblib library, as shown on lines 19 and 20. This allows

the scaling model to be stored for future use. The saved model

can be loaded also through joblib making it accessible for future

applications.

154
Ateneo de Zamboanga University

4.2.2.4.3 Feature Selection

Recursive Feature Elimination (RFE) is a feature selection

technique that iteratively considers smaller subsets of features

based on their importance, with the least important features being

removed at each step (scikit-learn, n.d.). This process continues

until the desired number of features is reached. Recursive

Feature Elimination Cross-Validation (RFECV), on the other

hand, is a variation of RFE that incorporates cross-validation

capabilities. It also includes a scoring parameter that allows for

the calculation of model performance for each set of chosen

features, with accuracy being the chosen metric by the

proponents.

It's important to note that RFECV only works with models

that have linear kernels. As a result, the proponents of this study

have decided to limit their model options to those with linear

kernels.

Listing 4-16. RFECV Feature Selection

Listing 4-16 includes the code for implementing RFECV

feature selection. RFECV is configured to perform cross-

validation using a stratified K-fold approach with K=5.

Furthermore, the 'scoring' parameter is set to accuracy, which

155
Ateneo de Zamboanga University

allows for the evaluation of model performance to be based

according to the yielded accuracy.

4.2.2.4.4 Saving Model

Upon applying all the mentioned methods, the models and

the corresponding list of selected features were stored in a

compressed '.zip' file using the joblib library, but only for sets of

features that achieved a minimum K-fold accuracy of 70% as

shown in Listing 4-17, code line 83. Iteration of the process is

conducted via a loop to generate multiple models with varying

accuracies and sets of features. Among all the saved models, the

chosen one is with a K-fold accuracy of 88% with 180 features

selected. Considered in choosing the model includes the

calculation of TPR, FPR, specificity, precision, F-score and

accuracy.

Listing 4-17. Saving Model with a Minimum of 70% K-fold accuracy

4.2.2.4.5 Testing Model

In this section, the model is evaluated using the testing

dataset to assess its performance on new, unseen data. Listing

4-18 showcases the code for testing the trained model.

156
Ateneo de Zamboanga University

Listing 4-18. Code for Predicting Class

Prior to the provided code in Listing 4-18, feature scaling

was already applied. The models and the selected features from

RFECV were also loaded prior to the codes provided, wherein the

features acquired from the data, from 8851, only 180 features

were selected. Furthermore, given that the trained machine

learning contains five SVM models due to the k-fold cross-

validation, each was accessed to conduct its own prediction as

shown under lists 39 to 41. The final prediction is decided based

on the calculated quantile as shown in code line 44. The quantile

is simply the median given the set of inputs. Simply, the predicted

classes that are in majority will be the final prediction.

Listing 4-19. Calculation of Evaluation Metrics

Listing 4-19 contains the code used for additional

evaluation of performance of the chosen model. It calculates the

157
Ateneo de Zamboanga University

same metrics as mentioned in section 3.3.1.2. Specifically, code

lines 56 to 60 for computing the accuracy of each fold using all

models collected from the cross validation, while code line 62

calculates the average accuracy across all folds. Code line 63

extracts the values for true positive (tp), true negative (tn), false

positive (fp), and false negative (fn) from the confusion matrix

function. These values are then used to calculate additional

performance metrics, such as true positive rate, false positive

rate, specificity, precision, F-score, and overall accuracy which

are shown code lines 63 to 69.

Also, it's important to note that much of the code used for

testing the data were incorporated into the main algorithm (code

to be used when the device is ready for actual use) with slight

modifications.

4.2.3 Storage Module

The storage module simply involves saving the necessary data acquired

from the pre-processes and model prediction conducted. Mainly this module is

designed to save two ‘.csv’ files: one includes the filtered data along with the

raw data and the other includes the features extracted. Both files include the

corresponding labels predicted by the data analysis module.

158
Ateneo de Zamboanga University

Listing 4-20. Function for saving data as CSV files

Listing 4-20 showcases the code that enables the storage of data

acquired into a ‘.csv’ file. The main function used to make this possible is the

write function (code lines 49 to 52) and append function (code lines 55 to 58),

all of which were created using the CSV module. The module provides

functions that extend but are not limited to reading, appending, and writing data

in a CSV (Comma Separated Values) file format (Python, n.d).

4.2.4 Alert System Module

The module responsible for alerting the designated contact person via

SMS and calls is called the alert system module. This module is only activated

when the data analysis module predicts a STEMI ECG. The code for the alert

system module can be found in Listing 4-21.

In Listing 4-21, the microprocessor commands the alert system module

using AT commands through serial communication. As shown in line 229, if the

“overall_prediction” indicates as STEMI (1 represents STEMI being detected),

the code inside this condition block will be executed. In this case, line 231

initializes a serial connection to the Raspberry Pi using the serial pin “serial0”

159
Ateneo de Zamboanga University

and a baud rate of 115200 with line 232 clearing any input data in the serial

buffer.

Listing 4-21. Alert System Module

On the other hand, line 234 sets the phone number to which the SMS

message will be sent, line 235 sets the phone number to which the call will be

made to the designated contact, and line 237 contains the message to be sent

to the number set for SMS message. Included with the message is “STEMI

ECG Detected” is the variable “get_date” to get the date and time STEMI ECG

has been detected. Furthermore, Line 239 contains the AT command

“AT+CMGF=1” which sets the GSM module to text mode while line 243

contains the AT command “AT+CMGS=” which commands the GSM Module

to send the SMS message to the number set to the variable “number_sms.”

The command ser.write in line 246 will insert the message set to the variable

“text_message” and line 247 will command the GSM module to finally send the

160
Ateneo de Zamboanga University

text message. The GSM module is given 10 seconds to send the SMS

message to the designated contact before moving on to the next AT command.

Line 251 contains the AT command “ATD” to dial the phone number from the

variable “number_call,” referring to the number set in line 235. The GSM

module is given 30 seconds to call the designated contact before the next

acquisition of ECG data from the subject begins. The reason for giving the GSM

Module time delays using “time.sleep” is to give time for them to process the

command and execute it in case of network delay in sending the SMS message

and call.

It is crucial to ensure that the SIM card used for the alert system module

is subscribed to an unlimited call and text plan or has sufficient balance to allow

the module to send text messages and make calls. Moreover, it's important to

note that both the subject and designated contact must be in an area with good

reception to ensure that the alert system module can effectively send text

messages and make calls. Otherwise, the alert system may not function as

intended, and the designated contact may not receive the necessary

notifications.

4.2.5 Display System

The display system is responsible for providing a text display of the ECG

status. The code used in doing so is indicated in Listing 4-22.

Listing 4-22. Display System Code

161
Ateneo de Zamboanga University

The code on line 66 calls the 'drivers.Lcd()' function, which initializes the

LCD and makes it ready for use. Once the LCD has been initialized, messages

can be displayed on it, as demonstrated by the code on lines 70 and 71.

However, it's important to note that the LCD can only display two lines of text,

with a maximum of 15 characters per line.

In order to display new messages, it's necessary to clear the previous

message displayed on the LCD. The code on line 69 accomplishes this by

erasing the previous text before displaying new text on the screen.

4.3 Set-up, Mounting, Casing

The actual experimental setup of the prototype is shown in Figure 4-13 which

consists of the modules of the prototype integrated into a recycled plastic enclosure

and a strap made of canvas that is approximately 80 cm long. As shown in Figure 4-

14, the enclosure is 18.2 cm long cm 8.9 cm wide, and 4.6 cm tall.

Figure 4-13. Actual Experimental Design of Prototype

162
Ateneo de Zamboanga University

Figure 4-14. 3D Computer Aided Design of Prototype

On the other hand, from Figure 4-15 the placements of the modules are shown

while Figure 4-16 shows the dimensions of each module in the interior of the

enclosure. The acquisition module is situated on the right side of the prototype, while

the alert system module is located at the bottom left corner, with its antenna extending

out the right side of the plastic enclosure. The microprocessor is positioned in the

middle of both modules while the battery module is situated below it and finally, the

display system is placed on the top side of the plastic enclosure.

Figure 4-15. Interior of the Experimental Design of Prototype

163
Ateneo de Zamboanga University

Figure 4-16. Dimensions of Modules in the Interior of Enclosure

In terms of proper placement of device on a user, it is shown in Figure 4-17

wherein the prototype is connected to the user following the chest lead II set-up of

ECG electrode placement. Figure 4-18, on the other hand, shows the prototype

strapped on to a user.

Figure 4-17. Prototype Connected to a User

164
Ateneo de Zamboanga University

Figure 4-18. Prototype Strapped on a User

165
Ateneo de Zamboanga University

CHAPTER V
RESULTS AND DISCUSSION
In this chapter, the proponents discuss the results obtained after conducting

the tests recommended in section 3.3. A comprehensive overview of the results

obtained from functional, system, and beta testing is provided.

5.1 Functional Testing

The objective of this test is to verify the functionality of every module utilized in

the suggested device. The outcomes of this test are presented below.

5.1.1 Acquisition and Signal Processing Module

This module is responsible for handling the collection and processing of

ECG data. Its performance is evaluated by testing the main components - the

ECG sensor and the ADC - for their ability to acquire ECG data, as well as by

assessing the impact of filter applications.

5.1.1.1 ECG Acquisition

The acquisition module test was performed using the integrated

components under section 4.1.1. The integrated components were

mainly composed of the ECG sensor, the ADC, and the Raspberry Pi.

In line with this, the ECG signal acquired was from the proponents

themselves following the chest lead II placement. The sampling rate was

set at 250 Hz and the samples acquired are equivalent to 2500 samples;

this was established using the code or algorithm to be ran by the Rpi.

166
Ateneo de Zamboanga University

For setting the sampling rate, it was done by programming the ADC as

shown in Listing 4-1. On the other hand, for acquiring the 2500 samples,

a loop was used as shown in Listing 4-2. The number of samples

acquired was confirmed by printing the length of the acquired signal in

the terminal using the function ‘len()’ wherein consistently the acquired

signals were 2500 samples each.

Furthermore, to confirm that the integrated components can

acquire ECG, plotting of the acquired values from the proponents was

generated. From there, visual confirmation was used to verify if ECG

pattern is displayed by the acquired data. A score of 1 is given if ECG

pattern is displayed, if not, a zero is provided. A sample documentation

of a test trial is provided in Figure 5-1. As can be seen from the image,

there is evident presence of R-peaks, P-waves, T-waves, and QRS-

wave despite the presence of a noise known as respiration.

Figure 5-1. Functional Test Trial 8 of ECG Acquisition

167
Ateneo de Zamboanga University

The summary of results acquired from the test are provided on

Table 5-1. The expected success rate is set at 90%. The factors

considered in setting the success rate was the appropriateness of

electrode placement and the unavoidable impedance caused by the skin

upon contact. Unprecedented noise, such as shown in Figure 5-1, is also

considered.

Nevertheless, as can be seen, from the 10 trials conducted, the

integrated components were consistent in acquiring the ECG signal.

Given that the determined success rate meets the set expectations, it

can be said that the acquisition and signal processing module is

functional in terms of obtaining ECG data.

Table 5-1. Acquisition Module Test Result Summary


Total No. Determined Success Expected Success Verdict

of Trials Rate Rate

10 100% 90% Passed

This initially proves and supports that the acquisition function of

the acquisition and signal processing module is followed as stated in

specific objective under 1.4.2.1; the acquisition of ECG can be done

following the chest-lead II placement with a set sampling rate of 250Hz,

and equivalent samples of 2500.

168
Ateneo de Zamboanga University

5.1.1.2 Filter Application

In testing the filter application, the ECG was acquired from Fluke

Prosim8 Vital Signs Simulator which is capable of simulating ECGs;

Chest Lead II placement, 250 Hz sampling rate, and 2500 samples were

followed as the conditions in the acquisition of simulated ECG.

The test was conducted with 10 trials, 5 of which represented

Normal ECG, and the rest were STEMI. Each of the trials conducted

represented a specific noise simulated by the Prosim which were namely

60Hz power line interference, baseline wander, respiration, and muscle

noise. Given that the total available noises were only eight, the fifth and

the tenth trial were decided to represent a random noise. Furthermore,

each of the noises were also tested in terms of the available

corresponding artifact sizes which were represented in percentages

namely 25, 50, and 100 percent. In terms of representing STEMI, given

that no machine learning was yet involved, random ST-elevation values

were chosen.

In evaluating the performance of filter, it was plotted for visual

confirmation of effectiveness of filter; it is checked whether the noises

were attenuated specifically random noises and baseline wander. Also,

consideration on the retention of the ECG pattern is considered.

A scoring method was used to represent the performance of the

filter, 1 is for most effective, 0.5 for fairly effective, and 0 for not effective.

169
Ateneo de Zamboanga University

The set success rate for all artifact sizes was set to 90% wherein factors

considered include unsuitability of filter in handling the noises provided.

The summary of the results is shown in Table 5-2.

Table 5-2. Signal Processing Unit Test Result Summary


Total No. Artifact Determined Expected Verdict
of Trials Size Success Rate Success Rate

10 25% 100% 90% Passed

50% 95% 90% Passed

100% 70% 90% Failed

As can be seen from the table provided, two of the provided

artifact sizes were able to pass the success rate while only one was not

able to meet it which was the highest available artifact size from the

simulator, 100%. From this result, it suggests that the magnitude of the

noise plays a factor in the effectiveness of filters. Nevertheless, for

artifact sizes at 25 and 50 percent, the filter was effective. In relation to

specific objective 1.4.2.2.1, it can be said that the filter is effective up to

a certain threshold of magnitude of noise, specifically in this case, a

maximum of 50% artifact size.

In addition to this, from the conducted trials with 100% artifact

sizes specifically with respiration noise, a limitation in the sensor has

been observed. Checking the plots, clippings were observed along 0mV

and 3mV (refer to Figure 5-2). This indicates a limitation in terms of the

amplitudes the sensor can cater to which is specifically only within the

170
Ateneo de Zamboanga University

range of 0 to 3 mV. The major cause of the clipping itself is due to the

noise present, which the artifact set was respiration). The noise along

the limitation of the sensor were mainly the reason why performance

under 100% artifact size yielded a low success rate.

Figure 5-2. Normal ECG with 100% Artifact Size Test Result

To further explore the application and ensure that the clippings

were a limitation of the sensor, the frequency spectrum of the simulated

ECG were provided as shown in Figure 5-3. In addition to this, the

maximum amplitude of each signal is provided along with the plot. At

first glance, no other frequencies are present starting from 40Hz and

above; the majority are found under low frequency range.

For the frequency spectrum of the ECG simulation with 100%

artifact size respiration noise, a maximum amplitude of approximately

4026.54 was observed in which accordingly to the plot is present along

the lower frequencies. Upon application of bandpass filter, it can be said

that the maximum amplitude lowered to a value of approximately 986.08

which indicates that some noises were removed. On the other hand, for

171
Ateneo de Zamboanga University

the application of moving average filter, the maximum amplitude slightly

went up to 986.63; factors considered includes the window size used

which is 11, the calculation of averages caused some values to increase.

Lastly, for the median filter, the maximum amplitude had largely

decreased to approximately 151.01. This shows that the median filter is

working due to the change in value.

Figure 5-3. Frequency Spectrum of Normal ECG simulation and Filter Results

From the information provided from the plots of frequency

spectrum, it can be said that relatively all showcased some effects on

the present frequencies hence further verifying the effectiveness and

application of the filter. In terms of the clippings encountered, no other

distinct frequencies were observed that could suggest being the cause

of it.

172
Ateneo de Zamboanga University

5.1.2 Data Analysis Module

In testing the functionality of the data analysis module, it will be done

using the datasets acquired from the online database as stated on section

4.2.2. Additionally, this test was followed in choosing the model to be applied

to the suggested device designed.

This test mainly had two phases; first is evaluating machine learning

model performance using the testing data, and second was also evaluating

machine learning model performance but in terms of using the testing data.

The main metric used for determining the trained model performance is

through the calculated k-fold accuracy during the training phase, and the overall

accuracy of the model calculated upon exposure to the unseen testing data. In

addition to this, additional evaluation metrics were also considered namely true

positive rate or recall, false positive rate, specificity, precision, F-score, and

general accuracy; all were used for providing additional perspectives and

evaluation in the performance of the model. For the main metrics, a success

rate of 90% was set; factors considered were mainly the effect of the filters

upon application. The quality of the data provided by the online database was

also considered.

Prior to calculating the metrics, the confusion matrices were first

acquired from both datasets. Table 5-3 and Table 5-4 provide the

corresponding confusion matrices of the training and testing data, respectively.

The training dataset consists of a total of 398 samples while the testing dataset

173
Ateneo de Zamboanga University

has around 171 samples. Prior to calculating the metrics, the acquired true and

false positive and negatives were used.

Table 5-3. Confusion Matrix using Training Data


Actual Positive Actual Negative

Predicted Positive TP = 171 FP = 7

Predicted Negative FN = 17 TN = 203

Table 5-4. Confusion Matrix using Testing Data


Actual Positive Actual Negative

Predicted Positive TP = 70 FP = 8

Predicted Negative FN = 11 TN = 82

Upon the provided values in the confusion matrices, majority were high

for the true positive and true negative values, compared to false positive and

false negative values. An initial interpretation can be provided that the model,

for the majority part, can correctly classify normal and STEMI ECG.

Proceeding towards conducting the tests, the results in terms of the

training k-fold accuracy and testing accuracy are shown in Table 5-5. As a side

note, these were the main metrics used for evaluation of model given

maximization on the performance of the model upon encountering new data is

prioritized. The k-fold acquired from the training data provides an estimation of

the performance of model on new data; upon application of model to testing

data, further proof if the estimation is correct using the accuracy acquired was

conducted. If the accuracies yielded are close, the model developed is more

generalized and is expected to perform better upon exposure to new data; on

174
Ateneo de Zamboanga University

the other hand, if accuracies are far from one other, an overfitted model might

be the case.

Table 5-5. Data Analysis Module Test Result Summary


No. of Total Average Model Expected Verdict
samples No. of K-fold Accuracy Accuracy
Trials Accuracy
Training 398 10 88% -- 90% Accep-
Data table
Testing 171 10 -- 89% 90% Accep-
Data table

According to the results provided on Table 5-5, the acquired average k-

fold accuracy of the trained model is around 88%. When tested on the testing

data, the returned general accuracy of the model was around 89%. Despite not

being able to meet the set accuracies, the proponents deemed the results as

acceptable as the accuracies were very close to the set 90% accuracy; only 1

and 2 percent difference were observed. Furthermore, the chosen model

shows better generalization compared to other developed models that

surpasses or meets the provided success rate. Other generated models that

reached k-fold of around 90 to 91 percent, which were the highest, resulted in

low accuracy upon testing using testing dataset. This means that the models

were overfitted and are not ideal for application.

In addition to this, the other stated metrics provided under section

3.3.1.2 further supports the idea that the chosen model displays good

performance. The metrics were namely TPR, FPR, specificity, precision, F-

score, and general accuracy. Among all the generated models, the 88%

175
Ateneo de Zamboanga University

accuracy model obtained the highest scores for TPR, specificity, precision, F-

score, and accuracy and the lowest for F-score. The following results are

shown in Table 5-6.

Table 5-6. Supporting Metric Results


Evaluation Metric Training Data Testing Data
True Positive Rate 0.91 0.86
(TPR)
False Positive Rate 0.03 0.08
(FPR)
Specificity 0.97 0.91
Precision 0.96 0.90
F-score 0.93 0.88
Accuracy 0.94 0.89

True positive rate (TPR) is the rate of correct prediction on the positive

class. This entails how good the model is at correctly classifying STEMI. The

closer the value is to 1, the better and more reliable the model is at correctly

classifying STEMI. As can be seen in Table 5-6, with the calculated TPRs of

0.91 and 0.86 it can be said that the model has a high rate of correctly predicting

the positive class, hence the model performs well in correctly classifying

STEMI.

False positive rate (FPR), on the other hand, is the rate of incorrect

prediction on the positive class. The closer the value is to 0, the better the

model is at correctly predicting the positive class since the chances of incorrect

prediction on the stated class is low. With the calculated values of 0.03 and

0.08, it can be said that the model has low chances of incorrectly predicting the

176
Ateneo de Zamboanga University

positive class, hence the model is performing well in correctly classifying

STEMI which supports the interpretation provided under TPR.

In terms of specificity, also known as the true negative rate, it is the

probability of correct prediction on the negative class. This metric will tell how

good the model is at correctly predicting Normal ECG in which the closer the

value is to 1, the better. From the calculated values shown in the table, a score

of 0.97 and 0.91 entails that the model is reliable in correctly classifying normal

ECG.

For the precision, this metric provides how consistent the model is in

making correct predictions for the positive class. Similar to other metrics, the

closer the value is to 1, the better the performance of the model is in terms of

consistent correct prediction. From the values, which are 0.96 and 0.90, it can

be said that the model is reliable in terms of its consistency in correctly

predicting classes, specifically STEMI.

Moving onto the F-score, this metric shows the model’s balanced ability

in terms of correctly classifying the positive class in relation to how consistent

it is in its classification. The closer the value is to 1, the better the result is and

with values of 0.93 and 0.88, it can be said that the model has a good amount

of accuracy and precision in classifying the positive class.

Lastly, the accuracy provides the rate of overall correct prediction. With

calculated values of 0.94 and 0.89, it can be said that the model overall

performs well in correctly classifying classes. From the provided interpretation

177
Ateneo de Zamboanga University

of metric values, it can be said that the model displays good performance in its

predictions of both classes, STEMI and normal ECG.

As a summary of the overall test conducted, the proponents infer that

despite not meeting the success rate indicated, the chosen model were able to

design and develop a good/acceptable model.

5.1.3 Storage Unit Test

The goal of this test is to determine if the expected data was saved as

files and stored within the local storage. Given that an ECG source is required

in order to acquire the filtered data and the features, the Fluke Prosim8

Simulator was used as the source; Chest Lead II placement, 250 Hz sampling

rate and 2500 samples of data length were still followed.

After the pre-processing of the data, the relevant data were collected

and saved into two corresponding files: one for filtered data, and second for

features extracted. For both, the corresponding class label of the data were

included. As for the filenames, the data of the acquisition is included, and ‘.csv’

with the feature data also include in the filename, ‘feature’ for easy indication

of file content. Similar goes for the filtered data file, ‘filter’ is used along the file

name.

In checking if the storage process was conducted properly, each file was

checked to see if they were found in their corresponding folders which was

done through Python using the Raspberry Pi. To further confirm if those were

the right files, the filename and content of the file is checked: For the filename,

the following guide questions are followed: does it go along the indicated date

178
Ateneo de Zamboanga University

it was acquired? For the filtered data file, are there 10,001 columns saved

(2500 each for the three filters involved, a set of 2500 for raw data, and one

column for ECG status)? For the features extracted, are 8,852 columns (2500

for the final filtered data, 1251 for power spectral density, 5000 for continuous

wavelet transform, and 100 for synthetic features)? If yes, a score of 1 was

given from the 10 trials conducted, if the answer is no, a score of 0 is given. No

factors were considered that could affect storage performance, hence the

indicated success rate of 100% was used.

Table 5-7. Storage Module Test Result Summary


Total No. of Determined Success Expected Success Verdict
Trials Rate Rate

10 100% 100% Passed

From the results provided under Table 5-7, out of the 10 trials, all the

relevant data were acquired and stored. This then provides proof that the

storage module is fully functional. The results also suggest that the storage

module performs as expected and indicated under specific objective 1.4.2.5.

Figure 5-4 provides a screenshot of the feature files saved during functional

trial. All are found within the allotted folder named ‘feature_csv’.

179
Ateneo de Zamboanga University

Figure 5-4. Functional Test Trial 1-10 of Storage Unit

5.1.4 Alert System Module

The functional test of this module mainly involves testing if the GSM

module can send SMS messages and make a call towards the designated

contacts. A python code was developed to conduct this test which was ran by

the Raspberry Pi. The test was conducted following 10 trials, in which for each

trial, an SMS was sent where a random message was used followed up by a

call to the designated contact. The purpose for sending random messages is

to ensure that the GSM module can send the same set of messages inputted

by the proponents without any misspells, extra or missing characters at the end

of the receiver. Before conducting the test, the proponents first integrated the

GSM module to the Raspberry Pi and powered on the device with the use of

the power bank. Once powered up, the proponents checked the LED indicator

on the GSM module to see if it was able to connect to the network. When the

LED indicator on the GSM module blinks once every three seconds it means

180
Ateneo de Zamboanga University

that the network connection was established Faranux (n.d.), and the

proponents can proceed with conducting the test. In case the calls and text

were received, a score of 1 is provided for the trial; if none were received, a

score of 0 is given. In setting the success rate, factors such as sufficient power

supply, baud rate and AT commands set by the proponents, sim card

registration (promos for calling and testing), and network availability and

strength upon location were considered. Nevertheless, adjustments regarding

the factors considered can be made to ensure alert system functionality. With

this the proponents ensured upon conducting the test that the battery module

is fully charged, the sim is registered to an unli-call and text promo, and also

the location where the test is done has strong cellular signal – these are the

factors that can vary depending on location and time. For the baud rate and AT

commands, it can be set to a constant within the code – this is the only factor

that cannot vary. Given the factors that varies were set to fit in fully ensuring

the GSM module to function, the set success rate is at 100%.

Table 5-8. Alert System Module Test Result Summary


Total No. of Determined Success Expected Success Verdict
Trials Rate Rate

10 100% 100% Passed

The result of the test is provided under Table 5-8. As can be seen, the

calculated success rate of this module’s functional testing is at 100%, hence,

the alert system module is fully functional given it reached the required value.

181
Ateneo de Zamboanga University

Additionally, in terms of the time between the message being generated

and the moment it was ready for sending, it was observed to be immediate; the

same can be said for initiating a call to a designated contact. On the contrary,

the time it takes for the message and call to be sent and received will depend

on the location of the device and the designated contact as it can have an effect

on the network connection and signal strength of the module. In cases where

the sim is not registered to a text and call promo, no expected call and text

occurs.

Overall, the results suggest a success in confirming the capabilities of

GSM module and the specific objective under section 1.4.2.4 is initially met.

Further confirmation will be conducted upon integration of the alert system to

other modules. Figure 5-5 shows a documentation of trial 8 conducted during

the test.

Figure 5-5. Functional Test Trial 9 of Alert System Module

182
Ateneo de Zamboanga University

5.1.5 Display System

Similar to the test conducted under the alert system module, random

messages were chosen to be displayed on the LCD screen. Randomization of

the messages were also used to check if all pixels within the LCD are functional

and also to see if various characters are displayable. When conducting the test,

the input message from the python file ran by the microprocessor, should match

to the output of LCD. If it matches, a score of 1 should be given; if not, the score

will be zero. A total of 10 trials were conducted. Given there is no direct

interference in displaying texts on the LCD, the success rate is set to 100%.

Table 5-.9 Display System Test Result Summary


Total No. of Determined Success Expected Success Verdict
Trials Rate Rate

10 100% 100% Passed

From the provided results under Table 5-9, the display system was able

to display the message on the LCD in accordance with what was provided in

the code for all ten trials. This suggests that the LCD is fully functional and

ready for the integration of modules, particularly with the data analysis and alert

modules. Figure 5-6 shows a sample of a trial conducted during the functional

test.

183
Ateneo de Zamboanga University

Figure 5-6. Functional Test Trial of Display Module

5.1.6 Battery Module

This test aims to determine if the power bank can support the integration

of all modules and how long the power bank can support the device. The test

was conducted by first charging the power bank to full capacity and confirming

that the power bank is fully charged. After confirmation that the power bank is

fully charged, all modules were integrated. Afterwards, the power bank was

switched on which in turn, switches on the other modules. Immediately upon

start-up the clock app is opened, and the stopwatch is initiated to check how

much time has passed since the powering on of the device. The device was

then left on until it surpasses 5 hours. This test was conducted ten times, which

were the considered number of trials. If the battery was able to surpass five

hours, a score of 1 is given for the corresponding trial; if not, a score of 0 is

provided. Given that the battery inside the power bank is relatively new, the

expected success rate is set to 100%. However, the success rate may be

184
Ateneo de Zamboanga University

affected if the test was conducted with the power bank not fully charged or

when the battery degrades over time because of constant use.

Table 5-10. Battery Module Test Result Summary


Total No. of Determined Success Expected Success Verdict
Trials Rate Rate

10 100% 100% Passed

The result, as shown in Table 5-10, shows that the power bank was

successful in supporting all the integrated modules and can last for up to 5

hours. It is important to note that the proponents performed each trial with the

power bank fully charged. Figure 5-7 shows a documentation of a trial

conducted during functional testing of battery module.

Figure 5-7. Functional Test Trial of Storage Unit

5.2 System Testing

System testing was conducted to ensure that the modules involved works after

stages of integration. In this testing, two cases were considered each with three

phases of integration. For this test, the Fluke Prosim8 Vital Signs simulator is used.

Regarding the acquisition of data, three electrode placements were followed with set

185
Ateneo de Zamboanga University

250Hz and sample length of 2500 to be collected. For the pre-processing applications,

the designed filters stated under section 4.2.1.2 were used.

But before processing, a test must be conducted in order to decide the

parameters to be applied upon the system testing, which is in terms of ST-elevation

threshold and artifact size. This was necessary before as this ensures consistency

and uniformity in the system testing procedure. The same conditions in the acquisition

of ECG and filters used were applied to this test.

5.2.1 ST-elevation Threshold and Artifact Size Test

Conducting this assessment examines the capability of the machine

learning model upon exposure to various ST-elevation values and artifact sizes.

This test aims to determine at what threshold can the model effectively detect

the ST-elevation and up to what degree of artifact size can affect the model’s

prediction.

5.2.1.1 ST-elevation Threshold Test

In this testing, the level of ST-elevation the machine learning

detects was determined. There was a total of 5 trials, one of which had

no artifact, and the rest represented specific noises specifically 60 Hz

power line interference, baseline wander, respiration, and muscle noise.

Per noise involved, three artifact sizes and ten ST-elevation values were

tested. For the artifact sizes, it was represented in terms of percentages

which were namely 25, 50, and 100 percent. For the ST-elevation

values, it extended from +0.05 mV to +0.80 mV; +0.00mV was also

186
Ateneo de Zamboanga University

included which is a representation of normal ECG. For determining the

ST-elevation threshold the machine learning effectively detects, the

success or acceptability rate is set to 90%. Factors considered include

the chances of misclassification and applicability of filters to the

corresponding indicated artifact sizes. The results are shown under

Table 5-11.

Table 5-11.ST-elevation Threshold Test Summary Result


ST- Total ST- Expected Determined Expected Verdict
elevation elevation total ST- Success Success
detected elevation Rate Rate
+0.05mV 4 13 31% 90% Failed
+0.10mV 5 13 38% 90% Failed
+0.20mV 5 13 38% 90% Failed
+0.30mV 13 13 100% 90% Passed
+0.40mV 13 13 100% 90% Passed
+0.50mV 13 13 100% 90% Passed
+0.60mV 13 13 100% 90% Passed
+0.70mV 13 13 100% 90% Passed
+0.80mV 13 13 100% 90% Passed

As can be seen in the Table 5-11, the ST-elevation values at

which the success rate was met is along +0.30mV and above;

consistency is also observed in the calculated success for all values

exceeding +0.30mV. From this, it can be said that the level of ST-

elevation the model can predict is at least +0.30mV and at most

+0.80mV. In choosing the ST-elevation threshold to be applied in the

system testing, the least value was chosen, which is +0.30mV.

187
Ateneo de Zamboanga University

5.2.1.2 Artifact Size Test

For this test, the degree of noise and its effect towards machine

learning prediction was mainly determined. The conditions provided

were the same as indicated under ST-elevation threshold test but mainly

focusing on artifact sizes. The expected success rate of this test is also

around 90% in which factors considered are chances of misclassification

of machine learning model, and application of filters with large

magnitude of noises. The result of the corresponding test is provided in

Table 5-12. From the results provided, it must be taken note that trial 1

is not included in the calculation of accuracy given that the ECG

simulation has no noise involved.

Table 5-12. Artifact Size Test Summary Result


Artifact Total correct Determined Expected Verdict
size Prediction Success Rate Success
Rate
25% 36/40 90% 90% Passed
50% 36/40 90% 90% Passed
100% 30/40 75% 90% Failed

As can be seen from the table, only the 100% artifact size was

not able to pass the indicated success rate. From this, it can be said that

the degree of noise can influence the prediction the device’s model,

specifically of high magnitude which can be related to the provided

limitation stated under section 5.1.1.2. With this, it can be said that filter

effectiveness influences model performance.

188
Ateneo de Zamboanga University

In terms of choosing the parameter for system testing, the highest

artifact size that was able to meet the set success rate was chosen,

which is artifact size 50%.

5.2.2 System Testing Case 1

In this test, the integration of the device was tested in terms of STEMI

ECG where ST-elevation is at +0.30mV with 50% artifact. Aside from this, the

conditions indicated under section 5.2 were applied in this test. For phases

involved, the indicated success rate was around 80%. Factors such as chances

of misclassification of machine learning, availability of network, and the level

the battery is charged, were considered. Additionally, another contributing

factor could be data mismatch. Data mismatch is when a system cannot

correctly perform due to the difference of elements from the inputted data and

elements that was used when training the model. Given that the signal fed to

the model was from a different data source, the simulated ECG may not match

to what is expected by the model, which was trained using the data acquired

from European ST-T Database. The results of the test are shown in Table 5-

13.

Table 5-13. System Testing Case 1 Summary Result


Phase Total No. of Determined Expected Verdict
trials Success Rate Success Rate
I 5 96.7% 80% Passed
II 5 94% 80% Passed
III 5 95% 80% Passed

189
Ateneo de Zamboanga University

As can be seen, all phases of integration were able to suffice the

provided success rate. Hence, it can be said that the PHAAS device is

functional upon integration in terms of exposure to STEMI ECG. Figure 5-8

provides a documentation of trial 1 under phase III and case 1. Additionally, in

terms of the test conducted under phase III, the alert system and display

module were observed to function in accordance with the output of the data

analysis module. In cases of misclassified normal ECG prediction, the

corresponding status ‘Normal’ was displayed on the LCD and the alert system

was not initiated. On the other hand, in cases of correct STEMI ECG prediction,

the corresponding status ‘STEMI Detected!’ was also displayed on the LCD,

but this time, the alert system was initiated.

Figure 5-8. System Testing, Case 1, Phase III, Trial 1

190
Ateneo de Zamboanga University

5.2.3 System Testing Case 2

In this test, the integration of the device was tested in terms of Normal

ECG with 50% artifact. This case also follows the conditions, in terms of

success rate and corresponding considered factors from section 5.2.2. In terms

of acquisition method or conditions, what was stated under 5.2 was followed.

Table 5-14. System Testing Case 2 Summary Result


Phase Total No. of Determined Expected Verdict
trials Success Rate Success Rate
I 5 96.7% 80% Passed
II 5 94% 80% Passed
III 5 95% 80% Passed

The results are shown in Table 5-14. As can be observed, all phases of

integration were also able to suffice the provided success rate. With this, it can

be also said that the PHAAS device is functional upon integration in terms of

Normal ECG. Similar to the test conducted with case 1, STEMI ECGs, it has

been observed that under phase III, the alert system and display module works

accordingly to the prediction provided by the data analysis module. ‘Normal’

was displayed on the LCD and no initiation of the alert system occurred when

correct normal ECG prediction was provided. Similarly, ‘STEMI Detected!’ was

displayed and alert system was initiated when misclassified predictions

occurred.

191
Ateneo de Zamboanga University

Figure 5-9. System Testing, Case 2, Phase III, Trial 4

With inclusion of the result presented in section 5.2.2, it can be said that

the integration of PHAAS device is a success and the proponents have

successfully built the prototype. Figure 5-9 provides a documentation of trial 3

under phase III and case 2.

Overall, for the summary of results acquired from the system testing, most

especially under the integration of data analysis module, alert system, and display

module, it can be said the specific objectives 1.4.2.4 and 1.4.2.6 were satisfied. From

the results for both cases, the alert system and display module functioned accordingly

to the provided prediction of the model. If normal ECG was detected, alert system did

not initiate and a status indicating normal ECG was only displayed. On the other hand,

if STEMI was detected, the alert system was initiated to send call and SMS, which

were received by the assigned contacts and the ECG status displayed in the LCD

192
Ateneo de Zamboanga University

indicated STEMI. Even during misclassifications, both the module functioned in

accordance with the provided prediction by the data analysis module.

Before ending the system testing, the assessment of the performance of the

machine learning model using the simulated ECGs used during the system testing

was determined. The expected success rate was set at 80% due to several factors

considered as mentioned in section 5.2.2 specifically in terms of misclassification

tendencies of the model, and chances of data mismatch.

Table 5-15. Model Performance Using System Testing Data


Case Phase Trial Accuracy Average Expected Verdict
1 2 3 4 5 Accuracy Success
Rate
1 I 1 1 1 1 1 100% 87% 80% Passed
1 II 1 1 1 0 1 80%
1 III 1 1 1 0 1 80%
2 I 1 1 1 1 1 100%
2 II 1 0 1 1 1 80%
2 III 1 0 1 1 1 80%

The result of the model performance is provided in Table 5-15. With the use of

30 simulated ECGs, the average accuracy calculated was determined to be around

87 percent; exceeding the provided success rate by 7 percent. This then indicates that

the model performs relatively well when data were acquired from other source,

specifically the Fluke Prosim8 Simulator. It must be taken note that these data were

from system testing, wherein it is set to fit acceptable conditions (+0.30 ST-elevation

and 50% size) where machine learning is reliable. This entails then, that under

acceptable conditions, the machine learning performs relatively well. This result

193
Ateneo de Zamboanga University

further supports the indicated specific objective 1.4.2.3 regarding the capability of the

model to correctly predict STEMI and normal ECG.

5.3 Beta Testing

In determining the user acceptance of the device, evaluation of the provided

answers from the survey was utilized. Table 5-16 shows the results acquired from the

application of Likert-scale. Table 5-17, on the other hand, shows the range for

determining the interpretation of results provided in Table 5-16. In the acquisition of

ECG, chest lead II placement was followed with 250 Hz sampling rate and a required

sample length of 2500. The pre-processing methods utilized were also the same from

what was used under system testing and functional testing of acquisition and signal

processing module. In this test, five volunteers were considered in which the model

performance was monitored as they conducted the provided activities. Prior to joining,

a consent was provided by the volunteer along with their health profile in which

specifically indicates that they do not have any heart related condition. After the test,

the volunteers answer a Likert survey which determined the user acceptance of the

device specifically in terms of portability and comfortability. Table 5-16 showcases the

results of the survey wherein calculations were based on Ombea (n.d.).

Table 5-16. Likert-Scale Result


Statement Scale Score Mean Level of
Agreement
1 2 3 4 5
The device is not 0 0 0 2 3 23 4.6 Strongly
restrictive while Agree
doing the activities

194
Ateneo de Zamboanga University

I am comfortable 0 0 0 1 4 24 4.8 Strongly


while using the Agree
device
No malfunctions 0 0 0 2 3 23 4.6 Strongly
were encountered Agree
during the test
I can use the device 0 0 0 2 2 23 4.6 Strongly
without technical Agree
assistance
Overall Mean 4.65 Strongly
Agree

As can be seen from Table 5-16, all the provided statement resulted with an

interpretation of ‘Strongly Agree’. This implies that participants found the PHAAS

device to not be restrictive while doing activities, comfortable upon use, malfunctions

were not common, and was usable without technical assistance. Overall, the level of

agreement the participants had leans toward strong agreement with the provided

statements, hence the device is favorable in terms of portability and comfortability.

The interpretation of the mean score is indicated under Table 5-17, following the

calculation provided by Valentino (2022).

Table 5-17. Interpretation of Mean Score


Scale Range Interpretation
1 1 – 1.8 Strongly Disagree
2 1.9 – 2.6 Disagree
3 2.7 – 3.4 Neutral
4 3.5 – 4.2 Agree
5 4.3 – 5 Strongly Agree

195
Ateneo de Zamboanga University

Using the data acquired from the beta testing, performance of the trained

machine learning model was determined. The results are provided in Table 5-18. Like

the evaluation of machine learning from the system testing, a success rate of 80%

was considered.

Table 5-18. Model Performance Using Beta Testing Data


Activity Volunteer Average In terms of
1 2 3 4 5 Correct Movement
Prediction Involved
Sitting 0.8 1.0 1.0 0.8 0.2 0.76 0.83
Standing 1.0 1.0 0.8 1.0 0.6 0.88
Laying 0.8 1.0 0.8 1.0 0.6 0.84
Down
Walking 0.8 0.2 0.2 0.2 0.0 0.28 0.28
Running 0.2 0.2 0.2 0.2 0.0 0.16
Jumping 0.2 0.8 0.2 0.2 0.6 0.40
Average Accuracy 0.56
Expected Success Rate 80%
Verdict Failed

As a general observation, the accuracy provided per activities conducted varies

depending on the degree of movement the activity involves. From the table, the first

three activities showcase accuracies that were fairly high with 76% being the least

among them. On the other hand, for the last three activities, low accuracy values were

derived 16% being the lowest. Comparing the two set of activities, the most evident

difference is the degree of movement each activity requires. The greater the

movement the activity requires, the more prone the model becomes for

misclassification.

196
Ateneo de Zamboanga University

The model was not able to meet the indicated success rate due to this

unprecedented factor. The possible explanation as to why the model’s performance

decreases per activity with increasing movement is due to the motion artifact that it

provides. According to Ding et.al (2023), motion artifact is a predominantly disruptive

interference resulting from the movement and rubbing of the body against the

electrode surface.

According to An and Stylios (2020), the most effective method in addressing

this noise involves the use of a high-end filter called adaptive filter. Compared to other

filters they have tested which are namely high pass finite impulse response (FIR) filter,

high pass infinite impulse response (IIR) filter, moving median filter, and wavelet

transform denoising, only the adaptive filter did not cause distortion while filtering the

ECGs especially those with abnormal waveforms. The most probable cause of the

distortion is due to the overlapping frequencies between the ECG and motion artifact.

The frequency range of ECG is around 0.5 to 100 Hz while motion artifact is around

0.4 to 15 Hz (Almalchy, 2021). This suggests that upon the application of filters,

corresponding removal of significant information occurs along the intended removal

of motion artifact. This discourages the use of improper denoising methods as it can

affect the waveform of the signal and contribute to misdiagnosis of heart related

conditions. In line with this, the application of adaptive filter is suggested. Despite the

stated effective application, the use of this filter falls outside the scope of the study

and has been decided to be stated under Chapter VII, the recommendation section

instead.

197
Ateneo de Zamboanga University

Other factors that may have contributed to the low success rate includes the

limitation of the sensor and filters at which were discussed under section 5.1.1.2 and

5.2.1.2.

198
Ateneo de Zamboanga University

CHAPTER VI
CONCLUSION
The purpose of this study is to develop an objective-based, portable, and real-

time heart attack detector that mainly addresses heart attack related concerns such

as reliability to symptoms for detection, tendency to be unpredictable and silent,

cruciality of early diagnosis, and cruciality of fast response time upon occurrence. The

proposed design in total, consist of six modules each serving a specific function. The

modules are namely the acquisition and signal processing unit, data analysis module,

storage unit, display system, alert system, and a battery.

Evaluation of the designed device was conducted via various tests, namely

alpha, system, and beta testing. Majority of the results under alpha testing suggests

that the individual modules were fully functional. For the case of application of filters

under the acquisition and signal processing unit, the filter was not able to meet the set

success rate of 90%, specifically under the case of 100% artifact size. Upon checking

the corresponding plots of the trials involved in the case, clippings were observed

around 0 to 3 millivolts. This mainly suggests that there is a limitation in the sensor,

specifically in the range of values it can cater. In the case of data analysis module, the

proponents were able to develop a good or acceptable model; considering all the

metrics used to evaluate its performance, majority of the results points out the model

to be favorable of good performance.

Moving towards system testing, from the ST-elevation and artifact size test,

results pointed out that the ST-elevation threshold the model can begin to detect

STEMI is at +0.30mV. This entails that anything below the determined threshold, are

199
Ateneo de Zamboanga University

considered normal by the model; anything at and beyond are STEMI. Potential factors

could include the data used from the European ST-T database, and unprecedented

effects of the applied filters. In terms of the artifact size, among all the sizes included,

only test case of 100% magnitude failed to meet the set success rate. This result is

approximately the same from the functional testing of filters. This could suggest that

artifact sizes, specifically of great magnitude, along with the limitation of the sensor,

can affect machine learning model performance. Moving towards the system testing,

for both cases, results yielded were desirable in which all the determined success rate

surpasses what was indicated. This suggests that the integration of the modules is a

success.

Last but not the least, for the beta testing, in terms of the user acceptability of

the device, the participants had greatly shown their agreement in all the statement

provided on the Likert scale survey. Overall, this indicates that the designed device

is favorable for the users, specifically in terms of portability and comfortability.

In addition to the indicated test, the model performance in terms of the data

acquired from the system and beta testing is evaluated. For the system testing, the

generated accuracy is fairly well, with an accuracy of 87%, as it is able to surpass the

set success rate of 80%. The beta testing, on the other hand, is quite a different story.

The overall success rate that it was able to yield is only around 56% which is fairly

low. As provided in the discussion under section 5.3, the main factor that caused this

is due to the presence of motion artifacts. If only the activities considered are those

with low movements, the calculated accuracy is at 83%. On the other hand, if only the

activities that requires a lot of movement are considered, an accuracy of only 28% is

200
Ateneo de Zamboanga University

achieved. This entails that the motion artifact present greatly affects the machine

learning performance.

Overall, from the results acquired, it has been recognized that the presence of

noise greatly influences the proposed device’s performance, particularly in terms of

the data analysis module. The artifact size, especially those of great magnitude and

the presence of motion artifact increases the misclassification of the machine learning

model. Furthermore, the sensor's limited capacity to capture certain values can also

play a role on the performance of the machine learning. Despite the indicated

limitations, the device is able to show good performance under appropriate or

acceptable conditions.

In conclusion, it can be said that the proponents were able to successfully

develop the proposed device: a portable, objective-based heart attack detector that is

applicable in real time. Every module performed its intended function, and upon

integration, the system operates as expected. Furthermore, the user acceptability

leans over to be in favor of the device; strong agreement is expressed towards the

ease of portability and provided comfortability of the device. In addition to this,

limitations were encountered specifically in terms of the application of filters and

sensor capacity. In regard to this, recommendations are provided under Chapter VII.

201
Ateneo de Zamboanga University

CHAPTER VII
RECOMMENDATION
The Portable Heart Attack Alert System (PHAAS) is an objective-based

portable device designed to detect heart attacks, specifically ST-elevated Myocardial

Infarctions (STEMI), in real-time. Upon evaluating the designed device, certain

limitations were encountered specifically in terms of the sensor capacity, filter

application in handling high magnitude noises and the disruptive presence of motion

artifact.

In terms of the limitation of the sensor, the proponents suggest the use of

Python Heart Rate Analysis Toolkit, also known as HeartPy. The toolkit offers pre-

processing methods that specifically address clippings due to the limited sensitivity

range of the sensor. This process involves the detection of the clippings which

afterwards are interpolated.

In addressing motion artifacts, both software and hardware methods are

available. For the software approach, the use of a high-end filter, namely the adaptive

filter, is suggested. The adaptive filter is a time-variant filter, which takes two inputs:

one input for the signal and the other serves as the reference which acquires the noise

desired to be removed. The general idea in the application of this method is through

the subtraction of the reference input (noise reading) from the input signal in order to

acquire the clean one. According to An and Stylios (2020), the adaptive filter is an

effective method of removing artifact given upon application, it does not cause

significant distortion. The downside of using this method is that it requires an additional

202
Ateneo de Zamboanga University

input to take the noise measured, in cases that the approach is not suitable for the

PHAAS device, the hardware method or suggestion can be used.

For the hardware approach, the Analog ECG Sensor datasheet (n.d.) provides

a circuit implementation or a battery powered cardiac monitoring system that monitors

the heart rate of patients engaging in moderate activity, such as with a Holter Monitor.

The circuit employs the AD8232 Single-Lead Heart Rate Monitor Front End and a

three-electrode patient interface with a two-pole high and low-pass filter, and a signal

gain of 400 in the pass band. The signal is sampled by a sigma-delta ADC integrated

on a low-power microcontroller, the ADuCM360 and an ADXL346 accelerometer

signal is used to minimize patient motion artifacts and conserve battery power during

inactivity. It is important to note that the previously mentioned components are meant

to demonstrate the capabilities of the AD8232 with other system components and is

not a complete system design.

Aside from addressing the limitations encountered from the PHAAS, the

proponents also have several suggestions regarding the design of each module. First,

the proponents recommend adding a piezo buzzer as the primary component of the

alert system module to provide an audible method to warn the user upon STEMI ECG

detection. The implementation of this can decrease the delay in the delivery of STEMI

indication.

Second, the proponents recommend adding a button which enables the user

to manually trigger the GSM module to send text messages and make voice calls to

the designated contacts. This will provide user control over the system, potentially

increasing the battery life of the proposed device as it reduces power consumption by

203
Ateneo de Zamboanga University

the microprocessor, and lastly, minimizes false alarms in case of a false positive

result.

In terms of the testing conducted, particularly under evaluating effectiveness of

filter on simulated noises namely 60Hz power line interference, baseline wander,

respiration, and muscle noise; the proponents suggest further evaluating the filter

using a combination of the noises provided given the filters were only tested in terms

of isolated artifacts.

Lastly, for the machine learning model under data analysis module,

optimization of the recall rate is suggested rather than accuracy. This is to ensure that

the rate of correctly detecting STEMI is reliable.

204
Ateneo de Zamboanga University

BIBLIOGRAPHY

Abbaspour, S., & Fallah, A. (2014). A Combination Method for Electrocardiogram


Rejection from Surface Electromyogram. The Open Biomedical Engineering
Journal, 8(1), 13–19. https://doi.org/10.2174/1874120701408010013

Ahmed, KS., El-Metwally2, SM., (2015, September). Portable Low-cost Heart Attack
Detection System using ZigBee Wireless Technology. ResearchGate.
https://doi.org/10.13140/RG.2.1.2865.4561

Ahmed, M. (2014, June 8). Heart Blockage: Explained with Pictures. MyHeart.
https://myheart.net/articles/heart-blockage-explained-with-pictures/

Al'Aref, S (2022, June 26). Chest Pain: Anatomic vs. Functional Evaluation.
https://qatar-weill.cornell.edu/continuing-professional-development/pearls-of-
grand-rounds/article/chest-pain-anatomic-vs-functional-evaluation

Alharbey, RA., Alsubhi, S., Daqrouq, K., Alkhateeb, A. (2022, March 28). The
continuous wavelet transforms using for natural ECG signal arrhythmias
detection by statistical parameters. ScienceDirect. Alexandria Engineering
Journal, 61(12), 9243-9248. https://doi.org/10.1016/j.aej.2022.03.016

Ali et al. (2019) A review on data preprocessing methods for class imbalance problem.
https://www.researchgate.net/profile/Ayaz-Ullah-2/publication/336305785_A_re
view_on_data_preprocessing_methods_for_class_imbalance_problem/links/5d
b13d15299bf111d4c08fb5/A-review-on-data-preprocessing-methods-for-class-
imbalance-problem.pdf

Alibaba (n.d.). Okystar OEM ODM ECG Module AD822 ECG Measurement Pulse
Heart ECG Monitoring Sensor Module Kit. https://www.alibaba.com/product-
detail/Ad8232-Okystar-OEM-ODM-ECGModule62520278559.html?
spm=a2700.galleryofferlist. normal_offer.3.7d8d4d61JAdPuY&s=p

Alizadeh, R., Aghsaeifard, Z., Sadeghi, M., Hassani, P., & Saberian, P. (2020,
September 4). Effects of Prehospital Traige and Diagnosis of ST Segment
Elevation Myocardial Infarction on Mortality Rate. PubMed Central (PMC), 13,
569–575, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7481285/

Allwright, S. (n.d.). How to interpret F1 score. https://stephenallwright.com/interpret-


f1-
score/#:~:text=F1%20score%20can%20be%20interpreted,it%20does%20cap
tur e%20(precision)
205
Ateneo de Zamboanga University

Amazon.com (n.d.). SanDisk 128GB Ultra MicroSDXC UHS-I Memory Card with
Adapter - 100MB/s, C10, U1, Full HD, A1, Micro SD Card - SDSQUAR-128G-
GN6MA: Everything Else.https://www.amazon.com/SanDisk-128GB-
microSDXC-Memory-Adapter/dp/B073JYC4XM

American College of Cardiology (2019, March 17). ACC/AHA Guidance for Preventing
Heart Disease, Stroke Released. https://www.acc.org/about-acc/press-
releases/2019/03/17/09/49/acc-aha-guidance-for-preventing-heart-disease-
stroke-released

American Heart Association (2015, July 31). Electrocardiogram (ECG or EKG).


https://www.heart.org/en/health-topics/heart-attack/diagnosing-a-heart-
attack/electrocardiogram-ecg-or-ekg

American Heart Association (2016, July 31). What Is a Heart Attack?


https://www.heart.org/en/health-topics/heart-attack/about-heart-attacks

American Heart Association (2022, February 10). Silent Ischemia and Ischemic Heart
Disease. https://www.heart.org/en/health-topics/heart-attack/about-heart-
attacks/silent-ischemia-and-ischemic-heart-disease

American Heart Association. (2020, February 4). Chronic stress can cause heart
trouble. https://www.heart.org/en/news/2020/02/04/chronic-stress-can-cause-
heart-trouble

American Heart Association. (2022, June 2). Chronic stress can cause heart trouble.
www.heart.org.https://www.heart.org/en/news/2020/02/04/chronic-stress-can-
cause-heart-trouble

American Heart Association. (2022, March 4). Health Threats from High Blood
Pressure. www.heart.org.https://www.heart.org/en/health-topics/high-blood-
pressure/health-threats-from-high-blood-pressure

Appathurai et al. (2018) A study on ECG signal characterization and practical


implementation of some ECG characterization techniques. Retrieved from
https://www.sciencedirect.com/science/article/abs/pii/S0263224119301599

Arora, S. (2020, February 4). SVM: Difference between Linear and Non-Linear
Models. AITUDE.https://www.aitude.com/svm-difference-between-linear-and-
non-linear-models/

206
Ateneo de Zamboanga University

Arts, LP., & Broek, EL. (2022, January 27). The fast continuous wavelet transformation
(fCWT) for real-time, high-quality, noise-resistant time–frequency analysis.
Nature Computational Science, 2, 47–58.
https://www.nature.com/articles/s43588-021-00183-z

Baeldung (2022) Stratified Sampling in Machine Learning. Retrieved from


https://www.baeldung.com/cs/ml-stratified-sampling

Banoula (2023) Machine Learning Steps: A Complete Guide! Retrieved from


https://www.simplilearn.com/tutorials/machine-learning-tutorial/machine-
learning-steps

Biopac Systems, Inc. (n.d.). Introductory ECG Guide. https://www.biopac.com/wp-


content/uploads/ECG-Guide.pdf

Boateng, KO., Asubam BW., Laar, DS. (2012). Improving the Effectiveness of the
Median Filter. International Journal of Electronics and Communication
Engineering, 5(01), 85-97.
https://www.ripublication.com/irph/ijece/ijecev5n1__9.pdf

Butt, T. S., Bashtawi, E., Bououn, B., Wagley, B., Albarrak, B., Sergani, H. E., Mujtaba,
S. I., & Buraiki, J. (2020, August 6). Door-to-balloon time in the treatment of ST
segment elevation myocardial infarction in a tertiary care center in Saudi Arabia.
PubMed Central (PMC), 40(4), 281-289.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7410222/

CardioSound (n.d.). Why have stress tests? https://cardiosound.com/stress-tests


Carousell (n.d.). ACER Predator Helios 300 Gaming Laptop i5 9th Gen | RTX 2060.
https://www.carousell.ph/p/acer-predator-helios-300-gaming-laptop-i5-9th-gen-
rtx-2060-1122076503/

Center and Disease Control and Prevention. (2022, June 20). Diabetes and Your
Heart. https://www.cdc.gov/diabetes/library/features/diabetes-and-heart.html

Center for Disease Control and Prevention. (n.d.). WISEWOMAN Overview.


https://www.cdc.gov/wisewoman/about.html

Centers for Disease and Control and Diseases. (n.d.). Smoking and Cardiovascular
System. https://www.cdc.gov/tobacco/data_statistics/sgr/50th-
anniversary/pdfs/fs_smoking_CVD_508.pdf

207
Ateneo de Zamboanga University

Centers for Disease Control and Diseases. (2022, September 8). Heart Disease and
Stroke.https://www.cdc.gov/chronicdisease/resources/publications/factsheets/h
eart-disease-stroke.htm

Centers for Disease Control and Prevention (2022, October 14). Heart Disease Facts.
https://www.cdc.gov/heartdisease/facts.htm

Centers for Disease Control and Prevention. (2022, April 18). About Million Hearts®
2027 | Million Hearts®. https://millionhearts.hhs.gov/about-million-
hearts/index.html

Chatterjee, S., Thakur, RS., Yadav, RN., Gupta L., Raghuvanshi, DK. (2020,
December 1). Review of noise removal techniques in ECG signals. The
Institution of Engineering and Technology, 14(09), 569-590.
https://doi.org/10.1049/iet-spr.2020.0104

Chong (2020) What is Feature Scaling & Why is it Important in Machine Learning?
.Retrieved from https://towardsdatascience.com/what-is-feature-scaling-why-
is-it-important-in-machine-learning-2854ae877048

Chowdhury, M., Alzoubi, K., Khandakar, A., Khallifa, R., Abouhasera, R., Koubaa, S.,
Ahmed, R., & Hasan, M. A. (2019, June 20). Wearable Real-Time Heart Attack
Detection and Warning System to Reduce Road Accidents. Sensors (Basel,
Switzerland), 19(12), 2780. https://doi.org/10.3390/s19122780

Cleveland Clinic. (2018, February 21). Blood Glucose Test: Levels & What They
Mean. https://my.clevelandclinic.org/health/diagnostics/12363-blood-glucose-
test

Codecademy. (n.d.). Normalization.


https://www.codecademy.com/article/normalization

Coding Ninjas. (n.d.). SVM Hyperparameter Tuning using GridSearchCV.


https://www.codingninjas.com/codestudio/library/svm-hyperparameter-tuning-
using-gridsearchcv

Coursera (2022, September 23). What Is Python Used For? A Beginner’s Guide.
Coursera. https://www.coursera.org/articles/what-is-python-used-for-a-
beginners-guide-to-using-python

D’Angelo, D. (2018, May 25). PHA Launches Sneakers Friday. Travel Philippines
Today. https://www.travelphilippines.today/pha-launches-sneakers-friday/
208
Ateneo de Zamboanga University

Daghlas I., Dashti, H.S., Lane, J., Aragram, K.G., Rutter, M.K., Saxena, R., Vetter, C.
(2019, September 10). Sleep Duration and Myocardial Infarction
https://pubmed.ncbi.nlm.nih.gov/31488267/

Denktas, AE., Anderson, HV., McCarthy, J., Smalling, RW. (2011, June). Total
ischemic time: the correct focus of attention for optimal ST-segment elevation
myocardial infarction care. JACC Cardiovasc Interv. National Library of
Medicine, 4(6), 599-604. https://pubmed.ncbi.nlm.nih.gov/21700244/

Electronics Tutorials (n.d.) Basic Electronics Tutorial and Revision.


https://www.electronics-tutorials.ws/sitemap

Feinglass S. & Sun L. (2021, June). How labs can help clinicians diagnose myocardial
infarctions in women? https://cdn.mlo-
online.com/files/base/ebm/mlo/document/2021/05/MLO202106_CEStory_Test.
609d54f7c9380.pdf

Felicity (2022, September 26). The Median Filter: An Effective Solution for Removing
Noise From Images. Picozu. https://www.picozu.com/the-median-filter-an-
effective-solution-for-removing-noise-from-images

Fishbein, M. (2010, February 1). The vulnerable and unstable atherosclerotic plaque.
PubMed, 19(1), 6-11, https://pubmed.ncbi.nlm.nih.gov/18835793/

Fluke (2021, August 8). Fluke 179 True-RMS Digital Multimeter.


https://www.fluke.com/en-ph/product/electrical-testing/digital-multimeters/fluke-
179

Fluke Biomedical. (n.d.). ProSim 8 Vital Sign and ECG Patient Simulator.
https://www.flukebiomedical.com/products/biomedical-test-equipment/patient-
monitor-simulators/prosim-8-vital-signs-patient-simulator

Gandhi, R. (2018, June 8). Support Vector Machine: Introduction to Machine Learning
Algorithms SVM model from scratch. Towards Data Science.
https://towardsdatascience.com/support-vector-machine-introduction-to-
machine-learning-algorithms-934a444fca47

General Health Institute (n.d.). Fast Response to Heart Attacks. Genesis Health
System. https://www.genesishealth.com/ghi/healthy_living/patient-stories/fast-
response/

209
Ateneo de Zamboanga University

Ginghina, C., Ungureanu, C., Vladaia, A., Popescu B.A., Jurcut, R. (2009). The
electrocardiographic profile of patients with angina pectoris. The Journal of
Medicine and Life, 2(01), 80-91. https://medandlife.org/all-issues/2009/issue-1-
2009/case-presentations-issue-1-2009/the-electrocardiographic-profile-of-
patients-with-angina-pectoris/

Gong, F. F., Vaitenas, I., Malaisrie, S. C., & Maganti, K. (2020, December 9).
Mechanical Complications of Acute Myocardial Infarction. JAMA Cardiology.
JAMA Network, 6(3), 341-349.
https://jamanetwork.com/journals/jamacardiology/fullarticle/2773641

gplearn (n.d.) Symbolic Transformer.


https://gplearn.readthedocs.io/en/stable/reference.html#gplearn.genetic.Symbo
licTransformer

Gul Z. & Makaryus AN. (2019, February 7). Silent Myocardial Ischemia. StatPearls
Publishing. https://europepmc.org/article/NBK/nbk536915

Gupta, S., Shrivastava, A., Upadhyay, SP., Chaurasia, P. (2021, August). A Machine
Learning Approach for Heart Attack Prediction. International Journal of
Engineering and Advanced Technology, 10(6), 124-134.
https://www.researchgate.net/publication/354221694_A_Machine_Learning_Ap
proach_for_Heart_Attack_Prediction

Gusev, M., Stojmenski, A., Guseva, A. (2017, September 7). ECGalert: A Heart Attack
Alerting System. Springer International Publishing AG, 778.
https://doi.org/10.1007/978-3-319-67597-8_3

Haddadi, R., Abdelmounim, E., El Hanine, M., & Belaguid, A. (2017, September). ST
Segment Analysis Using Wavelet Transform. International Journal of Computer
Science and Network Security, 17(9), 102–107.
http://paper.ijcsns.org/07_book/201709/20170915.pdf

Hafiane, A. (2019, July 27). Vulnerable Plaque, Characteristics, Detection, and


Potential Therapies. Journal of Cardiovascular Development and Disease, 6(3),
26; https://doi.org/10.3390/jcdd6030026

Hashim, M., Azim, W., Hussain, W., Rehman F., Salam A., Rafique M.(2022). Quality
of Life, Perceived Social Support and Death Anxiety Among People Having
Cardiovascular Disorders: A Cross-Sectional Study. Pakistan Journal of Medical
& Health Sciences, 16(04), https://doi.org/10.53350/pjmhs22164460

210
Ateneo de Zamboanga University

Heart and Stroke Foundation of Canada. (n.d.). Anticoagulants.


https://www.heartandstroke.ca/heart-
disease/treatments/medications/anticoagulants

Heart Research Institute (n.d.). Atherosclerotic plaque in arteries overview.


https://www.hri.org.au/health/learn/cardiovascular-disease/atherosclerotic-
plaque

HeartBeam (n.d.). Portable, Medical-Grade Heart Attack Detection.


https://www.heartbeam.com/

Institute of Medicine (2010). Framework for Action. Fuster V, Kelly BB (Eds.),


Promoting Cardiovascular Health in the Developing World: A Critical Challenge
to Achieve Global Health. National Academic Press, 8.
https://www.ncbi.nlm.nih.gov/books/NBK45685/

Institute of Medicine (US) Committee on Social Security Cardiovascular Disability


Criteria (2010). Cardiovascular Disability: Updating the Social Security Listings.
National Academies Press (US).
https://www.ncbi.nlm.nih.gov/books/NBK209964/

Jerushaa, J., Kasthuri, J., Buvana, M., Dharshan Kumaar, S., & Kailash, U. (2021,
May 5). Machine Learning Algorithms in Prediction of Heart Attack. International
Journal of Creative Research Thoughts, 9(5).
https://www.researchgate.net/publication/359841950_MACHINE_LEARNING_
ALGORITHMS_IN_PREDICTION_OF_HEART_ATTACK

K, D. (2021, December 10). Top 4 advantages and disadvantages of Support Vector


Machine or SVM. Medium. https://dhirajkumarblog.medium.com/top-4-
advantages-and-disadvantages-of-support-vector-machine-or-svm-
a3c06a2b107

Kashou, A. H., Basit, H., & Malik, A. (2022, August 8). ST Segment. NCBI Bookshelf.
https://www.ncbi.nlm.nih.gov/books/NBK459364/

Kaur, G. (2019). Kernel Function. Towards Data Science.


https://towardsdatascience.com/kernel-function-6f1d2be6091

Kenpro. (2021). HOW TO CONDUCT LIKERT SCALE ANALYSIS. KENPRO.


https://www.kenpro.org/how-to-conduct-likert-scale-analysis

211
Ateneo de Zamboanga University

Khan Academy. (n.d.). Statistics intro: Mean, median, & mode. Khan Academy.
https://www.khanacademy.org/math/cc-sixth-grade-math/cc-6th-data-
statistics/mean-and-median/v/statistics-intro-mean-median-and-mode

Khan, M. A., Hashim, M. J., Mustafa, H., Baniyas, M. Y., Buti Mohamad Al Suwaidi,
S. K., AlKatheeri, R., Khalfan Alblooshi, F. M., Ali Hassan Almatrooshi, M. E.,
Hazeem Alzaabi, M. E., Al Darmaki, R. S., & Ali Hussain Lootah, S. N. (2020,
July 23). Global Epidemiology of Ischemic Heart Disease: Results from the
Global Burden of Disease Study. PubMed Central (PMC).
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7384703/

Khowaja, S., Ahmed, S., Kumar, R., Shah, J. A., Khan, K. A., Khan, N. U., Saghir, T.,
Hasan Rizvi, S. N., Qamar, N., & Karim, M. (2021, October 29). Time to think
beyond door to balloon time: significance of total ischemic time in STEMI. The
Egyptian Heart Journal. https://doi.org/10.1186/s43044-021-00221-1

Kirsanov, A. (2022, August 16). Wavelets: a mathematical microscope.


https://www.youtube.com/watch?v=jnxqHcObNK4&t=605s

Kumar, P., & Sharma, V. (2020). Detection and classification of ECG noises using
decomposition on mixed codebook for quality analysis. Healthcare Technology
Letters, 7(1), 18–24. https://doi.org/10.1049/htl.2019.0096

Lazada PH (n.d.). ADC ADS1015 12-Bit 4 Channel with Programmable Gain Amplifier.
https://www.lazada.com.ph/products/i161720874-
s197829685.html?spm=a2o4l.mywishlist.items.18.b2353e17U0Cqw7

Lazada PH (n.d.). iCare ECG Electrodes 50pcs per Pack.


https://www.lazada.com.ph/products/i3299229591-
s16707725373.html?spm=a2o4 l.my_wishlistitems.2.b2353e17U0Cqw7

Lyn (n.d.) Understanding Cutoff Frequency: What it is and How it Affects Your Audio.
https://www.hifireport.com/understanding-cutoff-frequency/

Mahesh, B. (2019). Machine Learning Algorithms - A Review. International Journal of


Science and Research. ResearchGate.
https://www.researchgate.net/publication/344717762_Machine_Learning_Algor
ithms_-A_Review

212
Ateneo de Zamboanga University

Makerlab Electronics (n.d.). 16x2 LCD Display I2C Black on Green.


https://www.makerlab-electronics.com/product/16x2-lcd-display-i2c-black-on-
green/

Makerlab Electronics (n.d.). SIM800L V2 5V Wireless GSM GPRS Module.


https://www.makerlab-electronics.com/product/sim800l-v2-5v-wireless-gsm-
gprs-module/

Mary Ann Valentino. (2021, May 25). HOW TO INTERPRET LIKERT SCALE
RESULTS [Video]. YouTube.
https://www.youtube.com/watch?v=w7kttWTtcBM

Maserejian, N. N., Link, C. L., Lutfey, K. L., Marceau, L. D., & McKinlay, J. B. (2009,
October.). Disparities in Physicians’ Interpretations of Heart Disease Symptoms
by Patient Gender: Results of a Video Vignette Factorial Experiment. PubMed
Central (PMC). https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2825679/

Mathuranathan (2010, November 23). Understand Moving Average Filter with Python
& Matlab. GaussianWaves.https://www.gaussianwaves.com/2010/11/moving-
average-filter-ma-filter-2/

MathWorks (n.d.). Continuous Wavelet Transform and Scale-Based Analysis.


Continuous. MATLAB & Simulink.
https://www.mathworks.com/help/wavelet/gs/continuous-wavelet-transform-
and-scale-based-analysis.html

Mayo Clinic (2021, December 14). Coronary angiogram.


https://www.mayoclinic.org/tests-procedures/coronary-angiogram/about/pac-
20384904

Mayo Clinic (2021, March 30). Echocardiogram. https://www.mayoclinic.org/tests-


procedures/echocardiogram/about/pac-20393856

Mayo Clinic (2021, May 5). Myocardial ischemia - Symptoms and causes. Retrieved
from https://www.mayoclinic.org/diseases-conditions/myocardial-
ischemia/symptoms-causes/syc-20375417

Mayo Clinic (2022, January 15). Blood tests for heart disease.
https://www.mayoclinic.org/diseases-conditions/heart-disease/in-depth/heart-
disease/art-20049357

213
Ateneo de Zamboanga University

Mayo Clinic (2022, March 19). Electrocardiogram (ECG or EKG).


https://www.mayoclinic.org/tests-procedures/ekg/about/pac-20384983

Mayo Clinic (2022, March 5). Chest X-rays. https://www.mayoclinic.org/tests-


procedures/chest-x-rays/about/pac-20393494

Mayo Clinic (2022, May 21). Heart attack - Diagnosis and treatment.
https://www.mayoclinic.org/diseases-conditions/heart-attack/diagnosis-
treatment/drc-20373112

Mayo Clinic (2022, May 21). Heart attack - Symptoms and causes.
https://www.mayoclinic.org/diseases-conditions/heart-attack/symptoms-
causes/syc-20373106

Mayo Clinic (2022, May 25). Silent heart attack: What are the risks?
https://www.mayoclinic.org/diseases-conditions/heart-attack/expert-
answers/silent-heart-attack/faq-20057777

Mayo Clinic. (2022, January 14). Strategies to prevent heart disease.


https://www.mayoclinic.org/diseases-conditions/heart-disease/in-depth/heart-
disease-prevention/art-20046502

Mayo Clinic. (2022, May 21). Heart attack: Diagnosis and treatment.
https://www.mayoclinic.org/diseases-conditions/heart-attack/diagnosis-
treatment/drc-20373112

MedlinePlus. (n.d.). Blood sugar test. https://medlineplus.gov/ency/article/003482.htm

MedlinePlus. (n.d.). Cholesterol. https://medlineplus.gov/cholesterol.html

MedlinePlus. (n.d.). Diabetes. https://medlineplus.gov/ency/article/001214.htm

MedlinePlus. (n.d.). Heart Disease Risk Assessment. https://medlineplus.gov/lab-


tests/heart-disease-risk-assessment/

MedlinePlus. (n.d.). Hypertension: High Blood Pressure.


https://medlineplus.gov/highbloodpressure.html

Menees, D., Peterson, E., Wang, Y., Curtis, J., Messenger, J., Rumsfeld, J., Gurm, H.
(2013, September 5). Door-to-Balloon Time and Mortality among Patients

214
Ateneo de Zamboanga University

Undergoing Primary PCI. The New England Journal of Medicine, 369, 901-909.
https://www.nejm.org/doi/full/10.1056/NEJMoa1208200

Menon (2020) Stratified sampling in Machine Learning. https://medium.com/analytics-


vidhya/stratified-sampling-in-machine-learning-f5112b5b9cfe

MLMath.io. (2021, December 7). Math Behind SVM (Kernel Trick) Medium.
https://ankitnitjsr13.medium.com/math-behind-svm-kernel-trick-5a82aa04ab04

Mol, K. A., Smoczynska, A., Rahel, B. M., Meeder, J. G., Janssen, L., Doevendans,
P. A., & Cramer, M. J. (2018, October 1). Non-cardiac chest pain: prognosis and
secondary healthcare utilisation. Open Heart.
https://openheart.bmj.com/content/5/2/e000859

Monalakis, D. and Ingle, V. (2011). Applied Digital Signal Processing: Theory and
Practice. Cambridge University Press.

Mondal, D., Paul, D., Mukherji, S. (2017, August 15). Impedance Spectroscopy-Based
Detection of Cardiac Biomarkers on Polyaniline Coated Filter Paper. IEEE
Sensors Journal, 17(16), 5021-5029.
https://doi.org/10.1109/JSEN.2017.2717701

National Institute of Health (2021, April). Diabetes, Heart Disease, & Stroke.
https://www.niddk.nih.gov/health-information/diabetes/overview/preventing-
problems/heart-disease-stroke

National Nutrition Council. (2022, February 23). Use Pinggang Pinoy for a Healthier
You! Republika Ng Pilipinas. https://www.nnc.gov.ph/regional-
offices/mindanao/region-ix-zamboanga-peninsula/7135-use-pinggang-pinoy-
for-a-healthier-you

NHS (2019, November 28). Overview - Heart attack.


https://www.nhs.uk/conditions/heart-attack/

NHS (2021, November 18). Diagnosis: Heart Attack.


https://www.nhs.uk/conditions/heart-attack/diagnosis/

NHS (2022, October 6). Electrocardiogram (ECG).


https://www.nhs.uk/conditions/electrocardiogram/

215
Ateneo de Zamboanga University

Nyuytiymbiy (2020) Parameters and Hyperparameters in Machine Learning and Deep


Learning. https://towardsdatascience.com/parameters-and-hyperparameters-
aa60 9601a9ac

O'Gara, P., Kushner, F., Ascheim, D., Casey, D., Chung, M., Lemos, J., Ettinger, S.,
Fang, J., Fesmire, F., Franklin, B., Granger, C., Krumholz, H., Linderbaum J.,
Morrow, D., Newby, K., Ornato, J., Ou, N., Radford, M., Tamis-Holland, J.,
Tommaso, C., Tracy, C., Woo, J., Zhao, D. (2013, January). 2013 ACCF/AHA
Guideline for the Management of ST-Elevation Myocardial Infarction: A Report
of the American College of Cardiology Foundation/American Heart Association
Task Force on Practice Guidelines. Journal of the American College of
Cardiology, 61(4). https://www.jacc.org/doi/full/10.1016/j.jacc.2012.11.019

Philippine Heart Association (n.d.). 26th ASEAN Federation of Cardiology Congress.


https://www.philheart.org/

Philippine Heart Association (n.d.). Philippine Heart Association - 52100


https://www.philheart.org/be-involved/our-advocacies/52100

Philippine Heart Association (n.d.). Save a Life - Learn CPR.


https://www.philheart.org/be-involved/our-advocacies/save-a-life-cpr

Philippine Heart Association (n.d.). Stemiconsult App.https://www.philheart.org/be-


involved/our-advocacies/stemiconsult-app

Philippine Heart Association (n.d.). Fit Heart Minute. https://www.philheart.org/be-


involved/our-advocacies/fit-heart-minute

Philippine Heart Association. (n.d.). Let’s do the 52100 daily - Videos.


https://www.philheart.org/be-involved/our-advocacies/52100/498-let-sdo-the-
52100-daily-videos

Philippine Heart Association. (n.d.). Save a Life - Learn CPR.


https://www.philheart.org/index.php/be-involved/our-advocacies/save-a-life-cpr

Philippine Heart Association. (n.d.). Stemiconsult App.


https://www.philheart.org/index.php/be-involved/our-advocacies/stemiconsult-
app

216
Ateneo de Zamboanga University

Philippine Statistics Authority. (2021, August 20). Causes of Deaths in the Philippines
(Preliminary): January to June 2021. https://psa.gov.ph/content/causes-deaths-
philippines-preliminary-january-june-2021

Philippine Statistics Authority. (2022, September 15). Causes of Deaths in the


Philippines (Preliminary as of June 30, 2022). https://psa.gov.ph/content/2022-
causes-deaths-philippines-preliminary-30-june-2022

PhysioNet (2000, November 29). Long Term ST Database v1.0.0.


https://www.physionet.org/content/ltstdb/1.0.0/

PhysioNet (2009) European ST-T Database. https://physionet.org/content/edb/1.0.0/

PhysioNet (2017) WFDB Toolbox for MATLAB and Octave.


https://archive.physionet.org/physiotools/matlab/wfdb-app-matlab/

PhysioNet (n.d.) Definition of ST and T episodes.


https://physionet.org/files/edb/1.0.0/annotations.shtml

PhysioNet (n.d.) PhysioBank ATM. https://archive.physionet.org/cgi-bin/atm/ATM

PhysioNet (n.d.). European ST-T Database.


https://archive.physionet.org/physiobank/database/edb/

PhysioNet (n.d.). The MIT-BIH ST Change Database.


https://archive.physionet.org/physiobank/database/stdb/

Pierce, J. (2021, September 24). The Cost of a Heart Attack. Preventative Diagnostic
Center. https://www.pdcenterlv.com/blog/the-cost-of-a-heart-attack/

Poynton, C., (2012). Digital Video and HD: Algorithms and Interfaces. ScienceDirect.
https://doi.org/10.1016/C2010-0-68987-5

PyData (n.d.) pandas - Python Data Analysis Library. https://pandas.pydata.org/

Python (n.d.) CSV File Reading and Writing. https://docs.python.org/3/library/csv.html

Python Institute (n.d.). About Python. https://www.pythoninstitute.org/about-python

Python Software Foundation (n.d.). What is Python? Executive Summary. Python.org.


https://www.python.org/doc/essays/blurb/

217
Ateneo de Zamboanga University

PyWavelets (n.d.) PyWavelets - Wavelet Transforms in Python.


https://pywavelets.readthedocs.io/en/latest/

Rajiv, J. (2022, April 1). Low Pass, High Pass and Band Pass Filters - Simple
Explanation. https://www.rfpage.com/low-pass-high-pass-and-band-pass-filters-
simple-explanation/

Raspberry Pi. (n.d.). Raspberry pi 4 model B specifications. Raspberry Pi.


https://www.raspberrypi.com/products/raspberry-pi-4-model-b/specifications/

Raspberry Pi. (n.d.). Raspberry Pi Trademark Rules and Brand Guidelines.


https://www.raspberrypi.com/trademark-rules/

Read the Docs (n.d.) Python Heart Rate Analysis Toolkit https://python-heart-rate-
analysis-toolkit.readthedocs.io/en/latest/quickstart.html

Realme Philippines (n.d.). realme 10000mAh Power Bank 2 – realme (Philippines)


https://www.realme.com/ph/realme-power-bank-2

Roland, J. (2020, February 19). Types of Heart Attacks: What You Should Know.
Healthline. https://www.healthline.com/health/heart-disease/types-of-heart-
attacks

Ross J., Ranum D., Diamond R., Troxel D., (2016). Internal Medicines Closed Claims
Study: An Expert Analysis of Medical Malpractice Allegations.
TheDoctorsCompany. https://www.thedoctors.com/siteassets/pdfs/risk-
management/closed-claims-studies/10579_ccs-internalmed_nomarks_fr.pdf

Rouse, M. (2022). Hyperparameter.


https://www.techopedia.com/definition/34625/hyperparameter-ml-
hyperparameter

Sadowsky, J. (n.d.). The continuous wavelet transforms: A tool for signal investigation
and understanding.https://www.jhuapl.edu/Content/techdigest/pdf/V15-N04/15-
04-Sadowsky.pdf

Saeed, M. (2022). Synthetic Data: What It Is and Why It Matters.


https://exchange.scale.com/public/blogs/synthetic-data-what-it-is-and-why-it-
matters

218
Ateneo de Zamboanga University

Salian, A. (2022, May 31). Moving Average Filter: Towards Signal Noise Reduction.
Codemonk: Product Design & Engineering. https://codemonk.in/blog/moving-
average-filter/

Sampson, M. (2018, March). Continuous ECG monitoring in hospital: part 2, practical


issues. British Journal of Cardiac Nursing, 13(03), 128-134.
https://openresearch.lsbu.ac.uk/download/8402c9583d54838e5f33329728b013
c25c04053dc0b8e601c742218043712cfc/1052512

Scikit learn (n.d.). GridSearchCV. https://scikit-


learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.ht
ml

Scikit learn (n.d.). Recursive Feature Elimination with Cross-Validation. https://scikit-


learn.org/stable/auto_examples/feature_selection/plot_rfe_with_cross_validatio
n.html

Scikit learn (n.d.). scipy.signal.freqz — SciPy v1.10.1 Manual.


https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.freqz.html

Scikit-learn (n.d.). About us. https://scikit-learn.org/stable/about.html

Scipy. (n.d.). https://scipy.org/

Shah, R. (2023). What is Synthetic Data in Machine Learning and How to Generate
It. V7Labs. Retrieved from https://www.v7labs.com/blog/synthetic-data-guide

Sharma, S. (2021, December 12). Kernel Trick in SVM - Analytics Vidhya. Medium.
https://medium.com/analytics-vidhya/how-to-classify-non-linear-data-to-linear-
data-bb2df1a6b781

Shoppee (n.d.). Ecg Heart Pulse Sensor Module Ad8232.


https://shopee.ph/EcgHeart-Pulse-Sensor-Module-Ad8232-
i.20469516.1308882544

Silva, I & Moody, G.B. (2014). An Open-source Toolbox for Analysing and Processing
PhysioNet Databases in MATLAB and Octave.
https://pubmed.ncbi.nlm.nih.gov/26525081/

Singh, M. (2021). Synthetic Data — key benefits, types, generation methods, and
challenges. https://towardsdatascience.com/synthetic-data-key-benefits-
types-generation-methods-and-challenges-11b0ad304b55

219
Ateneo de Zamboanga University

Single-lead, Heart Rate Monitor Front End Data sheet AD8232. (n.d.). Retrieved April
18, 2023, from
https://cdn.sparkfun.com/datasheets/Sensors/Biometric/AD8232.pdf.

Suni, E. (2022, September 22). How Sleep Deprivation Affects Your Heart.
https://www.sleepfoundation.org/sleep-deprivation/how-sleep-deprivation-
affects-your-heart

The Society for Cardiovascular Angiography and Interventions (SCAI) (2008,


November 30). Heart Attack and Conditions That Mimic Heart Attack: Learn
About Chest Pain. https://www.secondscount.org/heart-condition-centers/info-
detail-2/nonheart-attack-sources-of-chest-pain

Thiamchoo, N., & Phukpattaranont, P. (2017). R Peak Detection Algorithm based on


Continuous Wavelet Transform and Shannon Energy. ECTI Transactions on
Computer and Information Technology (ECTI-CIT), 10(2), 167–175.
https://doi.org/10.37936/ecti-cit.2016102.64837

University of Rochester Medical Center. (n.d.). Stress Can Increase Your Risk for
Heart Disease
https://www.urmc.rochester.edu/encyclopedia/content.aspx?ContentTypeID=1
&ContentID=2171

Vähätalo, J. H., Huikuri, H. V., A. Holmström, L. T., Kenttä, T. V., E. Haukilahti, M. A.,
Pakanen, L., Kaikkonen, K. S., Tikkanen, J., Perkiömäki, J. S., Myerburg, R. J.,
& Junttila, M. J. (2020, January 1). Association of Silent Myocardial Infarction
and Sudden Cardiac Death. JAMA Cardiology. JAMA
Network. https://jamanetwork.com/journals/jamacardiology/fullarticle/2737873

Villines, Z. (2022, September 20). What is the normal range for troponin levels?
MedicalNewsToday. https://www.medicalnewstoday.com/articles/normal-
troponin-levels

Vogel, B., Claessen, B. E., Arnold, S. V., Chan, D., Cohen, D. J., Giannitsis, E.,
Gibson, C. M., Goto, S., Katus, H. A., Kerneis, M., Kimura, T., Kunadian, V.,
Pinto, D. S., Shiomi, H., Spertus, J. A., Steg, P. G., & Mehran, R. (2019, June
6). ST-segment elevation myocardial infarction - Nature Reviews Disease
Primers. Nature. https://www.nature.com/articles/s41572-019-0090-3

220
Ateneo de Zamboanga University

Williams, R. (2011, June 28). Depression After Heart Attack: Why Should I Be
Concerned About Depression After a Heart Attack? AHA Journal.
https://www.ahajournals.org/doi/10.1161/CIRCULATIONAHA.110.017285

World Health Organization. (2020, July 13). HEARTS: technical package for
cardiovascular disease management in primary health care: Risk-based CVD
management. https://www.who.int/publications/i/item/9789240001367

Xu ZJ. (n.d.). Early Signs of a Heart Attack. Sutter Health.


https://www.sutterhealth.org/health/heart/early-signs-of-a-heart-attack

You, J., Jiang, K., Chen, H., & Wen, H. (2015). ST Segment Extraction from Exercise
ECG Signal Based on EMD and Wavelet Transform. MATEC Web of
Conferences, 22, 01039. https://doi.org/10.1051/matecconf/20152201039

221
Ateneo de Zamboanga University

APPENDICES

APPENDIX A
ZCMC LETTER OF REQUEST

222
Ateneo de Zamboanga University

APPENDIX B
HANDS-ON OF THE PRO SIM 8 SIMULATOR

On September 24, 2022, the proponents visited ZCMC Biomedical Engineering


Department. The goal of the visit is to confirm if the Prosim8 Vital Sign Simulator can
simulate ECGs, especially STEMI ECGs. Upon visitation, the following guide
questions were answered:

1) Can prosim8 generate Myocardial Infarction?


Yes. The ST segment of the ECG simulation is adjustable from +0.10 to
+0.80 mV (elevated ST segment = myocardial infarction).
Similar Myocardial Infarction ECG is also simulated using ACLS wave
group, 2nd degree AV black waveform.

2) Can the simulator generate ECG with artifacts?


Yes. The following artifacts that can be generated are 50/60 Hz line
interference, muscle noise, respiration noise, and baseline wander. It must be
taken note that this can only be generated one at a time.

3) Can the simulations be saved?


With the use of prosim8, no. The suggestion is to create a code or
algorithm that will save data acquired to save the simulations.

223
Ateneo de Zamboanga University

APPENDIX C
ZCMC’S MEDICAL TECHNICIAN IV INTERVIEW

The proponents revisited the ZCMC Biomedical Engineering Department on


September 30, 2022. The purpose of the visit is to interview Medical Technician IV,
Mr. Roel S. Rojas, for his insights and suggestions regarding the proponent’s thesis
topic. The following notes were acquired:

Insights provided on the thesis topic:


- Talked and suggested searching more about other diagnostic devices such as
ultrasound, x-ray, CT-scan, MRI, blood test, and ECG in detecting heart attack
- Suggested researching about the parameters (P, QRS, T wave) and
specifications (amplitude, time) of the ECG and how it affects the ECG
- Pointed out how the paper’s approach is similar with Holter Monitors; the
proponents highlighted the difference between the two.
- Talked about the variation in ports in connecting the leads/electrodes and
display to the ECG devices

Suggestions provided:
- Talked about hardware noise typically present in medical devices and its
filtered-out hardware base but only applicable if the device is connected to AC.
Since the battery will be utilized for PHAAS, there is no need to worry about it.
- Suggested taking note of electromagnetic interference (EMI) from electronics
such as cellphones, televisions, microwaves, aircon, monitors, etc. It can affect
data acquisition; therefore, it should be noted when the user uses the device.
- Suggested the use of double insulated lead
- Suggested the use of electro-gel for ECG acquisition (make sure it is meant for
ECG, not ultrasound - available on the market and any brand will do)
- Introduced reusable and non-reusable electrodes which are readily available in
the market
- Agreed on the use of the strap for electrode placement to lessen the effects of
movement noise in the ECG
- When testing, compare the proposed device to the industry standard a.k.a
devices in the hospital

About Prosim 8 Simulator:


- Simulation can be saved or recorded via laptop.
- ECG simulations cannot be done simultaneously, but simulation types can be
done consecutively.

224
Ateneo de Zamboanga University

APPENDIX D
CONSENT FORM

225
Ateneo de Zamboanga University

APPENDIX E
BETA TESTING PRE-TEST QUESTIONAIRRE

226
Ateneo de Zamboanga University

227
Ateneo de Zamboanga University

APPENDIX F
BETA TESTING POST-TEST SURVEY

228
Ateneo de Zamboanga University

229
Ateneo de Zamboanga University

APPENDIX G
ESTIMATION OF CURRENT CONSUMPTION OF PHAAS

According to the power consumption benchmarks from Raspberry Pi Dramble


(n.d.), the Raspberry Pi 4 B consumes 540 mA when idling and 1280 mA when under
400% CPU load. Since the Raspberry Pi 4 B will be used to process the data acquired
by the analog ECG sensor and analyze it with the machine learning algorithm, we took
into consideration the highest possible power consumption of the Raspberry Pi. The
datasheet provided by Sparkfun states the Analog ECG sensor typically has a low
supply current of 170 µA (0.17 mA) while the Adafruit ADS1015 12-bit ADC has a
supply current of 150 µA (0.15 mA) according to Makerlab Electronics(n.d.).
Additionally, the maximum current draw for the 16x2 LCD Display with I2C is around
200 mA according to Circuitar (n.d.), and the GSM module uses a current of 1.04 mA
in sleep mode, around 17.38 mA in idle mode, and around 159.22 mA to 211.11 mA
for voice calls (SIMCom, n.d.).
Taking these values into consideration, in the case that a heart attack is not
detected, meaning the gsm module will remain in idle mode, the estimated device
consumption on the 10,000 mAh power bank is 1,497.7 mA resulting in an estimated
battery life of 6 hours, and 40 minutes. It is to be expected that the power consumption
will increase in the case of a heart attack detected in which the patient is most likely
being brought into the hospital for medical treatment. The following figure provides the
formula used for calculation and the exact value of the estimated battery life of the
power bank upon incorporation into PHAAS modules.

230
Ateneo de Zamboanga University

APPENDIX H
INITIAL BILL OF HARDWARE MATERIALS

Hardware Components Cost (Php)

Raspberry Pi 4 Model B Microprocessor 5,488.90

Sparkfun Analog ECG Sensor 569.00

Adafruit ADS1015 12-bit ADC 649.00

iCare ECG Electrode Patches 431.00

Sim800L v2 GSM Module 390.00

16x2 Character LCD Module Display HD44780 with I2C 149.75

Realme Power Bank 2 899.00

128 GB SanDisk Ultra Micro SD Card 759.00

Sim Card for GSM Module 20.00

Total 9,355.65

231
Ateneo de Zamboanga University

APPENDIX I
SUMMARY OF DR. ULANGHUTAN’S INTERVIEW

Q: Can heart attack be detected using three electrodes?


A: Clinically, 12 electrodes are preferred because it shows more views where ST-
elevation can be confirmed in multiple readings. Additionally, electrode placement will
dictate which side/wall of the heart is blocked, as it can occur in one, or multiple
vessels.

Q: How many cardiac cycles are needed to confirm that STEMI is occurring?
A: More than one cardiac cycle is needed to confirm and should be consistent. Once
ST-elevation is detected due to a myocardial infarction, the rest of the ECG will be ST-
elevated. The STEMI usually lasts for 24 hours and evolves (ST elevation could
increase is one example)

Q: Is it possible to not feel the physical symptoms of a heart attack (STEMI)


when it occurs?
A: Yes, especially if the patient is diabetic, old, or female. They can manifest as silent
ischemia. If there is a high index of suspicion for silent ischemia (shortness of breath
among other symptoms), an ECG test is to be conducted. There are some cases
wherein the result is MI.

Q: What is Normal Sinus Rhythm?


A: Normal sinus rhythm is normal ECG whether in resting or active state.

Q: Does symptoms show immediately when heart attack occurs?


A: Yes, the moment that there is a blockage in the heart, physical symptoms (mainly
chest pain) will be felt by the patient. If the plaque is not removed from the artery in 6
to 12 hours, it will lead to necrosis of the heart.

Q: What should a patient do when experiencing a heart attack?


A: They can take medications. Ultimately, they should still go to the hospital for
treatment.

Q: Is it possible for someone prone to heart attack to be alone?


A: There must be someone to monitor the patient as heart attacks can occur at
anytime, anywhere. In some cases, it can happen in the morning.

232
Ateneo de Zamboanga University

APPENDIX J
SUMMARY OF DR. ISMAEL’S INTERVIEW

Q: How long does it take for the symptoms to appear from the onset of STEMI?
A: It varies. Via ECG, there are changes occurring in the micro-level. It depends on
the size and depth of the infarction and the risk factors from the patient (age and health
conditions like diabetes). Also, the bigger the damage (to the heart), the easier it is to
notice physical symptoms on the onset of a heart attack. Additionally, silent
myocardial infarction is possible with a certain population (heart attacks with no
symptoms)

Q: Is ST-elevation a consistent characteristic that can determine STEMI on all


views (chest leads, precordial leads, etc.)?
A: Yes.

Q: How many cardiac cycles are needed in order to confirm STEMI from the
ECG reading? Does it require consistency?
A: Yes, it needs to be consistent. It cannot be determined with just one or a couple
of cardiac cycles – will be considered as artifact.

Q: How long will the ST-elevation and T-wave inversion last when STEMI has
occurred?
A: When the infarction is complete (STEMI has occurred), it will not go back to
normal unless the heart is revascularized.

Q: What is the threshold value to consider the ST segment to be elevated?


A: It depends on the placement of the leads (chest lead or precordial lead). Usually,
1 or 2 small boxes in the ECG readout/paper. It must be noted that ECG reading can
be subjective.

Q: What are your suggestions in acquiring a good ECG reading upon context?
A: Proper placement must be observed to get proper reading as there is a possibility
of misinterpretation.

Q: Would you recommend we have an actual person with IHD test the device?
A: It is not advisable.

233
Ateneo de Zamboanga University

APPENDIX K
FUNCTIONAL TESTING RAW RESULTS

234
Ateneo de Zamboanga University

235
Ateneo de Zamboanga University

APPENDIX L
SYSTEM TESTING RAW RESULTS ST-ELEVATION AND ARTIFACT SIZE TEST

236
Ateneo de Zamboanga University

APPENDIX M
SYSTEM TESTING RAW RESULTS CASE 1: STEMI ECG

237
Ateneo de Zamboanga University

APPENDIX N
SYSTEM TESTING RAW RESULTS CASE 2: NORMAL ECG

238
Ateneo de Zamboanga University

APPENDIX O
MACHINE LEARNING PERFORMANCE USING SYSTEM TESTING DATA RAW
RESULTS

239
Ateneo de Zamboanga University

APPENDIX P
BETA TESTING RAW RESULTS: MACHINE LEARNING PERFORMANCE

240
Ateneo de Zamboanga University

241
Ateneo de Zamboanga University

APPENDIX Q
MACHINE LEARNING PERFORMANCE USING BETA TESTING DATA RAW
RESULTS

242
Ateneo de Zamboanga University

APPENDIX R
PIN CONFIGURATIONS OF HARDWARE COMPONENTS

Pin configuration of Analog ECG Sensor to Raspberry Pi


Analog ECG Raspberry Pi 4 Description
Sensor Pins Pins

3.3V 3.3V power The 3.3V Pin of the Analog ECG


Sensor is connected to the 3.3V
power pin of the Raspberry Pi 4

GND Ground The GND Pin of the Analog ECG


Sensor is connected to the
Ground pin of the Raspberry Pi 4

Pin configuration of Sparkfun Analog ECG Sensor to ADS1015


Analog ECG ADS1015 ADC Description
Sensor Pins Pins

A0 Output The Output Pin of the Analog


ECG Sensor is connected to the
ADS1015 ADC

Pin Configuration of 12-bit ADC Raspberry Pi 4


ADS1015 Raspberry Pi Description
ADC Pins Pins
VDD 3.3V The VDD pin of the ADS1015 ADC
is connected to the 3.3V power
supply of the Raspberry Pi 4
GND Ground The GND pin of the ADS1015 ADC
is connected to the Ground pin of
the Raspberry Pi 4

243
Ateneo de Zamboanga University

SCL SCL I2C The SCL pin of the ADS1015 ADC


is connected to the SCL I2C
(GPIO) pin of the Raspberry Pi 4
SDA SDA I2C The SDA pin of the ADS1015 ADC
is connected to the SDA I2C
(GPIO) pin of the Raspberry Pi 4

Pin configuration of SIM800L v2 GSM Module to Raspberry Pi 4


GSM Module Raspberry Pi Pins Description
5VIN 5V power The VDD pin of the
SIM800L v2 GSM
Module is connected to
the 5.0V power supply
of the Raspberry Pi
GND Ground The GND pin of the
SIM800L v2 GSM
Module is connected to
the Ground pin of the
Raspberry Pi
TXD RXD The TXD pin of the
SIM800L v2 GSM
Module is connected to
the RXD pin (GPIO 15)
of the Raspberry Pi
RXD TXD The RXD pin of the
SIM800L v2 GSM
Module is connected to
the TXD pin (GPIO 14)
of the Raspberry Pi

244
Ateneo de Zamboanga University
Pin configuration of 16x2 LCD Display
16x2 LCD Display Raspberry Pi 4 Pins Description
Pins

VCC 5V The VCC pin of the 16x2 LCD


Display is connected to the 5V
power supply pin of the
Raspberry Pi 4

GND Ground The GND pin of the 16x2 LCD


Display is connected to the
Ground pin of the Raspberry Pi
4

SCL SCL I2C The SCL pin of the 16x2 LCD


Display is connected to the SCL
I2C (GPIO) pin of the Raspberry
Pi 4

SDA SDA I2C The SDA pin of the 16x2 LCD


Display is connected to the SDA
I2C (GPIO) pin of the Raspberry
Pi 4

245
Ateneo de Zamboanga University

APPENDIX S
USER’S MANUAL

General Information:

The Portable Heart Attack Alert System (PHAAS) is a portable, real-time


STEMI heart attack detector. It is incorporated with an alert system that automatically
contacts designated personnel, such as the user and clinicians when a heart attack is
detected. This device is mainly designed for patients diagnosed with ischemic heart
disease which relies on the detection using the user’s ECG. This design mainly caters
to concerns such as the reliability of symptoms for detection, the unpredictability of
heart attack, and early chances of diagnosis and treatment. This device’s design
enables IHD patients to live their daily life normally while having a reliable, portable
device they can carry around to inform them early on in cases of emergency.

----------------------------------------------------------------------------------------------------------------

Disclaimer:

The Portable Heart Attack Alert System is configured for one user only. This
includes remote access to the device with a personal VNC account, and the subject
name and designated contacts specified in the device’s python code. Reconfiguration
of the device is necessary for another user to use the device. It is also important to
note that all configurations are done by a qualified technician, ensuring the device is
set up correctly and functions properly.

----------------------------------------------------------------------------------------------------------------

Setting Up VNC Server:

A Virtual Network Computing (VNC) Server is a software application that allows


for remote access and control of another computer’s screen, mouse, and keyboard.
The server is installed on the remote computer to be controlled, in this case that is the
Raspberry Pi. On the other hand, a VNC Viewer is installed on the device used for
control such as another computer, tablet, or mobile phone. This process is to be done
by a qualified technician ensures that the VNC Server on the Raspberry Pi and the
VNC Viewer on the control device of the user is set up correctly.

The following instructions show how to enable the VNC Server in the Raspberry Pi:

1. Turn on Raspberry Pi and open the terminal. Enter the command “sudo raspi-
config” as shown in the figure below. This will open a menu-based interface
which allows for certain configurations to be made including the enabling of the
VNC Server in the Raspberry Pi.

246
Ateneo de Zamboanga University

Figure1 – Calling software configuration tool via terminal

2. A window will pop up showing various options. To enable VNC server, use
arrow keys to select “Interfacing Options” and press Enter as shown in Figure
2. Afterwards another window will pop-up, choose VNC, as shown in Figure 3
to enable remote access of Rpi via VNC server.

Figure 2 – Software configuration tool window

Figure 3 – Enabling VNC for remote access of Raspberry Pi

3. A prompt will appear asking for confirmation of enabling VNC Server as shown
in Figure 4, select and press Enter. Another prompt will then appear saying that
VNC Server is enabled as shown in Figure 5. Press Enter to exit the prompt
and return to the terminal.

247
Ateneo de Zamboanga University

Figure 4 – Asking for confirmation of enabling VNC server

Figure 5 – Confirmed enabled VNC server

4. After returning to the terminal, exit it and click the VNC Server icon shown in
Figure 6. This icon is located on the right side of the taskbar on the desktop.
Once clicked, a user interface will pop up as shown in Figure 7. This interface
will show information such as the I.P. Address of the server along with the
Signature, and Catchphrase which users should check for when connecting to
the server.

Figure 6 - VNC Server Icon

248
Ateneo de Zamboanga University

Figure 7 - VNC Server User Interface

5. While it is possible to remote access the Raspberry Pi with the I.P. Address
alone, it is subject to change depending on which wifi-network the Raspberry
Pi is connected to. For easier access to the VNC Server, create a RealVNC
account online and sign in by clicking on the VNC Server icon in the desktop of
the Raspberry Pi, clicking on the status menu icon, and pressing “Licensing…”
as shown in Figure 8. This allows for remote access no matter what network
the Raspberry Pi is connected to.

Figure 8 - Creating a RealVNC Account to Remote Access Raspberry Pi

6. After following the instructions given and signing in the RealVNC account,
remote access can be achieved through the VNC Viewer application after
signing in the RealVNC account used for the VNC Server.

249
Ateneo de Zamboanga University

----------------------------------------------------------------------------------------------------------------

Setting Up Remote Access of PHAAS through VNC Viewer:

After setting up the VNC Server and creating a RealVNC to remote access the
Raspberry Pi as long as it has a wifi connection, remote access can be established by
the user, allowing them to start data acquisition.
1. To establish remote access to PHAAS, first ensure that the device to be used
for remote access has the VNC Viewer application installed. The devices can
either be a smartphone, tablet, laptop, or PC. It must be taken note that an
internet connection is required to establish the connection.

2. Sign in to the RealVNC account using the credentials provided during


creation of the VNC account.

Figure 9 - Sign in prompt in VNC Viewer Application

3. Once signed in, power on Raspberry Pi and select the corresponding name of
the server in the address book or input the I.P. Address to establish a
connection.

Figure 10 - Address book of RealVNC account of user

250
Ateneo de Zamboanga University

4. Enter the username and password of the VNC Server to be granted remote
access.

Figure 11 - Sign in Prompt to Access VNC Server

----------------------------------------------------------------------------------------------------------------

Configuration of Device for Specific User:

Remotely accessing the device will allow configurations to be made for a


specific user of this device. Besides the setup of the VNC account of the user, the
configurations to be made include indicating the user’s name and their designated
contacts’ phone numbers in the python code. This is to be done by a qualified
technician to ensure the configurations are set properly for the specified user. Below
is a list of instructions on how to make these configurations.

1. Open Geany App by clicking the icon shown in Figure 12.

Figure 12 - Geany App Icon

2. Upon opening the Geany application, the python file “phaas_final_code.py”


should be opened automatically as shown in Figure 13.

251
Ateneo de Zamboanga University

Figure 13 - phaas_final_code.py accessed in Geany Application

In the case the python code is not available upon opening of the
application, press the “Open Existing File” icon as shown in Figure 14 and
access the following directories to access the python code
/home/phaas/PHAAS_FINAL/phaas_final_code.py as shown in Figure 15.

Figure 14 - Open Existing File Icon

Figure 15 - Directory to access python code.

252
Ateneo de Zamboanga University

3. Once the PHAAS code has been opened, set the name of the user in line 36
of the python code under the subject variable as shown in Figure 16.

Figure 16 – PHAAS code line 35 and 36

4. Also, set the number of the designated contacts under lines 234 and 235 which
is for the first designated contact, lines 262 and 263 for second designated
contact as shown in Figure 17.

Figure 17 – Assigning of SMS and call contacts.

5. Press “Ctrl+S” to save configurations made.


6. To run the code, open the terminal and input “python3
/home/phaas/PHAAS_FINAL/phaas_final_code.py.” The code will then run
continuously unless the device is turned off or shut down.

----------------------------------------------------------------------------------------------------------------

How to use PHAAS:

1. Place three electrode patches following the chest lead II placement provided
in the list and figure shown below:

(Chest Lead II Placement)

• Right Arm (RA) - anywhere between the right shoulder and right elbow
• Left Arm (LA) - anywhere between the left shoulder and left elbow

253
Ateneo de Zamboanga University

• Left Leg (LL) - anywhere below the left torso and above the left ankle;
the most preferable location is around one inch below the leftmost part
of the left rib.

2. Strap the PHAAS device to the user along the waist.

3. Connect the lead connectors to the device and the electrode patches. The
placement should follow the following:
• Red Snap-on connected to RA electrode patch.
• Yellow Snap-on connected to LA electrode patch.
• Green Snap-on connected to LL electrode patch.

4. Turn on the device by pressing the button on the power bank.

5. Remotely access the PHAAS through VNC Viewer once it is booted up. Run
the code by entering the following in the terminal:
“python3/home/phaas/PHAAS_FINAL/phaas_final_code.py”
6. After executing the code, PHAAS is now working and can be left to function
independently. The LCD display module will display texts regarding what
phase of the process is the device in which is as follows:

• ‘ACQUIRING ECG SIGNAL’ - ECG signal is being acquired from the


user.
• ‘PROCESSING ECG’ - ECG is being pre-processed.
• ‘SAVING DATA’ - relevant data are being recorded.
• ‘PLOTTING ECG’ – data is being plotted and then afterwards will be
saved.
• ‘NORMAL’ - ECG is in a normal state.
• ‘STEMI DETECTED!’- ECG displays ST-elevation and STEMI heart
attack is possible (alert system is initiated in this case)

7. If the user desires to remove the device, simply turn off the power bank or shut
it down via VNC server. Then, remove the connection between electrodes and
lead, and remove and discard the electrode patches used.

----------------------------------------------------------------------------------------------------------------

IMPORTANT NOTES:

• After every use of electrode patches, a new set is expected to be used for the
next application.
• Delays are expected between the acquisition and detection of STEMI mainly
due to processing and saving data time.
• A network connection is established when the GSM Module LED Indicator
blinks once every 3 seconds. This allows messages to be sent and calls to be
made.

254
Ateneo de Zamboanga University

• In the case of STEMI detection, the alert system is initiated and designated
personnel will be contacted. It will be indicated on the LCD screen as follows:
• ‘CONTACTING CONTACT 1’ - sending SMS and initiating calls to
assigned contact no.1
• ‘CONTACTING CONTACT 2’ - sending SMS and initiating calls to
assigned contact no.2
• The device can be charged by plugging in a charger and a USB C cable to
the USB C port of the power bank.
• If device was removed or turned off, upon using again, configuration via VNC
server is required in order to run the PHAAS code.
• To access saved filter CSV filters, follow the directory:
“/home/phaas/PHAAS_FINAL/filter_csv”.
• To access saved feature CSV filters, follow the directory:
“/home/phaas/PHAAS_FINAL/feature_csv”.
• To check and confirm ECG events and acquisitions, ECG plots are available at
“/home/phaas/PHAAS_FINAL/filter_plots”.

----------------------------------------------------------------------------------------------------------------

TROUBLESHOOTING

If messages and calls do not send despite the display of STEMI:


• Check for network availability via the blinking lights of the device. If it blinks
erratically, the location most likely doesn’t have a good network connection.
Move to a better location with better signal reception.
• Check if the power bank is at low battery; charge accordingly if it is so.

If PHAAS always displays STEMI despite confirmation of Normal ECG state:


• Ensure proper electrode placement.
• Make sure the electrode patch is attached to clean skin (not sweaty and no
hair)

255

You might also like