AI-based Environmentally-Sustainable Cardiovascular Disease Diagnostic

Sahithi Cherukuri & Sahana Anamika, 
Santa Clara High School

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

ABSTRACT

This reusable LSTM-based household diagnostic decreases misdiagnoses of CVDs (the cause of 32% of deaths) and can reduce thousands of tons of medical waste daily. The 83.8% diagnosing accuracy and 93.3% overall functionality show promise in detecting various diseases and creating a cleaner world.

Introduction

Every day an estimated 40,000 tons of medical waste are created globally

A huge contributor is cardiovascular disease (CVD), the leading cause of death globally (32% of all deaths)

Medical practitioners, alongside being inaccessible and expensive for some, have a CVD diagnostic accuracy below 60%, due to their difficulty identifying the patterns that differentiate various CVDs

This worsens the impact on both an individual patient and the environment as a whole

Leads to a delayed, incorrect, or even lack of diagnosis

ICU beds used in emergency cases, due to a lack of an accurate early diagnosis, can each generate up to 138 kg of CO2-e and 15 kg of solid waste per day

Most CVD diagnostics currently used by medical practitioners are single-use, only adding to the already high amounts of medical waste created each day

From the electrodes used in ECGs to the syringes and needles used to administer blood tests, many current diagnostic tools are both patient-independent and expensive

Current Artificial intelligence (AI) models show promise in accurately diagnosing diseases throughout the medical world, but lack in simulating the doctor-to-patient connection, sharing what steps a user should take post-diagnosis, and providing general support throughout the diagnosing process, creating the stigma surrounding AI-based diagnosis systems

It is apparent that the world needs an accessible and reliable early means of identifying cardiovascular diseases, that has added support and is zero waste

Comparative Analysis

({{Product, Description, Features}, {Eko App,      App that monitors and creates reports for heart disease,through ECG and 
stethoscope sounds. Users can record,save,and mark their heartbeat audio, Real-time Diagnosis
Applies AI
Addresses CVDs}, {Steth IO, Aids remote interactions with doctors (telemedicine) through precision medicine and 
access to clinical trends. Saves vitals to a web portal. Can be used for transitional care, Mental Health Support
Next Steps
Real-time Diagnosis
Addresses CVDs
Targets Environmental Sustainability}, {ClearSteth, User-friendly and interactive device. Can share 
vitals with clinicians via high-quality stethoscopes, Mental Health Support
Next Steps
Addresses CVDs}, {Sirona, Cloud-based software to help medical providers monitor patients world-wide. Certified 
cardiographic technicians create medical reports based on input data, Mental Health Support
Next Steps
Real-time Diagnosis
Addresses CVDs}, {Proxy, Uses coronary computed tomography angiography and AI to monitor 
for atherosclerosis early on. User-based care is provided, Real-time Diagnosis
applies AI
Addresses CVDs}, {Anumana’s Diagnostic 
Algorithm Pipeline, Diagnostic tool that studies the largest patient datasets and looks for rare conditions
 based on what it has seen. Built to work in the medical setting alongside medical care professionals, Real-time Diagnosis
applies AI
Next Steps
Addresses CVDs}, {ARGENE® Respiratory range, Works with various input types to detect 35+respiratory pathogens through PCR. The 
pathogens that are to be tested can be varied based on what is deemed necessary, Real-time Diagnosis}, {Ideal Solution, Environmentally friendly and efficient auscultative audio-based CVD diagnosis system.Interactive  and easy to use with 
explicit instructions. Mental health and next steps support offered post-diagnosis to empower users, Real-time Diagnosis
applies AI
Mental Health Support
Next Steps
Addresses CVDs
Targets Environmental Sustainability
}})

As analyzed from the table above, there is as per our knowledge currently no environmentally sustainable AI-based real-time diagnosis that provides mental health support and next steps and focuses on CVDs. Of the many products and companies reviewed, Steth IO seems to best target this issue, however, like ClearSteth, Sirona, and the ARGENE® Respiratory range, they lack, among others, a machine-based diagnosis, which does not solve the issues of life-threatening misdiagnoses and lack of diagnoses. Although solutions like the Eko App and Proxy are more accurate and precise with their AI-based algorithms, they lack  in ecological sustainability and simulating the patient and doctor experience, subtracting from the user experience. Some real-time diagnostics also  require inaccessible and climate-unfriendly input types , like an ECG/EKG machine. Anumana’s Diagnostic Algorithm Pipeline, an AI model trained to identify rare diseases,  is limited in offering users mental health support. Such drawbacks result in many patients avoiding machine-based diagnoses, despite their high accuracy.

Goal

Telemedicine by Auscultation is an accessible and interactive artificial intelligence-based system that identifies and diagnoses the unique murmurs found in cardiovascular diseases early on, reducing the trillions of kilograms of medical waste created globally.

Features

Background

Methods

Hardware Methods

Insert the Micro SD card into the Raspberry Pi (RPi)

Plug the USB stethoscope into the top, right-hand corner of the USB-A input

Plug the connector cable’s USB-A end into the battery

Plug the cable’s USB-C end into the Raspberry Pi’s USB-C input

Turn on the battery pack

Confirm power distribution via the Raspberry Pi’s red status light

Design, print, and construct a laser-cut box to house the device

’

The Raspberry Pi 4B model’s in-built WiFi module (IoT) makes in beneficial for data transfer

A 15000mAH battery with a run-time of fifteen hours improves usability and reliability, indirectly reduces carbon and methane emissions, and ensures that power is not wasted

The device is:

100% reusable, with no waste products after testing

Long-term usable, estimated to be usable for decades

One size fits all: One device can be used by many

The reusable digital stethoscope amplifies audio & converts sound to digital data for a given program to process (see image)

Data Collection and Preprocessing

Procedure

The Python programming language was applied to preprocess the data

The primary library used to preprocesses the given audio data was librosa

({{Primary Librosa Function, Purpose}, {librosa.load(), Loads the heartbeat audio file in as a numerical time series 
array.Converts all audio to have one channel (mono)}, {librosa.util.normalize(), Normalizes the audio data to 
range between the numbers-1 and 1}, {librosa.effects.split(), Splits the heartbeat audio based on 
non-silent periods (“silence” is alterable)}, {librosa.resample()
librosa.util.fix_length(), Resamples all audio clips to be the given samples.
}})

Post preprocessing, the data distribution is as follows

The apparent data imbalance suggest that the common multi-class classification model will be biased

Deep Learning Model

Procedure

The software has been created to operate as follows:

Model Architecture

The model architecture implemented in this study is a Pytorch-based long short-term memory (LSTM) autoencoder

LSTMs identify patterns in sequential/time series data

The autoencoder compresses data (encoder) and deciphers it to create the original (decoder), 
performing feature extraction along the way

Our model used two LSTM encoder cells and three decoder cells

X0, the first LSTM’s input, is a tensor (created during data preprocessing)

H2 (the encoder output) and X0’ (decoder input) is 64 neurons

The decoder reconstructs the original tensor

Four separate binary classification models were created (one per condition), to avoid any data bias when diagnosing

Each model was run for 150 training epochs

The loss function used is the L1 Loss Function, which sums the absolute differences between predicted & true values. The cost is the mean absolute error (MAE)

The optimizer implemented is Adam, which alters each LSTM weights’ learning rate by taking the approximate values of the first and second moments of gradient

Training

After training each model with its appropriate conditions, the decrease in losses suggest that the models are learning patterns within their given data.

Prior to testing, a certainty formula was derived to express the model confidence on a prediction:

certainty[name] = 2**(-mismatch[0]/thresholds[name])

thresholds[name] : The final validation losses for each model

mismatch[0] : Loss variation between the input and trained data

Ideally, mismatch would be zero, yielding a 100 % certainty

An equal mismatch and threshold outputs a 50 % confidence

Raspberry Pi Program

The Raspberry Pi serves as a way for patients to record their heartbeat in real time in order to get a quick diagnosis

Procedure

Much of the data preprocessing mimicked that done to the training data, however, certain functions were applied beforehand to efficiently record real-time data

({{Program, Purpose}, {pyaudio.PyAudio ().get_host _api _info _by _index (0), Finds all input devices connected to the Raspberry Pi in order to
select the ri-sonic® PCP-USB stethoscope as the microphone when recording
}, {Stream=audio.open (format=pyaudio.paInt16,rate=44100,channels=1,
input_device _index=device_index,input=True,frames_per _buffer=44100)        
, Sets recording to mono (one channel) at 44100 Hz through the digital stethoscope.librosa.effects.split 
(wav_input,top_db=45,frame_length=1500,hop_length=375)
}, {librosa.effects.split (wav_input,top_db=45,frame_length=1500,hop_length=375), Splits audio into non-silent periods where "silence" is variable}, {(number_input _beats+1)//2-1
wav_r[all_beats[input__beat _index][0]:all_beats[input_middle _beat _index][1]], Finds the middle beat in the audio}, {librosa.resample (single_input _beat,single_beat.shape[0],1500,fix=False)
librosa.util.fix_length (resampled_beat,1500), Resamples the audio input to be 1500 samples.librosa.util.normalize (resampled_beat)
}, {librosa.util.normalize (resampled_beat), Normalizes the array to numerical values to be between-1 and 1}, {create_dataset (normalized_beat), Converts the numerical array into a tensor}, {shutil.move (source_path,new_tensor _path), Sends the tensor to the deep learning module through the cloud}})

Web App

Design

Here are some of the many pages of the web app:

Features

Usage instructions - How to use the product in an eco-friendly and safe manner (e.g. stethoscope placement for each condition, and how to use the same device for long-term and even community testing)

Cool, pleasing colors aid during times of stress

Universal calming and peaceful symbols

Simple to understand - Simple English language, understandable to the largest group of people

Empowerment through knowledge - Genetics and environment information help users identify risk factors

Results - The statistical probability that the user has each condition is printed

Mental Health Support - Positive affirmations, calming symbols, and open contact help users feel at ease

Next Steps - Future planning (ex. who to contact, urgency, and closeby medical facilities)

Promoting Environmental Sustainability - Sharing the positive impact users have made on the environment

Testing and Results

Functionality Test

Purpose: Evaluate product functionality

Scoring Metrics (see excerpt from round #5):

Criterion Achieved: 1 Point

Criterion Not Achieved: 0 Points

The functionality test was performed over five rounds, each with twenty tests and product iterations in between. The results of each round are as follow:

Round 1: 78/120 (65%)

Round 2: 90/120 (75%)

Round 3: 96/120 (80%)

Round 4: 106/120 (83.33%)

Round 5: 112/120 (93.33%)

Round 5 (latest round) averaged to 5.6/6 points, with a high reliability as displayed by line of best fit created by the points acquired by each trial:

Diagnosing Accuracy Test

100 test heartbeats for each given condition, making a total of 400 audio clips (100*4)

Each of these heartbeat clips was run through all four models, creating a total of 1600 tests (400*4)

After applying the certainty formula to each test data, the resulting certainty value is assigned:

Negative (N) if the certainty is 50% or lower

Positive (P)  if the certainty is greater than 50%

The average certainties of each audio type has been visualized via the matrix below

The true negatives (TN), true positives (TP), false negatives (FN), and false positives (FP) for each test are as follow

({{  , TP, FP, TN, FN}, {Healthy Heartbeat, 90, 35, 265, 10}, {Aortic Stenosis, 86, 45, 255, 14}, {Mitral Regurgitation, 84, 54, 246, 16}, {Pulmonary Stenosis, 76, 64, 236, 24}, {Total, 336 ,   198   , 1002 ,  64}})

This data is then applied into the accuracy formula:

In this testing dataset, the maximum number of true positives is 400, while the maximum number of true negatives is 1200, meaning the accuracy metric may not equally represent both the true positives and true negatives when diagnosing

This calls for the need of two other evaluation metrics:

Sensitivity (Recall) measures the the number of true positive 
predictions out of all potential positive predictions (400)

Specificity measures the number of true negatives out of all 
potential negative predictions (1200)

({{  , Accuracy, Sensitivity, Specificity}, {Healthy Hearbeat, 88.75%, 90%, 88.33%}, {Aortic Stenosis, 85.25%, 86%, 85%}, {Mitral Regurgitation, 84.62%, 84%, 82%}, {Pulmonary Stenosis, 76.69%, 76%, 78.66%}, {Average, 83.8%, 84%, 83.5%}})

The sensitivity, specificity, and accuracy are relatively similar here

The accuracy metric can therefore be determined as unbiased

This concludes that the diagnostic accuracy of this device is around 83.80%, or 1338/1600 cases, which exceeds the given criterion of an 80% accuracy

Discussion

Billions worldwide need an environment-friendly, quick, accessible, and early detection system for heart disease, the leading cause of death that takes more than 2,500 lives and generates over 40,000 tons of waste per day. Our study solves this issue, as a fully-reusable diagnostic test that analyzes heartbeats in real time for anomalies. 

Additionally, this product:

Is interactive and easy to use

Aids detection aftermath

Provides an immediate result

Provides mental health support

Provides guidance through a web app

Can be used outside of a medical setting

Produces zero medical waste

Limitations

Data Shortage - the models may not have had enough data to identify all variations a given CVD may have

Lack of Human Testing - The overall usability of this device was not directly tested by human subjects

Error and Impact

({{Error, Impact, Recommended Action}, {While performing functionality testing,the stethoscope 
was simply held up to the metronome by a human hand. , This is not the most sturdy method to hold the stethoscope with,and hence the 
distance between the computer and stethoscope may have varied.The stethoscope 
picks up more than just heartbeat(s),so it may have also consumed other unwanted sounds., The program can identify and remove all 
sounds other than the heartbeat (noise 
reduction/cancellation)
}, {When resampling the data,it is possible 
that some of the waveforms’ shape was altered., This would impact the average waveform shape the models creates when training and 
could result in the models learning incorrect heartbeat patterns for each condition., The sampling rate can be modified in order to locate 
the ideal samples that will not affect the overall 
waveform shape while processing data efficiently.}})

Future Advancements

Compact & Better Carbon Footprint

Embedding the microcomputer and battery into the stethoscope will reduce any carbon dioxide released when manufacturing the individual parts and make transportation easier.

Real World Application

Reaching out to cardiologists, hospitals, and various environmentalists will reveal the real-world benefits of Telemedicine by Auscultation, as well as provide insight into areas of improvement

Accuracy

More diverse audio data will increase the models’ accuracies when detecting a condition. This benefits doctors who will have less misdiagnosed cases and reduces the need for one-time-use diagnostics that pollute the biosphere.

Applications

More Detections

This multi-use pipeline can be applied to additional cardiovascular conditions and even respiratory and gastrointestinal conditions, better aiding users and reducing wasteful diagnostics.

The pipeline can also be applied to detect diseases using other time series-based tools, such as ECGs

Usage in Various Locations

Outside of hospitals, the device can be used in more remote locations such as rural communities and even outer-space to reduce the amount of fatalities in these areas too

Noise (Sound) Detection in Audio files

The program we created to extract one heartbeat the an audio can be used to detect and extract various other types of noise

Preprocess Audio and Aid Cloud Communication

The system we developed for audio preprocessing and cloud communication proved quite successful as seen in our functionality test. It has the potential to be implemented into other audio and/or cloud-based research endeavors as well

With a 93.3% functionality success and 83.8% accuracy, compared to primary care physicians’ diagnosing success under 60%, this informative and interactive real-time diagnostic shows promise in identifying and treating cardiovascular diseases world-wide, while creating a sustainable and healthier environment for generations to come.