Development and validation of an electronic frailty index using routine electronic health records: an observational study of 49,226 elderly inpatients from a general hospital in China


 Background Frailty assessment based on routine electronic health records (EHR) may be a good alternative to time-consuming frailty scales. This study mainly aimed to develop and validate an electronic frailty index (eFI) using routine EHR for elderly inpatients and analyse the correlations between frailty and hospitalized events and costs.Methods Based on the cumulative deficit model, we created an eFI from routine EHR. In a prospective cohort, we validated the effectiveness of the eFI by consistency with the comprehensive geriatric assessment-frailty index (CGA-FI). Then, we analysed the correlations between frailty and hospitalized events by logistic regression and costs by generalized linear regression models.Results During the study period, 49,226 elderly inpatients from the EHR were included in the analysis. There were 42,821 (87.0%) patients with sufficient data to calculate an eFI. The cut-off value for the upper tertile of the eFI for these patients was 0.15. A strong correlation between the CGA-FI and eFI was shown in the validation cohort of 685 subjects (Pearson’s r = 0.716, P < 0.001). The sensitivity and specificity for an eFI ≥ 0.15 to identify frailty defined as a CGA-FI ≥ 0.25 were 64.8% and 88.7%, respectively. After adjusting for age, gender, and operation, an eFI ≥ 0.15 showed an independent association with long hospital stay (odds ratio [OR] = 2.889, P < 0.001) and death in hospital (OR = 19.97, P < 0.001) for elderly inpatients from all departments. Moreover, after adjusting for age, gender, and operation, eFI values (per 0.1) were positively associated with total costs (β = 0.453, P < 0.001), examination costs (β = 0.269, P < 0.001), treatment costs (β = 0.414, P < 0.001), nursing costs (β = 0.381, P < 0.001), pharmacy costs (β = 0.524, P < 0.001), and material costs (β = 0.578, P < 0.001) for elderly inpatients from all departments.Conclusions It is feasible to develop an effective eFI from routine EHR for elderly inpatients from a general hospital in China. Frailty is an independent risk factor for long hospital stay and death in hospital. As the degree of frailty increases, the hospitalized costs for elderly inpatients increase accordingly.

large challenges to make the translation from frailty research to clinical practice. The barriers include not only a lack of consensus among prevalent frailty measurements but also time and resource limitations in busy clinical environments. In fact, frailty assessments are applied for only a subset of patients, with most elderly patients in the hospital not having their frailty assessed at all [4].
To reduce the burden of frailty assessment on clinicians, Clegg and his colleagues developed an electronic frailty index (eFI) using routine electronic health records (EHR) in UK primary care and validated it by predicting mortality and admissions [9]. Based on Clegg's eFI, Pajewski and his colleagues modelled another adapted eFI with more information on nursing and laboratory assessments by using routine EHR data in the US, which showed an independent predictive value for mortality, hospitalizations, emergency department visits, and injurious falls [10]. Gilbert and his colleagues constructed a hospital frailty risk score using the International Statistical Classi cation of Diseases and Related Health Problems, Tenth Revision (ICD-10) coding system in the UK hospital database and con rmed that it can predict adverse outcomes for older people in acute care settings [11]. Meanwhile, these time-saving assessments of frailty based on EHR have shown good consistency with traditional assessment methods, such as the Fried phenotype and CGA-FI [11,12]. However, there has been no relevant frailty research based on EHR in China, so we do not know the feasibility of developing an effective eFI from routine EHR data in China.
At present, frailty research based on EHR is in an exploratory stage and mainly focuses on primary care settings. Moreover, there are only a few studies focusing on elderly patient outcomes in hospitals by EHR [13]. Due to limitations in data acquisition, there is currently no study using EHR to analyse the relationship between frailty and hospitalized costs. In previous cohort studies, the analysis of frailty and hospitalized costs were also inadequate [4]. Given the inherent selection bias of cohort studies, such as the exclusion of patients who refuse or cannot cooperate, the analysis of EHR data without selection bias in this aspect is worth exploring. Previous studies on frailty in inpatients have mainly focused on the population in a certain department or with a particular disease type, which cannot fully re ect conditions across all departments. Our previous research has found that the prevalence of frailty between medical and surgical departments was signi cantly different [8], but there has been no research that can show in detail the distribution and clinical signi cance of frailty in each department of a general hospital. At this time, the effective utilization of EHR big data is particularly important, which can provide valuable information for clinical management.
The objectives of this study are threefold: 1. establish an eFI using routine EHR data and validate its effectiveness to assess frailty in elderly inpatients; 2. describe the prevalence of frailty in elderly inpatients in different departments; and 3. analyse the relationship of frailty with hospitalized events and costs in elderly inpatients from a general hospital in China.

Study design
We conducted a cross-sectional study on frailty using six-year EHR of elderly hospitalized patients in a single general hospital (Beijing, China). We used a two-step approach to develop and validate an eFI based on the routine EHR database for elderly hospitalized patients. First, we followed published guidance on creating a FI using the cumulative de cit model to create an eFI from a routine EHR database, which involved diagnosis (ICD-10 codes), nursing assessment, and laboratory tests [14]. Second, in a validation cohort, we tested whether the eFI identi ed similar people as the CGA-FI. Then, we analysed the correlation between frailty and hospitalized events and costs by using the routine EHR database.

Population in the EHR
The patients included were at least 65 years of age in the routine EHR database from July 1, 2013 to September 30, 2019. There were 96,393 hospitalizations involving 51,824 elderly inpatients in the records. During the study period, 34,612 patients had only one hospitalization, while 17,212 patients had two or more hospitalizations in the records. To avoid duplication, we chose the last hospitalization for these patients with two or more hospitalizations in the records for analysis. Considering the meaninglessness of hospital stays that were extremely short (one day or less) and special issues regarding hospital stays that were extremely long, we excluded 5% of the patients, which included 2,006 (3.9%, 2006/51824) patients with hospital stay ≤ one day and 592 (1.1%, 592/51824) patients with hospital stay > 66 days. Therefore, 49,226 inpatients whose hospital stay ranged from two days to 66 days were eligible (Fig. 1).

Validation cohort
For the validation exercise, we used a linked dataset on a prospective cohort of inpatients who had been assessed with the research standard frailty measurement, the CGA-FI. These participants were enrolled from September 2018 to February 2019, covering ten departments (i.e., cardiology ward, respiratory ward, geriatric ward, neurology ward, rehabilitation ward, traditional Chinese medicine ward, general surgery ward, orthopaedics ward, urology ward, and cardiac surgery ward) in the same hospital. The crosssectional characteristics of the prospective cohort were analysed and described in detail in our previously published article [8]. Among the 1,000 elderly patients in the cohort study, 703 participants were matched in the EHR database of 49,226 cases by hospitalized ID and admission time. There were 18 participants who did not have su cient data to calculate the eFI. Finally, there were 685 elderly inpatients who had both the CGA-FI and eFI assessed. These data were used to test consistency between frailty identi ed by the eFI and the CGA-FI. The CGA-FI contained 48 variables, which included 16 items of chronic diseases, 14 items of activities of daily living (ADLs), 3 items of mood (depression, anxiety, loneliness), 1 item of cognition, 7 items of geriatric syndrome, 2 items of ability of activity, and 5 items of objective measurements (body mass index (BMI), calf circumference, peak ow, grip strength, 4-m walking speed). The CGA-FI was the result of the sum of all variables' scores divided by 48 [8]. The details are described in Appendix Table 1. For the CGA-FI, a threshold of 0.25 was used to indicate frailty because this has been proposed as a useful operational cut-off [15]. Composition of the electronic frailty index (eFI) from routine EHR As shown in Appendix Table 2, according to the core criteria of the Rockwood frailty index (associated with health status; prevalence increased with age; did not saturate too early; covered a range of systems) [14], we modelled our adapted eFI referring to the factors included in the eFI of Pajewski et al. [10]. Based on the features of our EHR database, we selected 45 variables to construct the eFI, which included 20 items related to the diagnosis of chronic diseases, 20 items related to nursing assessments, and 5 items related to routine laboratory tests. For the diagnosis of chronic diseases, we utilized ICD-10 codes from the rst page of the medical record. The diagnostic codes were semi-automatically entered by the residents before archiving the medical records, according to the discharge diagnosis of the patients. Therefore, the timeliness and accuracy of diagnosis identi ed by ICD-10 codes in EHR were reliable. The 20 items related to the diagnosis of chronic diseases covered a range of systems, included hypertension, heart failure, myocardial infarction, atrial brillation/atrial utter, peripheral arterial disease, venous thromboembolism, chronic lung disease, peptic ulcer, chronic kidney disease, diabetes, thyroid dysfunction, stroke, Parkinson's disease/parkinsonism, dementia, anxiety, depression, osteoporosis, arthritis, spondylosis/disc disorders, and malignancy. The ICD-10 codes for each diagnosis were determined by three clinicians after discussion and according to the global standard for diagnostic health information from the World Health Organization website (https://icd.who.int/browse10/2010/en#/). The detailed ICD-10 codes for each diagnosis are described in Appendix Table 3. Abbreviations: eFI, electronic frailty index; CI, con dence interval; OR, odds ratio; ICUs, intensive care units.
As one of three national centres of gerontology in China, our hospital has attached importance to the geriatric assessment of elderly inpatients. Therefore, in addition to the vital signs and other routine assessments, the admission nursing assessment for every elderly inpatient also contained an assessment of ADLs and some important aspects of geriatric syndrome since 2013. To construct the eFI, we selected 20 items from the nursing assessments on the day of admission, including the Barthel Index (containing 10 items of ADLs: feeding, bathing, grooming, dressing, bowels, bladder, toilet use, transfers, mobility) [16], visual impairment, hearing impairment, insomnia, consciousness statement, constipation, appetite, pressure ulcer, BMI, heart rate, and blood pressure. The detailed cut-off values are shown in Appendix Table 2.
Given the importance of laboratory tests for frailty assessment [17,18], we included 5 routine laboratory items for constructing the eFI. Based on our previous studies [8,19], we found that haemoglobin, albumin, sodium, and D-dimer were independently associated with frailty. Meanwhile, qualitative analysis of urine protein was widely tested and was useful to re ect renal function. Therefore, we selected these abovementioned 5 items from the routine laboratory tests. Usually, the blood and urine specimens were tested within 24 hours after admission for inpatients. If a patient had more than one result for the same item, we chose the rst result to construct the eFI. The detailed cut-off values are shown in Appendix  Table 2.
The eFI included a total of 45 factors and was calculated as the unweighted sum of the score for each factor, divided by the total number of nonmissing items. There were no missing values regarding the diagnosis (20 items in the eFI) for all inpatients. Moreover, we did not want an absence of the Barthel Index, which contained 10 ADL items and necessarily implied functional status. Therefore, these abovementioned 30 items in the eFI were guaranteed. We additionally excluded individuals who did not have at least 6 of the 10 items based on the nursing assessments (except Barthel Index) or at least 3 of the 5 items based on the laboratory measurements. Finally, we required ≥ 39 nonmissing items, which were consistent with recommendations for constructing the FI [14]. The missing data elements from the routine EHR in calculating the eFI are described in detail in Appendix Table 4. The upper tertile of the eFI scores (eFI ≥ 0.15) was de ned as the cut-off value to indicate frailty.

Statistical analysis
Descriptive statistics were compared between the groups using chi-square tests for categorical variables and t-tests (normally distributed) or Mann-Whitney U (non-normally distributed) for continuous variables.
Pearson's correlation coe cient was used to describe the association between the continuous versions of the eFI and the CGA-FI. Additionally, a receiver operating characteristic (ROC) curve was calculated to estimate the area under the curve (AUC) for the eFI in relation to frailty, which was de ned as CGA-FI ≥ 0.25. The higher the AUC value was, the better the discriminative ability, up to a maximum possible score of 1.0. The sensitivity and speci city of eFI ≥ 0.15 were analysed for identifying frailty in the validation cohort. We examined the association between frailty (eFI ≥ 0.15) and hospitalized events using multivariate logistic regression, adjusting for age, gender, and operation (any surgery or intervention treatment in this hospitalization

Sensitivity analysis
During the study period, 33.2% (17212/51824) of patients had two or more hospitalizations in the records from this single general hospital. To make it possible to observe the deaths in hospital, we chose the last hospitalization for these patients in the original analysis. However, this selection bias would lead to a certain increase in hospital mortality, which might have in uenced the results of the correlation between frailty and hospitalized events. Therefore, we performed sensitivity analysis using the rst hospitalization records instead of the last hospitalization records to assess the robustness of the eFI as an independent associated factor of hospitalized events and costs. Similarly, we also excluded 5% patients with

Demographic and clinical characteristics in all populations
During the study period, 49,226 elderly inpatients from the EHR database were included in the analysis ( Fig. 1). There were 50.5% males, and the average age was 74.8 ± 6.9 years old. According to the method of constructing the eFI, there were 42,821 (87.0%) patients with su cient data to calculate the eFI and 6,405 (13.0%) patients with insu cient data to calculate the eFI. The two groups had similar ages (74.8 ± 7.0 vs 75.1 ± 6.7 years) and proportions of males (50.5% vs 50.7%). However, the hospital days (9 [6,14] vs 4 [3,7] days for those with su cient and insu cient data, respectively; P < 0.001) and death in hospital (3.4% vs 0.7%, respectively; P < 0.001) were signi cantly different in these two groups. Moreover, the hospitalized costs in patients with insu cient data to calculate the eFI were signi cantly lower than those in the other group (all P values < 0.01). Detailed information on the entire population is shown in  Figure 2 shows the prevalence of frailty in different departments. Females showed a signi cantly higher proportion of frailty than males (36.4% vs 31.2%, respectively; P < 0.001). The differences in clinical characteristics by gender are shown in Appendix Table 6.

Correlation between the eFI and CGA-FI
In the validation cohort, there were 685 participants who had both the eFI and CGA-FI assessed. The average age was 74.6 ± 6.7 years old, and 48.0% were males. The prevalence of frailty de ned as a CGA-FI ≥ 0.25 was 31.5%. The median CGA-FI was 0.198, while the median eFI was 0.102. Detailed information on all subjects is shown in Appendix Table 7. Figure 3 shows a strong correlation between the CGA-FI and eFI (Pearson's r = 0.716, P < 0.001). The AUC of the ROC for the eFI to identify frailty in the subjects was 0.859. The sensitivity and speci city to identify frailty were 64.8% and 88.7%, respectively, for an eFI ≥ 0.15 (Fig. 4).

Difference between the frail group and non-frail group
We used 0.15 (tertile of eFI) as the cut-off value to indicate frailty in the 42,821 inpatients from the EHR database. Compared with the non-frail group, the frail group was signi cantly older (78.7 ± 7.1 vs 72.8 ± 6.0 years; P < 0.001) and had a lower percentage of males (46.6% vs 52.5%; P < 0.001). The departments and operations were clearly different between these two groups (both P < 0.001). The frail group had signi cantly longer hospital days (12 [8,18] vs 8 [5,13] days, P < 0.001) and a higher mortality rate in the hospital (9.3% vs 0.4%, P < 0.001) than the non-frail group. Meanwhile, the total hospitalized cost and each speci c cost for the frail group were all signi cantly higher than those for the non-frail group (all P values < 0.001) (  Table 3).
We used the generalized linear regression model to investigate the impact of eFI values (per 0.1) on hospitalized costs. After adjusting for age, gender, and operation, the eFI was positively associated with total costs (β = 0.453, P < 0.001), examination costs (β = 0.269, P < 0.001), treatment costs (β = 0.414, P < 0.001), nursing costs (β = 0.381, P < 0.001), pharmacy costs (β = 0.524, P < 0.001), and material costs (β = 0.578, P < 0.001) for all elderly inpatients. Subgroups of different departments showed similar correlations between the eFI and hospitalized costs (all P values < 0.01). However, the beta coe cients for eFI values (per 0.1) on all kinds of costs were obviously lower in the department of orthopaedics than in other subgroups, especially with material costs (β = 0.047 for the eFI in the department of orthopaedics; β for the eFI ranged from 0.397 to 0.557 among other subgroups) ( Table 4).

Sensitivity analysis
When using the rst hospitalization records instead of the last hospitalization records, the mortality in the hospital for all patients with su cient data to calculate the eFI was 1.4%, which was obviously lower than the 3.4% in the original data. There were 30.0% (12934/43116) of patients in the frail group, de ned by an eFI ≥ 0.15. All the trends between the frail group and the non-frail group were similar to those from the original analysis (Appendix Table 8). After the sensitivity analysis, eFI ≥ 0.15 remained an independent risk factor for long hospital stay and death in hospital (Appendix Table 9). Moreover, the eFI was still independently associated with all kinds of increased hospitalized costs (Appendix Table 10).

Discussion
To the best of our knowledge, this is the rst and most populated study on detecting frailty in elderly inpatients from routine EHR in China. Our study demonstrates that it is feasible to develop an effective eFI by routine EHR data for elderly inpatients from a general hospital in China, and the eFI was validated by agreement with the CGA-FI. Although the prevalence of frailty varied obviously among different departments, frailty was an independent risk factor for hospitalized events in each subgroup of different departments. As the degree of frailty increased, the hospitalized costs for elderly inpatients increased accordingly. However, the increases in total and special costs in the department of orthopaedics were obviously smaller than those in other subgroups, especially in terms of material costs.

Frailty assessment by routine electronic health records
In this study, we constructed an eFI to assess frailty in elderly inpatients by using routine EHR data in a general hospital. Our results showed a strong correlation between the eFI and CGA-FI, which was consistent with the ndings of Brundle C et al. in the UK [12] and Abbasi M et al. in Canada [21]. Other frailty assessment tools based on routine EHR data, such as the hospital frailty risk score [11] and care assessment need score [22], also showed good agreement with traditional frailty measurements. Previous studies have shown that eFI could predict mid-term adverse events in elderly patients [9,10]. Our study showed that the eFI was independently associated with long hospital stay and death in hospital. All of these studies provided robust support for the use of routine EHR to assess frailty as a feasible way to translate the concept of frailty from research to clinical practice.
Although the eFI opens a new direction to ll the gap between research and clinical application, several details should be considered in the process of practices based on our results.
First, the cut-off value of the eFI for identifying frailty should be rede ned according to the speci c situation, instead of taking an internationally accepted xed value such as 0.25 for the CGA-FI. Why do we make this point? Our study showed that the eFI was obviously lower than the CGA-FI despite both having a strong correlation. The median CGA-FI was 0.198, while the median eFI was only 0.102 in the validation cohort. Therefore, if we continued to use 0.25 as the cut-off value for the eFI, it will obviously underestimate the prevalence of the frail population. However, there was only one similar study that simultaneously compared the eFI and CGA-FI [21]. This study also showed that the eFI was relatively lower than the CGA-FI (eFI: mean = 0.30, max = 0.58, min = 0.08 vs. CGA-FI: mean = 0.35, max = 0.69, min = 0.10) for 85 participants in a Canadian primary care programme [21]. There were several possible reasons why our eFI values were obviously lower than those of the CGA-FI and another reported eFI [10,12]. Our eFI was based on routine EHR from a single hospitalization rather than a summary of medical records across multiple visits. In a single hospitalization, the residents usually only entered the diagnosis codes related to the current hospitalization and ignored some seemingly unimportant diagnoses, such as depression or anxiety, especially in surgical departments. Moreover, the nurses might not pay attention to the conditions related to frailty during the admission assessment, which might have led to the neglect of some positive manifestations. Given that the frailty prevalence was 35.1% by the CGA-FI in our previous survey for elderly inpatients [8], it was more reasonable to use the tertile of eFI values (0.15) as the cut-off value for identifying frailty. Perhaps each centre needs to de ne its own cut-off value for the eFI according to its own situation and research results in the future.
Second, the timeliness of constructing the eFI should be considered in clinical practice. Except for the diagnostic codes, the routine EHR data used to construct the eFI could be mainly collected within 24 hours after admission in our study. Compared with the coded discharge diagnosis, the uncoded admission diagnosis was relatively di cult to analyse. Therefore, we used the discharge diagnosis (ICD-10 codes) instead of the admission diagnosis. Using the current method of constructing the eFI, we can provide clinicians with the eFI of elderly inpatients on discharge, which can help them to follow-up and manage frail patients in a targeted manner. However, if the admission diagnosis is improved by coding in the future, we would be able to obtain the eFI within 24 hours after admission, which would help clinicians make clinical decisions for inpatients in a timely manner and predict the outcome of elderly inpatients in the hospital. In previous studies, the eFI was mainly developed in primary care settings [9,10,21], and only one study focused on hospital acute care settings [11]. Compared with relatively complete hospitalization records, the cleaning of primary medical data is more complicated. It is di cult to obtain all information from one setting at one visit. There often needs to be one or two years of medical records to construct an eFI, which leads to a time lag in the guidance of clinical practice.
Unfortunately, China currently does not have a complete national primary care information system, so it is di cult to conduct relevant research in China primary care settings.
Third, the eFI should re ect the variability in frail conditions. Frailty is a dynamic condition, and individuals can uctuate between states of severity of frailty [4]. In previous studies, researchers have rarely paid attention to this point when constructing an eFI [9]. This might also be due to the limitations of electronic medical data, which caused frailty assessment to rely too much on diagnostic codes [11]. Pajewski N et al. and Abbasi M et al. improved the composition of the eFI by adding some laboratory tests and functional abilities [10,21]. We also agree with this improvement. Therefore, we added a 20item set of nursing assessments and a 5-item set of laboratory tests to the factors of the eFI. A dynamic eFI during hospitalization can more effectively re ect the current condition of elderly inpatients, which would be more in line with clinical reality. It may be an evaluation indicator of clinical treatment to precisely guide clinical interventions.
The primary advantage of EHR data is its size, but the largest challenge of EHR-based studies is the presence of missing data [23]. Our study showed that 13.0% of patients had insu cient data to calculate the eFI, while Pajewski's study reported 29.6% [10]. Other studies did not report the detailed condition of patients without su cient data to calculate an eFI. We found that these 13% of patients had a signi cantly lower proportion of adverse events, which was consistent with the results of Pajewski's study [10]. Our study showed that the department of ophthalmology contributed the majority of patients with insu cient data to calculate an eFI (54.5%, 3491/6405), while the prevalence of frailty was only 5.07% in the department of ophthalmology. These results indicate that patients with insu cient data had a lower percentage of frailty. Therefore, the eFI can be applied to the vast majority of patients with a need for frailty assessment. Meanwhile, we should consider the tolerance for missing data when we select the factors for constructing an eFI.

Prevalence of frailty in elderly inpatients among different departments
We found that there were signi cant differences in the prevalence of frailty assessed by the eFI among the different departments. Generally, emergency departments and ICUs had the highest percentage of frailty (average: 82.8%), followed by internal medicine departments (average: 34.1%) and surgical departments (average: 27.1%). This trend was consistent with the results of a recent multicentre survey on frailty in inpatients in China [24]. The prevalence of frailty in all 9,996 inpatients was 18.02% by the FRAIL scale in this multicentre survey, which was close to the prevalence of frailty by the FRAIL scale in our previous study (19.2%) [8,24]. However, our previous results showed that the FRAIL scale obviously underestimated the prevalence of frailty because it had the lowest sensitivity (63.0%) among ve common frailty measurements [8]. Regardless of what measurements were used, the prevalence of frailty in elderly hospitalized patients was relatively higher than that in community-dwelling older people, whose pooled prevalence of frailty was 10% [25].
In this study, we found that the prevalence of frailty in the department of orthopaedics (59.5%) was signi cantly higher than that in other surgical departments and most internal medicine departments. This was mainly because the conditions for most orthopaedic patients were braked by osteoarthritis or fractures, especially hip fractures. The ADL assessments for these inpatients in this state could not re ect their daily conditions. Therefore, we should keep this point in mind when we use the eFI to guide clinical practice for inpatients in departments of orthopaedics. In the department of cardiology, we found a phenomenon in which the prevalence of frailty was obviously lower than that in most internal medicine departments. This result was consistent with results in our previous cohort study [8]. The current treatment and management models of cardiology are close to surgical departments. Therefore, the lower prevalence of frailty in the cardiac ward is easy to understand. However, we were surprised to nd that the prevalence of frailty in the gastroenterology ward (17.7%) was the lowest among all internal medicine departments. This might have been caused by several reasons. First, there are many endoscopic operations that lead to the development of gastroenterology near surgical departments. Second, there is a certain degree of selection bias for patients admitted in a single hospital. For hospitals that do not overly rely on endoscopic operations, the prevalence of frailty may be closer to the average or lower level among internal medical departments.
In short, due to the differences in disease characteristics and treatment models, the prevalence of frailty varied signi cantly among different departments. For the rst time, we fully demonstrated the prevalence of frailty in a single general hospital. Although these data cannot represent the conditions of all hospitals, it may provide some objective evidence for the hospital management of frailty.

Association between frailty and hospitalized costs
For the rst time in China, our ndings suggested that the level of frailty was independently associated with increased hospitalized costs for elderly inpatients from all departments. In previous studies, some evidence has also suggested that frailty was associated with increased health-care costs, mainly by Medicare claims data or self-report data from community-dwelling older adults [26][27][28][29]. Moreover, a recent study also indicated that frailty was an independent determinant of increased health-care expenditure for community-dwelling older adults in China [30]. Several small-sample studies have shown that frailty was associated with increased hospitalized costs for patients with colorectal surgery [31], cardiac surgery [32], or transcatheter aortic value implantation [33]. Another study showed that there was no difference in hospitalized costs between frail and non-frail groups in elderly patients with elective noncardiac surgeries from China [34]. These inconsistencies might have been due to the small sample size, but there might be other reasons. Material costs were a large part of the total hospitalized cost, especially for patients with surgeries. However, the cost of medical consumable materials in China depends not only on the patient's condition but also on the patient's own choice. For example, patients with low income or without medical insurance might be more likely to choose the less expensive of similar products. This phenomenon is most obvious in orthopaedic consumables because their price varies greatly and is relatively expensive in China. This may be one of reasons why the increases in hospitalized costs in the department of orthopaedics were obviously smaller than those in other subgroups, especially in terms of material costs. Meanwhile, the frailty assessment was in uenced by patient braking, which may have led to an overestimation of the degree of frailty in some patients in the department of orthopaedics.
Overall, considering that in-hospital exercise interventions on frailty have been effective for elderly inpatients to reverse the degree of frailty [35], timely recognition of frailty is important to guide interventions on frailty and even reduce hospitalized costs to some degree for elderly inpatients.

Limitations
There are two main limitations in this study. First, this was a cross-sectional study. We could not verify the long-term predictive value of the eFI for adverse events in the elderly inpatients because it is di cult to link our hospital EHR with national resident death records or EHR from other hospitals. Second, despite its relatively large size, the EHR data in this study were from a single general hospital, which may not represent all hospitals in China. Multicentre studies with follow-up data are warranted in the future.

Conclusion
In summary, it is feasible to develop an effective eFI using routine EHR data for elderly inpatients from a general hospital in China. With good agreement with the CGA-FI, the eFI can be a useful and convenient tool to clinicians for detecting frailty in elderly inpatients. The prevalence of frailty varied obviously among different departments, but frailty was an independent risk factor for long hospital stay and death in hospital. As the degree of frailty increased, the hospitalized costs for elderly inpatients increased accordingly.

Future Perspectives
Since the condition of frailty is independently associated with hospitalized events and increased hospitalized costs, the assessment of frailty is important for the clinical decision-making of elderly inpatients. Arti cial intelligence (AI) is now widely used in various elds. The application of AI in medicine has two main branches: virtual and physical [36]. Included in the virtual applications of AI are EHR where speci c algorithms can be used to automatically or semi-automatically identify frailty in elderly inpatients. In the future, with the optimization of EHR systems and improvements in the understanding of frailty, clinicians can monitor the dynamic conditions of frailty in elderly inpatients from admission to discharge by eFIs using EHR, which may precisely and conveniently guide clinical practice. Of course, the effectiveness of related interventions based on the eFI for elderly inpatients, such as multidisciplinary management, avoidance of harmful therapy, and enhancement of follow-up, needs to be further veri ed in the future.    Correlation between the eFI and CGA-FI. Abbreviations: eFI, electronic frailty index; CGA-FI, comprehensive geriatric assessment -frailty index.