AIMS: Mortality risk after hospitalization for heart failure (HF) is high, especially in the first 90 days. This study aimed to construct a model automatically predicting 90 day post-discharge mortality using electronic health record (EHR) data 48 h after admission and artificial intelligence. METHODS: All HF-related admissions from 2015 to 2020 in a single hospital were included in the model training. Comprehensive EHR data were collected 48 h after admission. Natural language processing was applied to textual information. Deaths were identified from the French national database. After variable selection with least absolute shrinkage and selection operator, a logistic regression model was trained. Model performance [area under the receiver operating characteristic curve (AUC)] was tested in two independent cohorts of patients admitted to two hospitals between March and December 2021. RESULTS: The derivation cohort included 2257 admissions (248 deaths after hospitalization). The evaluation cohorts included 348 and 388 admissions (34 and 38 deaths, respectively). Forty-two independent variables were selected. The model performed well in the derivation cohort [AUC: 0.817
95% confidence interval (CI) (0.789-0.845)] and in both evaluation cohorts [AUC: 0.750
95% CI (0.672-0.829) and AUC: 0.723
95% CI (0.644-0.803]), with better performance than previous models in the literature. Calibration was good: 'low-risk' (predicted mortality ≤8%), 'intermediate-risk' (8-12.5%) and 'high-risk' (>
12.5%) patients had an observed 90 day mortality rate of 3.8%, 8.4% and 19.4%, respectively. CONCLUSIONS: The study proposed a robust model for the automatic prediction of 90 day mortality risk 48 h after hospitalization for decompensated HF. This could be used to identify high-risk patients for intensification of therapeutic management.