{'fraction_non_alphanumeric': 0.04562982005141388, 'fraction_numerical': 0.02455012853470437, 'mean_word_length': 5.255963548646475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Diagnosis and prediction of COVID-19 severity: can biochemical tests and machine learning be used as prognostic indicators?

Objective This study aimed to implement and evaluate machine learning based-models to predict COVID-19’ diagnosis and disease severity. Methods COVID-19 test samples (positive or negative results) from patients who attended a single hospital were evaluated. Patients diagnosed with COVID-19 were categorised according to the severity of the disease. Data were submitted to exploratory analysis (principal component analysis, PCA) to detect outlier samples, recognise patterns, and identify important variables. Based on patients’ laboratory tests results, machine learning models were implemented to predict disease positivity and severity. Artificial neural networks (ANN), decision trees (DT), partial least squares discriminant analysis (PLS-DA), and K nearest neighbour algorithm (KNN) models were used. The four models were validated based on the accuracy (area under the ROC curve). Results The first subset of data had 5,643 patient samples (5,086 negatives and 557 positives for COVID-19). The second subset included 557 COVID-19 positive patients. The ANN, DT, PLS-DA, and KNN models allowed the classification of negative and positive samples with >84% accuracy. It was also possible to classify patients with severe and non-severe disease with an accuracy >86%. The following were associated with the prediction of COVID-19 diagnosis and severity: hyperferritinaemia, hypocalcaemia, pulmonary hypoxia, hypoxemia, metabolic and respiratory acidosis, low urinary pH, and high levels of lactate dehydrogenase. Conclusion Our analysis shows that all the models could assist in the diagnosis and prediction of COVID-19 severity.


Introduction
Coronavirus disease (COVID- 19) remains an emergency of global interest; up to 21 May 2021, a total of 164.52 million confirmed cases and 3.42 million deaths had accumulated from the disease [1]. Social disparity and the scarcity of hospital resources for the treatment of patients in hospital units have been identified among the main factors associated with an increased number of deaths from this disease [2][3][4][5][6][7]. Thus, it is essential to identify potential prognostic biomarkers towards earlier and more targeted care, especially considering that some patients with COVID-19 develop severe disease, which is associated with a higher risk of hospitalisation. Biomarkers provide a dynamic and powerful approach to understanding the spectrum of disease with applications in observational and analytic epidemiology, randomised clinical trials, screening and diagnosis, and prognosis [8]. Recently, studies investigating biomarkers to diagnose COVID-19 in early stages have been encouraged worldwide, aiming to provide a faster referral to treatment and reducing health-related problems associated with the disease [17,18].
Machine learning (ML) is an effective and innovative tool able to assist healthcare professionals, policymakers, and other stakeholders during decision-making processes. These computer system models learn and adapt information by using algorithms and statistical networks to analyse and draw inferences from patterns in data. In the field of clinical diagnosis of COVID-19, these predictive analyses grounded on biomarkers can help optimise the screening of patients with severe disease, minimising mortality and hospitalisation, and reducing care delays. Previous machine learning studies highlight that some demographic variables, patients' comorbidities, and laboratory findings can be predictive factors for COVID-19 mortality [9][10][11][12]. However, most of these studies included a small sample size, which may impact the model's robustness and reliability of findings (e.g., low sensitivity) [14][15][16] and prevent its use in practice. Moreover, to date, specific biomarkers associated with the disease severity and patients' hospitalisation in intensive care units are still unknown, which may hamper the development of further targeted treatments [13]. Thus, this study aims to implement and evaluate machine learningbased algorithm models for the diagnosis and prediction of the severity of COVID-19 using data from biochemical, haematological, and urine tests from a large sample size.

Data set
Data from the public Kaggle platform [19] on individuals that had an reverse transcription polymerase chain reaction (RT-PCR) exam to detect severe acute respiratory syndrome coronavirus 2 (SARS-Cov-2) infection in the Israelita Albert Einstein hospital (São Paulo, Brazil) were collected. Regardless of the RT-PCR result (positive or negative for COVID-19), patients were included for analysis when presenting data on biochemical, haematological, and urinary parameters (Table 1). Two subgroups of samples were created according to RT-PCR results: (i) 5, 643 patients' samples accounting for both negative (n = 5,086) and positive (n = 557) results; (ii) 557 positive samples of asymptomatic outpatients and patients with severe COVID-19, hospitalised in intensive care units. As the SARS-Cov-2 infection resembles other respiratory diseases, to minimise the chance of obtaining false-positive samples, patients who tested positive for at least one other virus or respiratory bacteria (see Table 1) were excluded from analyses.

Machine learning models
The first step for implementing any ML model is to perform exploratory analysis. The exploratory analysis intends to: (i) identify the presence of possible outliers, (ii) recognise patterns of data distribution in the multidimensional space, and (iii) identify relationships between variables [20]. In this study, both data used to build the COVID-19 diagnostic model and the data used to build the severity prediction model were previously subjected to two methods of exploratory analysis: principal component analysis (PCA) and k-means cluster analysis (KMCA). Additionally, the outliers were detected and eliminated from the dataset using the graphical method of leverage versus student residuals [21].
A total of four algorithms were used: (i) artificial neural networks (ANN), (ii) decision trees (DT), (iii) discriminant analysis by partial least squares (PLS-DA), and (iv) the method of k-nearest neighbours (KNN). For implementing these models with algorithms for the diagnosis and prediction of COVID-19 severity, 70% of the samples were used for the training set and 30% for the test set. For both the diagnostic model and the severity model, the Kennard-Stone method was employed to select samples from the training set and samples from the test set [22]. The samples used for implementing the algorithms for COVID-19 diagnosis were divided into class 1 (negative samples for COVID-19) and class 2 (positive samples for COVID -19). For the severity prediction models, samples were classified into class 1 (non-severe disease; i.e., outpatients) and class 2 (severe disease; i.e., hospitalised patients).
The number of latent variables (LVs) selected for the ML models was performed using the leave-one-out cross-validation method. The number of LVs presented the lowest square root of mean cross-validation error (RMSECV). The predictive capacity of the model was evaluated using the square root of mean error of prediction (RMSEP), where the classification models were optimised considering the lower RMSEP.
The analytical validation of the models based on the machine learning algorithms was performed using the following metrics: sensitivity, specificity, and accuracy. These figures of merit were calculated using the parameters true positive (TP), true negative (TN), false positive (FP), and false-negative (FN) [20,[23][24][25]. In ML, a sample is called a true positive when it belongs to class one (1) and is correctly classified by the ML algorithm as belonging to class one (1). A sample is considered a false positive when it belongs to class zero (0) and is incorrectly classified by the ML algorithm as being class one (1). A true negative sample belongs to class zero (0) and is correctly classified as class zero (0). Finally, a sample is false negative when it belongs to class one (1) and is wrongly classified by the ML algorithm as class zero (0). Sensitivity and specificity are defined as the ability of the ML-based model to correctly classify negative and positive samples, respectively. Accuracy is the ability of an ML-based model to correctly classify both negative and positive samples. The values of sensitivity, specificity, and accuracy vary from zero (0) to one (1), and the closer to 1, the more sensitive, specific, and accurate the model, respectively. These parameters were calculated according to equations (1)-(3), respectively: where FN: false negative; FP: false positive; TN: true negative; and TP: true positive.

Table 1
Biochemical, urinalysis, haematological, virological, and bacteriological tests performed on the patients included in the study.

Results
The variation of all biomarkers (biochemical, haematological, and urinary) for the COVID-19 patients are summarised in Table 2.
The results of the exploratory analyses of the diagnostic and severity disease data using the PCA model are depicted in Fig. 1. Additional results with the KMCA model are available in Figures ESM 1 and ESM 2 in the Online Resource. These models were able to differentiate between positive and negative patients for COVID-19 (diagnostic data) and between patients with non-severe disease and vs severe disease (disease severity data).
Outlier samples were analysed for both diagnostic and disease severity data using the graph of leverage versus student residuals with 95% of confidence interval (Fig. 2). No sample was detected as an outlier.
The results of the four ML-based models for the data subsets are presented in Table 3. All models for COVID-19 diagnosis and prediction of disease severity were compared with each other using the following metrics: training time, model training error, cross-validation error, sensibility, specificity, and accuracy (area under the ROC curve). The ANN model performed better as it presented less training time and forecasting errors, and greater overall accuracy. The ROC curves of the models are depicted in Fig. 3.
According to the ML-based models, some biomarkers were judged as critical or important for predicting COVID-19 and disease severity (see Table 4). Ferritin was ranked as the most important variable in all models. Further information is available on Online Resource.

Discussion
In the present study, we used four ML-based models (ANN, DT, PLS-DA, and KNN) with over 5,000 RT-PCR samples and data on patients' biochemical, haematological, and urinary parameters that effectively predicted COVID-19 diagnosis and disease severity in Brazil. Considering the high likelihood of existing SARS-Cov-2 mutations (B.1.1.7, P.1, and P.2) in the sample, the complexity of these models is even higher [38][39][40].
Several ML-based models, including unsupervised approaches (e.g., PCA and hierarchical cluster analysis) and supervised models (e.g., artificial neural network, PLS-DA, DT, KMC, and KNN), are available in the scientific literature [26,27]. The performance of these models relies on several factors, including sample size and the type of data. ML-based models built with larger samples are usually more accurate and efficient for series forecasting; for instance, the deep neural networks that require a great amount of training data [28][29][30]. The larger the network architecture, the more data is needed to obtain more robust models [31][32][33].
Regarding COVID-19, previous models have been implemented aiming at predicting disease behaviour and severity. However, most of these studies used a small sample size, which may directly impact the performance of the model [34][35][36]. Banerjee (2020) developed an ML algorithm to forecast COVID-19 diagnosis using a public database with 598 patients, of which only 39 were positive for SARS-CoV-2. The authors obtained a model with good specificity (91%) but low sensitivity (43%), which can prevent the use of the model in practice for early diagnosis of the disease [14]. Similarly, Joshi (2020) implemented a logistic regression model previously trained with 390 samples, of which only 33 were positive for COVID-19, proving sensitivity and specificity values of 93% and 43%, respectively [37]. Additionally, most studies implemented ML-based models using only routine blood tests [41,42]. In our study, besides the complete blood count test, data from patients' biochemical, urinary, bacteriological, and virological tests aiming at identifying further biomarkers associated with COVID-19 were also included. The models reached 84%-98% accuracy. The biomarkers that most contributed to this result and predicting the diagnosis and severity of COVID-19 included: hyperferritinaemia, hypocalcemia (low levels of ionised calcium), hypoxemia (low arterial oxygen pressure, pO 2 ), pulmonary hypoxia (low inspired fraction of arterial oxygen, FiO 2 ), respiratory acidosis (high levels of total CO 2 and pCO 2 ), metabolic acidosis (high levels of lactic acid and low venous pH), low urinary pH, and high levels of lactate dehydrogenase (LDH).
Similar precision values were recently reported by Zhou (2021) (94%) and Wu (2021) (90%) after the implementation of ML-based models for COVID-19 diagnosis and disease severity, respectively [15,35]. However, different variables were highlighted by the authors as important for data classification. According to Zhou (2021), these were the rates of circulating lymphocytes, while Wu (2021) reported the rates of neutrophils and lymphocytes, the neutrophil/lymphocyte ratio, and platelet/lymphocyte ratio [15,35]. This variation may be associated with the different sample sizes (n = 357 vs n = 51) and type of models (decision tree model vs support vector machine model).
Recently, most patients with severe COVID-19 who require hospitalisation in intensive care units develop an atypical form of acute  distress syndrome, which is usually accompanied by a preserved volume of pulmonary gas [43]. This suggests hypoxia, which results from the difficulty in performing gas exchanges at the level of the pulmonary alveoli. It has been observed that this pulmonary dysfunction can also compromise iron metabolism [43]. Imbalances in both haemoglobin and ferritin levels were reported in patients with severe disease or deaths caused by COVID-19. In a systematic review with a meta-analysis conducted by Taneri (2020), which included 189 studies (n = 57,563 patients), high-risk patients with severe disease had significantly high levels of ferritin (weighted mean difference (WMD), 473.25 ng/mL (95% CI 382.52; 563.98)) and low haemoglobin levels (WMD, 4.08 g/L (95% CI 5.12; − 3.05)) when compared to patients with moderate or low-risk disease [44]. In our study, both patient groups with the disease (diagnostic model) and patients with severe disease (disease severity model) presented low levels of haemoglobin and high levels of ferritin. All developed ML-based models (ANN, PLS-DA, KNN, and DT) highlighted that the differences in the levels of these two biomarkers were critical, both for the prediction of COVID-19 diagnosis and disease severity. Recent studies have indicated anaemia and hyperferritinaemia to be strong biomarkers for the prognosis of mortality due to SARS-CoV-2, in addition to other serious respiratory diseases [45][46][47][48][49][50].
Ferritin is a protein found mainly in the liver, bone marrow, and spleen and is the body's main source of iron storage. It is considered a key biomarker of immune dysregulation, mainly in a situation of hyperferritinaemia, through the direct route of proinflammatory and immunosuppressive effects contributing to a cytokine storm [51][52][53]. Some studies show that fatal outcomes caused by COVID-19 are accompanied by cytokine storm syndrome involving high levels of inflammatory markers, such as ferritin [54,55]. In the present study, ferritin was associated with predicting the severity of COVID-19, and it was the most important biomarker in predicting the diagnosis of the disease by all the ML-based models developed, corroborating the  literature data. Acid and base disorders are important indicators in the pathogenesis and severity of several diseases, especially respiratory diseases of infectious origin, such as pneumonia [56][57][58]. Acidosis can occur as a result of a significant increase in arterial carbon dioxide pressure (respiratory acidosis) or a variety of inorganic or organic compounds (metabolic acidosis), such as bicarbonate, lactic acid arterial, ketones, or as a result of renal failure or hyperchloremic acidosis; all of these factors act simultaneously in the increase of hydrogen protons and, consequently, the reduction of blood and respiratory pH levels [59][60][61][62]. Researchers suggest that the metabolic acidosis caused by lactic acid in COVID-19 is probably due to anaerobic glycolysis, which is favoured in consequence of hypoxemia. In this condition, pyruvate, a product of the glycolytic pathway, is not translocated to mitochondria to follow the oxidative process [63,64]; instead, it is converted into lactate in the cytosol by the LDH enzyme. As the hypoxemia impairs the tissue oxygenation and the oxidative phosphorylation, the cells obtain ATP by anaerobic glycolysis. This flow relies on the conversion of pyruvate to lactate which results in high levels of this metabolite that comes out of the cells. The excessive consumption of lactate during the process of gluconeogenesis culminates in lactic acidosis [65]. It has been reported that on the 18th day of COVID-19 disease, the levels of lactic acid begin to increase significantly, triggering metabolic acidosis, although the carbon dioxide pressure is acceptable [66].
In our study, patients positively diagnosed with COVID-19 (diagnostic model) and with severe disease (disease severity model) had high levels of carbon dioxide pressure (arterial and venous gas analysis), total carbon dioxide (arterial and venous gas analysis), arterial lactic acid and bicarbonate (arterial gas analysis), and exceptionally low venous pH (pH = 0.3), which also suggests respiratory and metabolic acidosis. These results are similar to other countries, indicating that these metabolic imbalances are prevalent in COVID-19 patients [64,67,68]. In general, all the available data show that most patients with severe disease have accompanying comorbidities, such as diabetes. Recent studies indicate that metabolic acidosis is influenced by the use of metformin for the treatment of diabetes mellitus [69,70].
The present analysis detected levels of five function biomarkers, including bilirubin, direct bilirubin, indirect bilirubin, alanine transaminase, and aspartate transaminase, increased in patients with positive (diagnostic model) and severe (severity model) disease compared to patients with non-severe disease. A systematic review and meta-analysis performed by Parohan (2020) revealed similar findings, where all 1,455 patients with severe disease had extremely high levels of total bilirubin (WMD 2.30 mmol/l; 95% CI, 1.24; 3.36; p < 0.001), alanine aminotransferase (WMD 7.35 U/L; 95% CI, 4.77; 9.93; p < 0.001) and aspartate aminotransferase (WMD 8.84 U/L; 95% CI 5.97; 11.71; p < 0.001), compared to 1,973 patients with non-severe disease [71]. Liver damage has also been reported in other viral pneumonia (e.g., MERS and SARS) and is directly associated with disease severity and mortality [72][73][74][75]. However, the biochemical/pathophysiological mechanisms that explain the liver dysfunction caused by COVID-19 are still unknown. It is unclear if the liver dysfunction is due to SARS-Cov-2 or is a consequence of multiple organ failure caused by the virus [71].
Additionally, high levels of the C-reactive protein (CRP) in the samples were found. An increase in this important biomarker in COVID-19 patients' was previously reported by Chen (2020) (up to 86%) [50]. Recently, a systematic review with meta-analysis concluded that extremely high levels of CRP were statistically associated with COVID-19 severity [77,78]. CRP is an inflammatory protein in the acute phase of inflammatory and infectious processes that is synthesised mainly in liver cells but also smooth muscle cells, macrophages, lymphocytes, and adipocytes. High levels of CRP (increasing up to 100 times) are commonly found during infections (plasma CRP levels increase around 1-500 μg/mL within 24-72 h) [76]. However, the role of CRP isoforms and their involvement in the progression of infectious diseases is still unknown [77,78].
Finally, in addition to the biochemical parameters already mentioned, low calcium levels were also detected in our analysis as a Table 4 Important biomarkers in machine learning models for the diagnosis and classification of COVID-19 severity.

Biomarkers
Diagnostic model Disease severity model

Less important variable (− ); Important variable (+); Critical variable (++).
A.F. Cobre et al. predictor for COVID-19 diagnosis and disease severity. Calcium is essential for a wide variety of processes in the body, ranging from normal muscle contraction to enzymatic activities [79]. It is known that alteration in Ca 2+ homeostasis can contribute to cell death by necrosis and apoptosis. Evidence shows that calcium metabolism disorders are associated with cardiovascular disease and early cell death [80,81]. Low calcium levels have already been associated with increased in-hospital mortality in patients with severe coronary artery disease [82], septic patients [79], bacterial pneumonia [83], and patients with dengue [84]. More recent studies have also associated hypocalcemia as an important predictor of hospitalisation and mortality risk by COVID-19 [67,[85][86][87]. Although the present study has shown consistent results, it has some limitations. Cross-sectional studies, with no follow-up analysis of patients' data, are prone to selection bias, information bias, and confounding bias. In addition, biomarkers' levels may change during the disease.

Conclusion
All the ML-based models (ANN, DT, PLS-DA, and KNN) were able to effectively predict COVID-19 diagnosis and disease severity with an accuracy above 84%, which is similar to the results obtained by RT-PCR and the minimum recommended threshold for diagnostic tests. The ANN was the model with the best performance (94% and 98%) and, thus, could be used as a supporting decision tool for healthcare professionals in practice. Hyperferritinaemia, hypocalcemia, hypoxemia, pulmonary hypoxia, respiratory acidosis, metabolic acidosis, low urinary pH, and high levels of lactate dehydrogenase were associated with COVID-19 diagnosis and disease severity. These biomarkers are potential therapeutic targets that should be more effectively investigated in further clinical trials.

Funding
This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.