IDENTIFICATION OF DETERIORATION CAUSED BY AHF, MADS OR CE BY RR AND QT DATA CLASSIFICATION

Abramov M., Tsukanova E., Tulupyev A., Korepanova A., Aleksanin S. Identification of Deterioration caused by AHF, MADS or CE by RR and QT Data Classification. Abstract. A sharp deterioration of the patient’s condition against the backdrop of the development of life-threatening arrhythmias with symptoms of acute heart failure (AHF), multiple organ dysfunction syndrome (MODS) or cerebral edema (CE) can lead to the death of the patient. Since the known methods of automated diagnostics currently cannot accurately and promptly determine that the patient is in a life-threatening condition leading to the fatal outcome caused by AHF, MODS or CE, there is a need to develop appropriate methods. One of the ways to identify predictors of such a state is to apply machine learning methods to the collected datasets. In this article, we consider using data analysis methods to test the hypothesis that there is a predictor of death risk assessment, which can be derived from the previously obtained values of the ECG intervals, which gives a statistically significant difference for the ECG of the two groups of patients: those who suffered deterioration leading to the fatal outcome caused be MODS, AHF or CE, and those with favorable outcome. A method for unifying ECG data was proposed, which allow, based on the sequence of RR and QT intervals, to the construct of a number that is a characteristic of the patient's heart condition. Based on this characteristic, the patients are classified into groups: the main (patients with fatal outcome) and control (patients with favorable outcome). The resulting classification method lays the potential for the development of methods for identifying the patient's health condition, which will automate the detection of its deterioration. The novelty of the result lies in the confirmation of the hypothesis stated above, as well as the proposed classification criteria that allow solving the urgent problem of an automatic detection of the deterioration of the patient's condition.


Introduction.
Currently, in medical practice, the generally accepted method for analyzing an electrocardiogram (ECG) is a visual assessment of changes in ECG curves. Despite the great diagnostic efficiency of such an analysis, it obviously has a subjective component, and in the area of borderline states of health, its diagnostic ability is extremely unsatisfactory [1,2]. Usually, 6 waves can be distinguished on the ECG record: P, Q, R, S, T, U. The intervals between the waves, the duration, shape, amplitude of the waves carry information that allows doctors to draw conclusions whether the patient suffers from diseases associated with the cardiovascular system. The RR interval is an indicator that characterizes the duration of the cardiac cycle and is measured in any ECG lead. The availability of research on this indicator is undeniable and has long been used in assessing heart rate variability [3,4,5]. For  SDNN (standard deviation of RR intervals) of less than 50 milliseconds is a highly specific (88%) sign in predicting fatal outcomes in patients with myocardial infarction [6]. The QT interval, which reflects the time between the beginning of the depolarization process (the beginning of the Q wave) and the completion of the process of repolarization of the ventricular myocardium (the end of the T wave), is one of the most significant ECG parameters in cardiology. Upward or downward deviation of its value from the norm is associated with a high risk of malignant ventricular arrhythmias. Any genesis of changes in the QT interval (congenital or acquired) is equally dangerous as a risk factor for the development of ventricular tachyarrhythmias [7]. It should be noted that cardiac fluctuations are not strictly periodic and are characterized by rhythm variability [33].
There are good results in research on the spectral characteristics of heart activity [34][35][36], which uses mathematical modeling of the human cardiovascular system and shows its connection with different patient states. There are also results in the field of data analysis and artificial intelligence, allowing a posteriori in an automatic mode to form a class of patients with an increased risk of stroke [8] or to predict the state of the pilot, using the results of the ECG as an indicator of the pilot's physical condition [9]. Thus, the study of the ECG has shown itself to be promising in predicting the various conditions of patients; however, until now, the question of the relationship between the state of deterioration of health in patients, manifested by symptoms of multiple organ dysfunction syndrome (MODS), acute heart failure (AHF) or cerebral edema (CE), and their ECG data, has not yet been studied. Research in this area would potentially make it possible to predict changes in this condition on the basis of ECG signal. Timely identification of such conditions and subsequent prediction of their changes are urgent tasks. Moreover, with the development of such conditions, deterioration occurs quickly, without leaving sufficient time to prepare for treatment, and standard visual analysis does not allow a sufficiently accurate forecast of the patient's condition.
Thus, on the one hand, the problem of automating the assessment of the patient's condition leading to a fatal outcome from the development of MODS, AHF or CE is urgent, its solutions are in demand; on the other hand, there are no existing studies aimed at the automation of this assessment. The aim of this study is to automate the assessment of the patient's condition based on ECG data using machine learning methods. This article presents the result of the first stage of the study, namely, the verification using data analysis methods of the hypothesis that there is a predictor of death risk assessment, which can be derived from the previously obtained values of the ECG intervals, which gives a statistically significant difference for the ECG of the two groups of patients: those who suffered deterioration leading to the fatal outcome caused be MODS, AHF or CE, and those with a favorable outcome.
The practical significance of the study lies in the formation of the potential for solving the problem of automated assessment of the patient's condition based on ECG data and predicting outcomes in case of deterioration in health using machine learning models. Such a diagnosis could allow earlier recognition and faster response to potentially lifethreatening conditions of patients. Doctors could take the necessary measures before the moment of critical changes. The theoretical significance of the study lies in the proposition of the estimation method for classifying patients into the main (with MODS, AHF or CE, which led to a fatal outcome) and control (recovered) groups based on the ECG records, as well as the formation of a basis for the development of a classification methodology that allows achieving higher accuracy metrics, and predicting deterioration. The novelty of the study is attributable to the lack of methods, models and algorithms for identifying the state of deterioration and predicting its changes as a result of the development of the syndrome of acute cardiovascular, multiple organ failure or cerebral edema. The new feature based on the sequence of ECG records allowing patient's classification into main and control group is proposed, its level of significance in a logistic regression model is 3.64×10 -6 , a new method is proposed for solving the urgent problem of identifying the deterioration of the patient's condition on the basis of ECG analyzes, which differs from the existing ones in the formulation of the problem being solved, and in the accuracy of the results obtained.
Machine learning and data analysis methods are increasingly used today in applications to problems from the field of medicine and healthcare [10][11][12][13][14][15][16][17][18][19][20][21][22][23][24]. These are generally the tasks of diagnostics, predicting the course of the disease development, assistance in prescribing treatment, etc. [10][11][12][13][14][15][16][17][18][19][20][21][22][23][24]. An important role among these tasks is those related to monitoring and diagnostics of the most probable scenarios of the course of the disease. For example, in [10], on the basis of data collected using a smartphone (voice data on calls, data on the use of smartphones, reflecting social and physical activity), authors draw the conclusions about the user's mood, and the prospects for bipolar disorder. In [11], machine learning methods are used in diabetes monitoring to determine the risk of diabetes based on the personal medical history of patients. In addition, machine learning methods are also used to study the brain, as, for example, in [21] -for the motor imagery EEG classification. There are other examples of the successful use of artificial intelligence and data analysis methods in tasks from the field of medicine, in particular, a wide range of works using image analysis methods to search for anomalies on X-rays and other images [16].
One of the applications of machine learning in medicine is also the automation of the recognition of critical cases for various diseases of patients. [19-21, 22, 23]. For example, [19] proposed a model for automating the analysis of breast cancer from images. In [20], the authors applied unsupervised machine learning methods to cluster ICU patients to identify patients at increased risk of mortality based on laboratory data. The authors of [21] proposed a new method for analyzing the relationship between the results of electroencephalography and human cognitive functions. The work [23] proposed methods for identifying patients with osteoporosis who have an increased risk of hip fracture.
Another common area of application of machine learning and data analysis methods in medicine is the processing of information related to the human cardiovascular system [12,13,17,18,22,24]. Authors of [24] proposed a model for heart disease prediction; they trained three classifiers on the Cleveland dataset of 303 data instances that contains the following patient features: gender, type of chest pain, cholesterol level, maximum heart rate, etc. The authors used the following ECG features: the slope of the peak exercise ST segment V1, ST depression induced by exercise relative to rest, maximum heart rate achieved, the characteristics of resting ECG. The results showed that LR and SVM have high effectiveness (87% and 85% accuracy, respectively). The work [12] is focused on the automation of several waveforms detection on the ECG signal with the use of machine learning methods. In [13], these methods are used to develop a classification of heart diseases based on patient data from the Cleveland dataset. The author used models different from those in [24]. 6 machine learning models were used to classify patients into healthy and suffering from cardiovascular diseases subjects; CNN showed the best performance with the highest accuracy in 85.86%. [17] is focused on the ECG anomaly leading to different types of heart diseases automatic detection with MATLAB. The following features were considered: interval and amplitude values of P wave, Q wave, T wave, QRS complex, and ST segment, FIR filters showed good results. Results of [18] showed a great performance of machine learning techniques in automatic coronary artery disease detection based on ECG time series. The authors used 50 ECG features, including average and standard deviation of RR interval values, corrected QT interval values, etc. Authors of [22] proposed a method for heart disease identification with missing data handling: they replaced missing values with the mean values during pre-processing. Three ML models were trained on the data from the Cleveland dataset. There are also works on heart disease detection which don't use ECG information. In [14], authors tried to predict cardiovascular and cerebrovascular events in patients with hypertension based on data on the status of use of medical resources, detailed information about diseases, their types, treatment methods, prescriptions, and the status of the clinic in which the treatment was carried out. In [15], machine learning methods are used to assess the development of coronary heart disease in breast cancer survivors.
Thus, the application of machine learning to ECG analysis has shown good results in identifying conditions associated with the cardiovascular system. However, the task of the analysis of ECG measurements to identify the subsequent death of the patient as a result of the development of MODS, AHF or CE has not yet been addressed.
The purpose of the general study is to automate the assessment of the patient's condition based on ECG data using machine learning methods. As the first stage of the study, this work solves the problem of testing the hypothesis using data analysis methods that there is a predictor of death risk assessment, which can be derived from the basis of previously obtained values of the ECG intervals, which gives a statistically significant difference for the ECG of the two groups of patients: those who suffered deterioration leading to the fatal outcome caused be MODS, AHF or CE, and those with a favorable outcome. The dataset provided by the Federal State Public Enterprise Nikiforov's All-Russian Center for Emergency and Radiation Medicine of the Emergencies Ministry of Russia (the Nikiforov's ARCERM) is characterized by a wide variation in the number of ECG tests taken (from 6 to 407) in different patients. This variation is explained by the different number of hospitalization days of patients, different reasons for admission to the hospital, and an increase in the frequency of testing when the condition worsens. Since the analysis of such data by statistical methods is difficult, it is necessary to unify them, that is, from the sets of values of the RR and QT intervals for each patient, obtain one value. In other words, in this work, the following problem was solved: on the basis of all the obtained values of the intervals, it is necessary to form one, which will be a characteristic of the patient's ECG records, and the differences in which for two groups (patients who died as a result of deterioration with symptoms of AHF, MODS and CE, and patients with a favorable outcome) will be statistically significant.
2. Materials and methods. The dataset was collected, the criterion derived from ECG data was proposed. The formulated hypothesis was tested using logistic regression.

Dataset.
The first stage of the study was carried out on the basis of anonymized data on 120 patients of both sexes who were consecutively hospitalized in the Federal State Public Enterprise Nikiforov's All-Russian Center for Emergency and Radiation Medicine of the Emergencies Ministry of Russia (the Nikiforov's ARCERM) in the period from 01.01.2015 to 31.12.2017. The main group (MG) consisted of 60 patients with a lethal outcome as a result of deterioration; the control group (CG) consisted of 60 patients with a favorable outcome. The dataset provided by ARCERM at the first stage consisted of tables containing the following information: patient diagnoses, data on all ECG records, general data about the patient, data on events significant for the patient's condition that occurred during his stay in the hospital (surgery, life-threatening change in the rhythm of heart contractions, etc.). Below we will take a closer look at each of the tables: Patient diagnosis table was formed on the basis of epicrises; each patient in the dataset had from 1 to 37 diagnoses.
ECG diaries contained records of all available amenable to analysis of ECG records in the form of diaries. All patients underwent a standard 12-lead ECG: 4 electrodes were placed on the arms and legs distal from the shoulder and thigh; 6 electrodes were placed on the chest surface at the following points (V1 -fourth intercostal space along the right sternal line, V2 -fourth intercostal space along the left sternal line, V3 -in the middle of the distance between V2 and V4, V4 -fifth intercostal space along the midclavicular line, V5 -in horizontal plane V4 along the anterior axillary line, V6 -in the horizontal plane V4 along the mid-axillary line). The duration of the QT interval on the resting ECG using the interval editing module was measured by the classical method of E. Lepeshkin and B. Surawicz [25], which is based on drawing a straight line tangent along the line of maximum slope of the descending part of the T-wave until it intersects with the isoline (slope method). Measurements were performed in standard lead II and, in the case of a pronounced U-wave, in chest lead V5. For ECG measurements, MAC 1600 ECG Analysis System and MUSE NX were used. The table contains the following information: • Date and time of measurement; • Data on the rhythm of heart contractions. In the presented data set, 4 main types of rhythm were distinguished: 1) sinus; 2) atrial fibrillation and atrial flutter; 3) ectopic; and 4) with a permanent pacemaker; • Whether the rhythm has changed since the last diary. The exact time of the change is unknown; the rhythm can change from one of the first three types described above to another of the first three types; • Whether the patient was in the intensive care unit at the time of the ECG recording; • Characteristics of the general condition of the patient (satisfactory, moderate, severe, etc.); • Data on the patient's hemodynamics (stable, unstable), on the patient's breathing and consciousness, which together determine whether the patient is in deterioration. This information was extracted from complete diaries kept by doctors in a free-form text while observing patients; • Whether the patient experienced deterioration during the ECG recording; • Was the operation performed on the patient close to the time of the ECG recording; • Whether sympathomimetic drugs have been administered to the patient.
General patient data contained information on the following patient characteristics: age, gender, date of admission, date of a discharge / fatal outcome, number of days the patient was hospitalized, cause of fatal outcome, and hospitalization department.
RR and QT intervals contained data on the RR and QT intervals corresponding to the measurement diaries. Each diary corresponds to a different number of pairs of RR and QT intervals; for each pair of intervals, their lengths are known, as well as the presence of supraventricular and ventricular extrasystoles.
Next, let's consider the primary statistics of the dataset. Patients were treated in the departments of cardiology, cardiovascular surgery, intensive care, neurology, neurosurgery, emergency surgery, therapy, traumatology, hematology, and rehabilitation. In the main group, 26 (43.3%) patients had multiple organ dysfunction syndrome as the cause of fatal outcome, 28 (46.7%) patients had an acute cardiovascular failure, and 6 (10%) had cerebral edema. The gender distribution in both groups was the same and amounted to 50% of men and 50% of women. The duration of hospitalization ranged from 1 to 172 bed-days. Among the patients of the main group, diseases of the circulatory system prevailed as the main pathology and amounted to about 50% of cases, taking into account the concomitant pathology, the number of those suffering from diseases of the circulatory system is greater -83%. In the control group, diseases of the circulatory system also prevailed, amounting to more than 60% (Table 1), also taking into account the concomitant pathology, the number of those suffering from diseases of the circulatory system was greater -82%.
During hospitalization, all patients underwent electrocardiogram testing. Thus, each patient received from 1 to 38 ECGs. Due to the variability of heart rate between ECG tests, and also due to the fact that the quality of the records did not always allow using the entire ECG record,  The distribution by the type of the rhythm for all ECG records was comparable in both groups and amounted to about 60% for sinus rhythm, about 25-30% for atrial fibrillation ( Table 2). The original dataset contained 3 patients who received a permanent pacemaker. Since the pacemaker affects the heart rhythm, the changes in the ECG of these patients may be of a different nature, so these patients were excluded from the study at the moment. The final dataset contained 117 patients: 58 from the main group and 59 from the control group.  19 patients with a lethal outcome, the control group (CG) consisted of 19 patients with a favorable outcome. Sex distribution in both groups (main and control): 9 men and 10 women. The duration of the hospitalization ranged from 1 to 105 bed-days.
2.2. Data preprocessing. The dataset is characterized by a high degree of heterogeneity, for example, the table with diagnoses contains 1986 diagnoses, 1621 of them are unique within the dataset. Also, each patient has a variable number of diagnoses, days of hospitalization, ECG records, RR and QT intervals, etc. An additional difficulty when working with this data is the small size of the dataset. Thus, most of the data is either inapplicable for analysis, or requires a significant degree of preprocessing, so a subset of features was extracted from the general patient data set.
Based on the information about patients collected at the first stage, a database was formed, which contained information about the gender and age of patients, the number of days of hospitalization, pairs of RR and QT intervals from all ECG records.
Based on the available data, two tables were generated. In the first table, each row contains the patient identification number; the group to which the patient belongs (MG or CG); the patient's gender; age; the number of days of hospitalization, and information about whether the type of the heart rate has changed or not. Table 3 shows the general view of the row in the table. there are as many rows as there are RR and QT intervals (from 6 to 407). Table 4 shows a general format of the row of the analyzed dataset.

The proposed method for the unification of ECG data.
To simplify the further presentation of the research results, we introduce the following notation: Notation. Each patient number i has i n pairs of RR and QT intervals. Notation. For the patient number i the value of the j-th RR interval is denoted by RR ij .
Notation. For the patient number i the value of the j-th QT interval is denoted by QT ij .

Notation. For the patient number i the set of all the values of the patient's RR intervals is denoted by RR i .
Notation. For the patient number i the set of all the values of the patient's QT is denoted by QT i .
In addition, we will use the notation for some numerical characteristics, used for unifying the data on the recorded ECG. It is proposed to consider the values of the criterion or the analyzed dataset as a marker for classifying patients according to the values of the RR and QT intervals into two classes: the main group and the control group. Figures 1, 4 show the distribution of test values in both groups. Figures 2, 3 show the distribution of the criterion value in the MG and CG groups, respectively. According to Shapiro-Wilk normality test, criterion value isn't distributed normally, p-value is equal 0.2833 for the distribution of the criterion value in both groups, 0.4829 for MG, and 0.7372 for CG.   Hypothesis. There is a predictor of death risk assessment, which can be derived from the previously obtained values of the ECG intervals, which gives a statistically significant difference for the ECG of the two groups of patients: those who suffered deterioration leading to the fatal outcome caused be MODS, AHF or CE, and those with a favorable outcome. The criterion value can be used for patient classification into one of two groups.

МАТЕМАТИЧЕСКОЕ МОДЕЛИРОВАНИЕ И ПРИКЛАДНАЯ МАТЕМАТИКА
To test the hypothesis, a logistic regression model was applied, this model doesn't require specific distribution of predictors. Logistic regression is one of the machine learning methods [25], a statistical model used to predict the likelihood of an object belonging to one of two classes using a logistic function. The following assumptions are made about the probability of an object belonging to classes 1 and 0: denotes attributes of the object x , : 0.. j w j n ∈ regression coefficients. In our case, the patients are the objects, the criterion value is the attribute of the object, the patient groups are the classes (1 for MG, and 0 for CG).

Results.
This section describes the results of testing the proposed criterion during the first and the second stages of the study.
3.1. Testing the criterion. Table 5 shows the characteristics of the logistic regression model between the patient group and the criterion value. Figure 5 shows a plot of sensitivity and specificity (ROC-curve) for the initial data, figure 6 -graph of the logistic function.
Since the p-value of the test of the association between criterion value and the patient group is 3.64 × 10 −6 , which is less than 0.05, then we can talk about the presence of a statistically significant association. As the size of the dataset was bigger than 30 subjects, and the maximum likelihood estimates are asymptotically normal, for the p-value calculation z-score was applied that uses normal distribution.  formed for the initial data. An increase in the criterion value by 1 entails an increase in the logarithm of the odds ratio of dying by 44.7. Now, knowing that the value of the patient's criterion is a statistically significant indicator in determining the patient's group, it is possible to test how well this model is able to classify patients into the groups indicated above (MG and CG). In the role of the metric for assessing the quality of classification, we used sensitivity, that is, the proportion of all correctly classified patients relative to all patients in this group in the sample ( Table 6).  Table 7 shows the results of applying the resulting logistic regression model to new data. 3.3. Testing the criterion for patients with different causes of a fatal outcome. As a result of the work done, a model was built to classify patients into two groups: MG (with a fatal outcome as a result of deterioration) and CG (with a favorable outcome), based on data from the sequence of ECG tests. In the resulting dataset, deterioration manifested itself as symptoms of the following three conditions: acute heart failure, multiple organ dysfunction syndrome, and cerebral edema. Knowing the patient's risk of fatal outcome for whatever reason could help in treating the patient in a life-threatening condition. Also, deterioration leading to fatal outcome for various reasons can have a different clinical picture. From these points of view, it is of interest to evaluate the ability of criterion to  Figure 7 shows a scatter diagram of the criterion values for patients with different causes of fatal outcome, Table 8 shows the results of the classification of patients with different causes of fatal outcome on a combined dataset consisting of data obtained at the first and second stages. For better visualization, groups of patients with different causes of death are clearly separated along the OX axis in the diagram.

Software implementation.
The developed model was applied in the implementation of a prototype web service that allows using ECG data to determine whether a patient suffered from a life-threatening deterioration. The web service was developed using PHP for the server-side, HTML, CSS, JavaScript for the client-side and is hosted on the page at https://ecg.dscs.pro. To use it, you need to upload a file in excel format with data on the values of the pairs of RR and QT intervals of the patient in the following format, presented in Table 9:  Figure 8 shows the main page and interface of the web service prototype, Figure 9 shows the screen with the output of the result.   4. Discussion. The difference in the distribution of the criterion value in two groups (MG, CG) is statistically significant, so the proposed method for unifying the RR and QT interval values can be used as an independent criterion for classifying patients into MG (with a fatal outcome as a result of worsening with symptoms of MODS, AHF and CE) and CG (with a favorable outcome). This follows from the fact that for the initial data, the p-value in the logistic regression was close to 0, and the area under the ROC curve was 0.772. Thus, the hypothesis that there is a predictor of death risk assessment, which can be derived from the previously obtained values of the ECG intervals, which gives a statistically significant difference for the ECG of the two groups of patients: those who suffered deterioration leading to the fatal outcome caused be MODS, AHF or CE, and those with favorable outcome was confirmed. Each ECG analysis results in a set of RR and QT interval values. Thus, based on a sequence of ECG records, the value of the criterion can be calculated to identify whether the patient had a state of deterioration leading to fatal outcome using a logistic regression model. The results of classifying patients into risk groups on the new dataset are worse than the results on the original dataset; nevertheless, the likelihood of correct identification of deterioration in patients is quite high. The model was tested on patients with fatal outcomes for various causes. The model showed itself in the best way when identifying deterioration in patients whose cause of fatal outcome was the On the one hand, the approach proposed in the article is limited by the fact that it does not take into account the individual characteristics of the patient, on the other hand, taking into account the high-quality characteristics of the proposed criterion, it is very likely that the proposed indicator sufficiently aggregates information about the state of the patient's cardiovascular system. The main distinctive feature of this study is that it aims to find common features of patients with different causes of fatal outcome and derive the predictor of deterioration from their ECG data. The results obtained show that the proposed estimation method succeeds in finding similar features in ECGs of patients with MODS and AHF, but works poorly for patients with CE. Given the small number of the patients with this condition, we probably will further exclude them from the study.
The methodological choices were constrained by the size of the dataset as well as the characteristics of data received from ARCERM. In the future, the dataset will be expanded, and the number of considered features will also be increased, which will allow the use of a wider toolkit, which may positively affect the results of the study.
5. Conclusion. The logistic regression model used in the article demonstrated the possibility of accepting the hypothesis that the proposed method for unifying the values of the RR and QT intervals for one patient makes a statistically significant feature for determining the patient group (the main one -with a fatal outcome and the control one -with a favorable outcome). The constructed estimation method showed good results on new data as well. Thus, the hypothesis is accepted that there is a predictor of death risk assessment, which can be derived from the previously obtained values of the ECG intervals, which gives a statistically significant difference for the ECG of the two groups of patients: those who suffered deterioration leading to the fatal outcome caused be MODS, AHF or CE, and those with a favorable outcome.
The obtained criterion allows, with a sensitivity of at least 65%, to identify patients who had a state of deterioration as a result of the development of acute heart failure syndrome, multiple organ failure or cerebral edema, based on the results of ECG analysis. The model showed the best sensitivity (83%) when identifying the condition of patients whose cause of death was multiple organ dysfunction syndrome. As a result, the constructed model was used to develop a prototype web service for assessing the patient's condition and automatically determining lifethreatening deterioration of condition based on ECG data. The practical significance of the result is based on the fact that such a diagnosis can allow taking the necessary measures before the moment of critical changes. Patients may show signs of deterioration long before they become unstable. The ability to recognize these signs can lead to a decrease in mortality. The theoretical significance of the result lies in the construction of a mathematical model for classifying patients into those who had a favorable outcome, and those who have a fatal outcome as a result of the development of MODS, AHF or CE, as well as the basic formation for the development of a methodology for predicting the development of life-threatening conditions. Several new questions emerge in light of the discoveries presented here. One of the possible further research directions lies in the inclusion of the obtained results into a more complex model that takes into account other information about the patient, such as gender, age, the presence of a change in rhythms, etc. Bayesian trust networks or algebraic Bayesian networks can serve as such a model [26][27][28][29]. The advantage of the latter is that they can work with incomplete and inaccurate data, which can be an important advantage in the further work with medical data [28,30,31]. This will allow more information about the patient to be used, which can increase the chance of correct classification of the patient's risk group. The second direction can be the study of the dynamics of changes in ECG, in other words, the study of changes in RR and QT interval values over time, and building a model based on time series, which describes the dynamics of changes in the studied interval values. It will also provide new information about the patient that can help predict disease outcomes. The third possible direction is the construction of a model for classifying deterioration in terms of probable causes of fatal outcome, that is, a model that allows predicting the risk of the development of acute heart failure, multiple organ dysfunction syndrome, or cerebral edema.