## 2 Materials and Methods
### Data Collection and Preprocessing  
Our study leveraged the Medical Intensive Care Information Mart (MIMIC-III) repository, renowned for its extensive clinical data on patients admitted to Beth Israel Deaconess Medical Center in Boston, Massachusetts. MIMIC-III serves as the primary repository of de-identified public materials for research purposes [23]. This comprehensive dataset encompasses various clinical parameters such as laboratory test results, demographic attributes, microbiology findings, hemodynamic parameters, treatment regimens, fluid balance, and other pertinent data. The wealth of clinical information embedded in MIMIC-III renders it an invaluable resource for medical research. Data were extracted from MIMIC-III data using SQL queries. The database contains information regarding ICU admission, medications, vitals, duration of stay, ICD-9-CM, and laboratory reports. The patients with the ICD-9-CM diagnosis code for diabetes mellitus (diabetes type 1 and 2, secondary and gestational type 2 diabetes) were admitted to the ICU. In this study, we utilized MIMIC-III to analyze data from 46,520 patient records and 58,976 admission records, including vital signs, medications, laboratory measurements, and observation records. The average age of adults in this dataset was 66 years, the average ICU length of stay was 4.4 days, and the mortality rate was 8.9%. Ethical approval to access the MIMIC-III database was obtained by completing the National Institutes of Health (NIH) online course, passing the Human Research Participant Protection Examination, and submitting an access request (certificate number: 35628530), thus ensuring that appropriate safeguards were in place for all data used in this study. To ensure the comparability of our results with previous relevant studies, we adhered to identical patient selection criteria, avoiding analyses based on specific diseases. Instead, we integrated data from all patients, thereby enhancing the generalizability of our findings. This methodology enables us to contribute to the existing literature on predicting ICU mortality and readmission rates while maintaining consistency with prior research [24; 25]. The objectives of this study were twofold: first, to predict patient mortality at 3, 30, and 365 days post discharge, and second, to predict ICU readmission within 30 days of discharge. A patient cohort was selected based on the following exclusion criteria: initially, the first ICU stay without all subsequent ICU stays; adult patients (age \(\geq 16\)); and type 2 diabetes patients. Figure 1: The detailed process of data extraction. The study utilized vital sign data obtained during the 24 h prior to patient discharge, which included, as follows: heart rate (X1); respiratory rate (X2); diastolic blood pressure (X3); systolic blood pressure (X4); temperature (X5); glycosylated hemoglobin (X6); random blood glucose (X7); creatinine (X8); non-invasive blood pressure mean (X9); glucose (X10); white blood cell count (X11); RBC (red blood cell)(X12); sodium level (X13); and serum bicarbonate level (X14). Additionally, the following basic demographic variables were considered: age (X15); ICU length of stay (X16); hospital length of stay (X17); gender (X18); marital status (X19); ethnicity (X20); insurance type (X21); and last ICU type (X22). In total, 22 structural predictors were used in this study. Appendix A shows the selected variables. Accurately resolving missing values is critical in research, and this study highlights the complexity of handling missing data during preprocessing. This challenge, while reflective of real-world conditions, poses a significant obstacle to the development of mortality and readmission prediction models. To manage missing data, we excluded patients with more than 30% missing values [26]. Our study addresses this challenge using data preprocessing techniques. In our study, we used specific selection criteria to identify ICU mortality and readmissions [4; 27; 28; 29].