Skip to content
Temporal-Comorbidity Adjusted Risk of Emergency Readmission
Jupyter Notebook Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Linux Debian Linux Fedora Mac OS Windows OS
CircleCI CircleCI CircleCI CircleCI

Version: 1.1 (2017.10.29)
Supported Python Version: 3.5
Supported TensorFlow Version: 1.4


Temporal-Comorbidity Adjusted Risk of Emergency Readmission (T-CARER) is a comorbidity risk index that incorporates temporal dimensions, operations and procedures groups, demographics, and admission details, as well as diagnoses groups. The features of the model are generated using the Healthcare Pre-Processing Framework, but it is partially integrated into the T-CARER development toolkit, in order to preserve the tool's generic structure. The T-CARER development toolkit is a generic, user-friendly and open-source software package that can be used for development of temporal comorbidity index independent of source of healthcare data.


Patients' comorbidities, operations and complications can be associated with reduced long-term survival probability and increased healthcare utilisation. The aim of this research [Ref !!!] was to produce an adjusted case-mix model of comorbidity risk and develop a user-friendly software tool to encourage public adaptation and incremental development.

In previous literature, there have been two streams of work on risk scoring comorbidities to estimate future resource utilisation, emergency admission and mortality. Firstly, one stream of research looks at the odds ratio of major diagnoses groups, like Charlson Comorbidity Index (CCI) which rely on twenty-two comorbidity groups. The second stream uses a case-mix model or a diagnoses classification approach based on similarities, type of care, likelihood or duration, like Elixhauser Comorbidity Index (ECI), Diagnosis-related Groups (DRG), which is developed by and John Hopkin's Adjusted Clinical Groups (ACG).

Temporal-Comorbidity Adjusted Risk of Emergency Readmission (T-CARER) is a generic development toolkit for designing temporal comorbidity risk index. The T-CARER model, which was proposed by Mesgarpour et al (2017) [Ref !!!], predicts hospital emergency admission within 30- and 365-day using a generic set of variables.


The proposed model in this study incorporates temporal dimensions, operations and procedures groups, demographics, and admission details, as well as diagnoses groups. The research resulted in the T-CARER model using routinely collected hospital inpatient data. The T-CARER model is published publicly as an interactive IPython Notebook, with generic inputs, features and population settings for general purpose use.

Moreover, several stages of analysis have been carried out to test and benchmark the T-CARER. Firstly, two data-frames across 10-year of HES inpatient records were selected (1999-2004 & 2004-2009). Afterwards, three different modelling approaches were developed: a Logistic Regression, a Random Forest, and a Wide and Deep Neural Network (WDNN). Then, the models were benchmarked against the HSCIC implementation of the Charlson Comorbidity Index (HSCIC-CCI), and the reported performance of CCI and ECI implementations.

The WDNN and the Random Forest methods outperform in terms of the Area Under the Curve (AUC) of Receiver-Operating Characteristic (ROC) against the Logistic Regression, as well as HSCIC-CCI, CCI and ECI models. For 30- and 365-day emergency admissions, ROCs of different modelling approaches were from 0.772% to 0.804% the two sampled time-frames.

The WDNN method produced predictions with high precision, and the Random Forest method outperformed in terms of micro-average of F1-score. The precisions were 0.582% to 0.639%, and the micro-average of F1-score was 0.730% to 0.790% for the best modelling methods across different sampled time-frames.

Getting Started

Firstly, there are two main IPython Notebooks that can be used to conduct your modelling:

  • Basic modelling algorithms including Random Forest and Logistic Regression can be applied using this Notebook:
  • The WDNN can be applied using the following Notebook (the input features can be constructed using the above Notebook):

Also, two additional scripts are provided to assisst you in further validation and visualisation of models:

The Notebooks include detailed guides about the T-CARER configurations, and it is highly recommended to adjust them based on your inputted features and hardware settings.

Moreover, a sample is provided for demonstration purpose.

Related Publications


Apache License, Version 2.0. Enjoy!


Original Author: Mohsen Mesgarpour, Health and Social Care Modelling Group (HSCMG), University of Westminster.

Most Recent Author: Mohsen Mesgarpour, Health and Social Care Modelling Group (HSCMG), University of Westminster.

You can’t perform that action at this time.