LifeTwin Statistical Models

This table offers an overview of various health models included in LifeTwin with their specific caracteristics. Models are primarily distinguished result type, and the application of the Cox Survival Model. For instance, the ‘Framingham’ model, implemented using R, is based on regression. Similarly, the ‘Prostate’ model utilizes a binary tree approach. Notably, both of these models account for age as a factor.

Model

Age dependent

Cox Model

Language

Model Type

Framingham

Yes

Yes

R

Regression

LifeCRC

Yes

Yes

Python

Regression

Gail

Yes

No

Python

Regression

Score

Yes

Yes

Python

Regression

Qrisk

Yes

Yes

Python

Regression

CovidSurvival

No

No

Python

CART

PIM

No

No

Python

Regression

Prostate

Yes

No

Python

CART

CLivD

Yes

Yes

Python

Regression

Subpackages

Module contents

This file dynamically imports classes from submodules that inherit from BioModel. It uses pkgutil and importlib to achieve this.

class biomodel.models.CLivD

Bases: CustomModel

Predict the risk score for developing a certain condition based on the input parameters such as age, sex, alcohol intake, diabetes status, waist-hip ratio, GGT (Gamma-glutamyl transferase), and smoking status. The function limits the alcohol and GGT values based on certain conditions, calculates the risk score using a predefined model, and then maps the score to a risk category (Minimal, Low, Intermediate, or High) based on predefined thresholds. The risk score is returned as a float value.

interpretation = 'percentage'
intervals = [RiskInterval(value=0.0, name='Minimal risk'), RiskInterval(value=0.5, name='Low risk'), RiskInterval(value=4, name='Intermediate risk'), RiskInterval(value=10, name='High risk')]
name = 'CLivD'
predict(age: AgeInt(id='age', minimum=20, maximum=100, name='Age'), sex: Enum(id='sex', values={1: 'Male', 2: 'Female'}, name='Sex'), alcohol: Float(id=35810226, minimum=0, maximum=50, name='Alcohol intake (drinks/week)'), diabetes: BoolInt(id=35817874, true=1, false=0, name='Has diabetes?'), whr: Float(id=4087501, minimum=0.6, maximum=1.4, name='Waist-hip ratio'), ggt: Float(id=4210715, minimum=0, maximum=200, name='Gamma-glutamyl transferase (U/L)'), smoking: BoolInt(id=1585856, true=1, false=0, name='Is smoker?')) float

Predict the risk score for developing a certain condition based on the input parameters such as age, sex, alcohol intake, diabetes status, waist-hip ratio, GGT (Gamma-glutamyl transferase), and smoking status. The function limits the alcohol and GGT values based on certain conditions, calculates the risk score using a predefined model, and then maps the score to a risk category (Minimal, Low, Intermediate, or High) based on predefined thresholds. The risk score is returned as a float value.

title = 'Percentage of developing liver disease in the next 15 years'
class biomodel.models.CLivDPoints

Bases: CustomModel

Custom model to predict the percentage of developing liver disease in the next 15 years based on input parameters using linear scaling.

Args:

age (int): The age of the individual (between 20 and 100). sex (int): The gender of the individual (1 for male, 2 for female). alcohol (float): The alcohol intake per week (in drinks, between 0 and 50). diabetes (bool): Indicates if the individual has diabetes (True for yes, False for no). whr (float): The waist-hip ratio of the individual (between 0.6 and 1.4). ggt (float): The gamma-glutamyl transferase level (in U/L, between 0 and 200). smoking (bool): Indicates if the individual is a smoker (True for yes, False for no).

Returns:

float: The predicted risk score based on the input parameters.

interpretation = 'percentage'
intervals = [RiskInterval(value=0.0, name='Minimal risk'), RiskInterval(value=0.5, name='Low risk'), RiskInterval(value=4, name='Intermediate risk'), RiskInterval(value=10, name='High risk')]
name = 'CLivD'
predict(age: AgeInt(id='age', minimum=20, maximum=100, name='Age'), sex: Enum(id='sex', values={1: 'Male', 2: 'Female'}, name='Sex'), alcohol: Float(id=35810226, minimum=0, maximum=50, name='Alcohol intake (drinks/week)'), diabetes: BoolInt(id=35817874, true=1, false=0, name='Has diabetes?'), whr: Float(id=4087501, minimum=0.6, maximum=1.4, name='Waist-hip ratio'), ggt: Float(id=4210715, minimum=0, maximum=200, name='Gamma-glutamyl transferase (U/L)'), smoking: BoolInt(id=1585856, true=1, false=0, name='Is smoker?')) float

Predict the risk score based on the input parameters using linear scaling.

Args:

age (int): The age of the individual (between 20 and 100). sex (int): The gender of the individual (1 for male, 2 for female). alcohol (float): The alcohol intake per week (in drinks, between 0 and 50). diabetes (bool): Indicates if the individual has diabetes (True for yes, False for no). whr (float): The waist-hip ratio of the individual (between 0.6 and 1.4). ggt (float): The gamma-glutamyl transferase level (in U/L, between 0 and 200). smoking (bool): Indicates if the individual is a smoker (True for yes, False for no).

Returns:

float: The predicted risk score based on the input parameters.

title = 'Percentage of developing liver disease in the next 15 years'
class biomodel.models.Covid

Bases: CustomModel

Predict the outcome based on the decision tree.

Parameters: - ldh: Lactic dehydrogenase value. - hs_crp: High-sensitivity C-reactive protein value. - lymphocyte: Lymphocyte percentage.

Returns: - ‘Survival’ or ‘Death’ based on the decision tree.

predict(ldh: Float(id=4150493, minimum=0, maximum=1000, name='Lactic dehydrogenase value'), hs_crp: Float(id=4208414, minimum=0, maximum=1000, name='High-sensitivity C-reactive protein value'), lymphocyte: Float(id=37399254, minimum=0, maximum=100, name='Lymphocyte percentage')) str

Predict the outcome based on the decision tree.

Parameters: - ldh: Lactic dehydrogenase value. - hs_crp: High-sensitivity C-reactive protein value. - lymphocyte: Lymphocyte percentage.

Returns: - ‘Survival’ or ‘Death’ based on the decision tree.

class biomodel.models.Framingham

Bases: RFunction

Represents a class for calculating the probability of having a cardiovascular event in the next 10 years using the Framingham risk function.

Attributes:

function_name (str): The name of the function. file_path (str): The file path for the function. interpretation (str): The interpretation of the function. title (str): The title of the probability calculation. intervals (list): A list of RiskInterval objects representing the risk intervals. parameters (dict): A dictionary of parameters required for the calculation, including sex, age, coltot, hdl, tas, tad, smoke, and diab.

file_path = 'fr.r'
function_name = 'calculadora.risc'
interpretation = 'probability'
intervals = [RiskInterval(value=0.0, name='Low risk'), RiskInterval(value=0.1, name='Medium risk'), RiskInterval(value=0.2, name='High risk')]
parameters = {'age': AgeInt(id='age', minimum=35, maximum=70, name='Age'), 'coltot': Float(id=4224820, minimum=100, maximum=400, name='Colesterol'), 'diab': BoolInt(id=35817874, true=1, false=0, name='Has diabetes?'), 'hdl': Float(id=4011133, minimum=10, maximum=100, name='HDL'), 'sex': Enum(id='sex', values={1: 'Male', 2: 'Female'}, name='Sex'), 'smoke': BoolInt(id=1585856, true=1, false=0, name='Is smoker?'), 'tad': Float(id=4154790, minimum=50, maximum=150, name='TAD'), 'tas': Float(id=4152194, minimum=50, maximum=250, name='TAS')}
title = 'Probability of having a cardiovascular event in the next 10 years'
class biomodel.models.FraminghamGenetics

Bases: RFunction

A class to calculate the probability of having a cardiovascular event in the next 10 years based on Framingham genetics. It provides a wrapper for the calculation function and defines the parameters and intervals for risk assessment.

file_path = 'calculadora.risc.gen.r'
function_name = 'wrapper_calculadora.risc.gen'
interpretation = 'probability'
intervals = [RiskInterval(value=0.0, name='Low risk'), RiskInterval(value=0.1, name='Medium risk'), RiskInterval(value=0.2, name='High risk')]
parameters = {'age': AgeInt(id='age', minimum=35, maximum=70, name='Age'), 'coltot': Float(id=4224820, minimum=100, maximum=400, name='Colesterol'), 'diab': BoolInt(id=35817874, true=1, false=0, name='Has diabetes?'), 'hdl': Float(id=4011133, minimum=10, maximum=100, name='HDL'), 'rs12526453': Int(id=9999999, minimum=0, maximum=2, name='rs12526453'), 'rs1333049': Int(id=9999998, minimum=0, maximum=2, name='rs1333049'), 'rs1474787': Int(id=9999997, minimum=0, maximum=2, name='rs1474787'), 'rs1515098': Int(id=9999996, minimum=0, maximum=2, name='rs1515098'), 'rs17465637': Int(id=9999995, minimum=0, maximum=2, name='rs17465637'), 'rs3184504': Int(id=9999994, minimum=0, maximum=2, name='rs3184504'), 'rs501120': Int(id=9999993, minimum=0, maximum=2, name='rs501120'), 'rs6725887': Int(id=9999992, minimum=0, maximum=2, name='rs6725887'), 'rs9818870': Int(id=9999991, minimum=0, maximum=2, name='rs9818870'), 'rs9982601': Int(id=9999990, minimum=0, maximum=2, name='rs9982601'), 'sex': Enum(id='sex', values={1: 'Male', 2: 'Female'}, name='Sex'), 'smoke': BoolInt(id=1585856, true=1, false=0, name='Is smoker?'), 'tad': Float(id=4154790, minimum=50, maximum=150, name='TAD'), 'tas': Float(id=4152194, minimum=50, maximum=250, name='TAS')}
title = 'Probability of having a cardiovascular event in the next 10 years'
class biomodel.models.Gail

Bases: CustomModel

Predicts the risk of breast cancer based on various factors such as age, age at menarche, number of biopsies, age at first live birth, number of relatives, and whether the individual has given birth. The function applies specific risk values based on the input factors and calculates the overall relative risk for breast cancer.

interpretation = 'percentage'
intervals = [RiskInterval(value=5, name='Elevated')]
predict(age: AgeInt(id='age', minimum=20, maximum=80, name='Age'), agemen: Int(id=4162552, minimum=0, maximum=30, name='Age at menarche'), nbiops: Enum(id=4078191, values={0: '0', 1: '1', 2: '>1'}, name='Number of previous breast biopsies'), ageflb: Int(id=35810315, minimum=0, maximum=100, name='Age at first live birth'), numrel: Enum(id='first-degree-relatives-breast-cancer', values={0: '0', 1: '1', 2: '>1'}, name='Number of first-degree relatives with breast cancer'), given_birth: Bool(id=35810313, name='Has given birth?')) float

Predicts the risk of breast cancer based on various factors such as age, age at menarche, number of biopsies, age at first live birth, number of relatives, and whether the individual has given birth. The function applies specific risk values based on the input factors and calculates the overall relative risk for breast cancer.

predict_over_time = False
title = 'Percentage (%) of developing breast cancer in the next 5 years'
class biomodel.models.LifeCRC

Bases: CustomModel

A class to predict the absolute risk of developing colorectal cancer within the next 10 years based on various input parameters such as age, waist circumference, height, alcohol consumption, smoking habit, physical activity, and dietary intake.

interpretation = 'probability'
intervals = [RiskInterval(value=0.0, name='Low risk'), RiskInterval(value=0.1, name='Medium risk'), RiskInterval(value=0.2, name='High risk')]
predict(age: AgeInt(id='age', minimum=20, maximum=100, name='Age'), waist: Float(id=4172830, minimum=0, maximum=200, name='Waist circumference in cm'), height: Float(id=607590, minimum=0, maximum=1000, name='Height in cm'), alcohol: Bool(id=4027639, name='Daily alcohol'), smoking: Bool(id=1585856, name='Smoking'), physical: Bool(id=4038719, name='Physically active'), vegetable: Float(id=4025582, minimum=0, maximum=1000, name='Vegetable intake per 100g/day'), dairy: Float(id=4022880, minimum=0, maximum=1000, name='Dairy products intake per 100g/day'), processed: Float(id=4028164, minimum=0, maximum=1000, name='Processed meat intake per 50g/day'), sugar: Float(id=4023854, minimum=0, maximum=1000, name='Sugar and confectionary intake per 50g/day')) float

Predicts the absolute risk of colorectal cancer within 10 years based on the input parameters.

Args:

age (int): Age of the individual in years (minimum=20, maximum=100) waist (float): Waist circumference in cm (minimum=0, maximum=200) height (float): Height in cm (minimum=0, maximum=1000) alcohol (bool): Daily alcohol consumption (True for yes, False for no) smoking (bool): Smoking habit (True for yes, False for no) physical (bool): Physically active or not (True for yes, False for no) vegetable (float): Vegetable intake per 100g/day (minimum=0, maximum=1000) dairy (float): Dairy products intake per 100g/day (minimum=0, maximum=1000) processed (float): Processed meat intake per 50g/day (minimum=0, maximum=1000) sugar (float): Sugar and confectionary intake per 50g/day (minimum=0, maximum=1000)

Returns:

float: The absolute risk of colorectal cancer within 10 years.

title = 'Probability of developing colorectal cancer in the next 10 years'
class biomodel.models.PIMModel

Bases: CustomModel

A model to predict the probability of death in paediatric intensive care in the next 10 days based on the provided parameters.

Args:

pupils_fixed (bool): Pupils fixed to light. specified_diagnosis (bool): Specified diagnosis. elective (bool): Elective admission. mechanical_ventilation (bool): Mechanical ventilation immediately after admission. SBP (float): Systolic Blood Pressure in mmHg (Range: 0-200). base_excess (float): Base Excess in mmol/l (Range: -100-100). FIO2 (float): Fractional Inspired Oxygen Concentration (Range: 0-1). PaO2 (float): Arterial Oxygen Tension in mmHg (Range: 0.1-200).

Returns:

float: Predicted probability of death.

interpretation = 'probability'
name = 'PIM: Paediatric Index of Mortality'
predict(pupils_fixed: Bool(id=311111, name='Pupils fixed to light'), specified_diagnosis: Bool(id=4234469, name='Specified diagnosis'), elective: Bool(id=311113, name='Elective admission'), mechanical_ventilation: Bool(id=4232891, name='Mechanical ventilation immediately after admission'), SBP: Float(id=4152194, minimum=0, maximum=200, name='Systolic Blood Pressure in mmHg'), base_excess: Float(id=4297217, minimum=-100, maximum=100, name='Base Excess in mmol/l'), FIO2: Float(id=4030916, minimum=0, maximum=1, name='Fractional Inspired Oxygen Concentration'), PaO2: Float(id=37392673, minimum=0.1, maximum=200, name='Arterial Oxygen Tension in mmHg')) float

Calculate the predicted probability of death based on the provided parameters.

Parameters are as described in the function arguments.

Returns: - Predicted probability of death.

title = 'Probability of death in paediatric intensive care in the next 10 days'
class biomodel.models.Prostate

Bases: CustomModel

Predicts the risk of prostate cancer based on input parameters such as PSA, presence of TRUS hypoechoic lesion, age, and prostate volume. Returns the risk level as ‘High Risk’ or ‘Low Risk’.

name = 'Prostate Garzotto et. al.'
predict(PSA: Float(id=4272032, minimum=0, maximum=10, name='Prostate Specific Antigen (ng/mL)'), TRUS_lesion: Bool(id=36684854, name='Presence of TRUS hypoechoic lesion'), age: AgeInt(id='age', minimum=20, maximum=100, name='Age'), prostate_volume: Float(id=4096978, minimum=1, maximum=200, name='Prostate Volume (mL)')) str

Predicts the risk of prostate cancer based on input parameters such as PSA, presence of TRUS hypoechoic lesion, age, and prostate volume. Returns the risk level as ‘High Risk’ or ‘Low Risk’.

title = 'Prostate Cancer Risk Calculator'
class biomodel.models.QRisk

Bases: CustomModel

Predicts the absolute risk of cardiovascular disease based on various health and lifestyle parameters.

Args:

age (int): Age of the individual (between 20 and 100). sex (int): Gender of the individual. b_AF (bool): Atrial fibrillation status. b_atypicalantipsy (bool): On atypical antipsychotic medication status. b_corticosteroids (bool): Regular steroid tablets usage status. b_impotence2 (bool): Diagnosis or treatment for erectile dysfunction status. b_migraine (bool): Migraine status. b_ra (bool): Rheumatoid arthritis status. b_renal (bool): Chronic kidney disease (stage 3, 4 or 5) status. b_semi (bool): Severe mental illness status. b_sle (bool): Systemic lupus erythematosus (SLE) status. b_treatedhyp (bool): Blood pressure treatment status. diabetes_cat (int): Diabetes status category. bmi (float): Body Mass Index (kg/m^2) of the individual (between 15 and 50). ethrisk (int): Ethnicity risk category. fh_cvd (bool): Angina or heart attack in a 1st degree relative < 60 status. rati (float): Total cholesterol/HDL cholesterol ratio. sbp (float): Systolic BP (mmHg). sbps5 (float): SD of the last two systolic BP readings (mmHg). smoke_cat (int): Smoking status category.

Returns:

float: Absolute risk of cardiovascular disease.

interpretation = 'probability'
intervals = [RiskInterval(value=0.0, name='Low risk'), RiskInterval(value=0.1, name='High risk')]
name = 'QRISK'
predict(age: AgeInt(id='age', minimum=20, maximum=100, name='Age'), sex: Enum(id='sex', values={1: 'Male', 2: 'Female'}, name='Sex'), b_AF: Bool(id=313217, name='Atrial fibrillation?'), b_atypicalantipsy: Bool(id='atypical-antipsychotic-medication', name='On atypical antipsychotic medication?'), b_corticosteroids: Bool(id='steroid-tablets', name='Are you on regular steroid tablets?'), b_impotence2: Bool(id=3655355, name='A diagnosis or treatment for erectile disfunction?'), b_migraine: Bool(id=318736, name='Do you have migraines?'), b_ra: Bool(id=80809, name='Rheumatoid arthritis?'), b_renal: Bool(id=46271022, name='Chronic kidney disease (stage 3, 4 or 5)?'), b_semi: Bool(id=4192296, name='Severe mental illness?'), b_sle: Bool(id=257628, name='Systemic lupus erythematosus (SLE)?'), b_treatedhyp: Bool(id=4063253, name='On BP treatment?'), diabetes_cat: Enum(id=4236883, values={0: 'none', 1: 'type 1', 2: 'type 2'}, name='Diabetes status'), bmi: Float(id=4245997, minimum=15, maximum=50, name='Body Mass Index (kg/m^2)'), ethrisk: Enum(id=44803968, values={1: 'White or not stated', 2: 'Indian', 3: 'Pakistani', 4: 'Bangladeshi', 5: 'Other Asian', 6: 'Black Caribbean', 7: 'Black African', 8: 'Chinese', 9: 'Other ethnic group'}, name='Ethnicity'), fh_cvd: Bool(id='angina-ha-fdeg-rel-60', name='Angina or heart attack in a 1st degree relative < 60?'), rati: Float(id=4195214, minimum=1, maximum=10, name='Total cholesterol/HDL cholesterol ratio'), sbp: Float(id=4152194, minimum=80, maximum=250, name='Systolic BP (mmHg)'), sbps5: Float(id=4297217, minimum=0, maximum=40, name='SD of the last two systolic BP readings (mmHg)'), smoke_cat: Enum(id='smoke-cat', values={0: 'non-smoker', 1: 'ex-smoker', 2: 'light smoker (less than 10)', 3: 'moderate smoker (10 to 19)', 4: 'heavy smoker (20 or over)'}, name='Smoking status')) float

Predicts the absolute risk of cardiovascular disease based on various health and lifestyle parameters.

Args:

age (int): Age of the individual (between 20 and 100). sex (int): Gender of the individual. b_AF (bool): Atrial fibrillation status. b_atypicalantipsy (bool): On atypical antipsychotic medication status. b_corticosteroids (bool): Regular steroid tablets usage status. b_impotence2 (bool): Diagnosis or treatment for erectile dysfunction status. b_migraine (bool): Migraine status. b_ra (bool): Rheumatoid arthritis status. b_renal (bool): Chronic kidney disease (stage 3, 4 or 5) status. b_semi (bool): Severe mental illness status. b_sle (bool): Systemic lupus erythematosus (SLE) status. b_treatedhyp (bool): Blood pressure treatment status. diabetes_cat (int): Diabetes status category. bmi (float): Body Mass Index (kg/m^2) of the individual (between 15 and 50). ethrisk (int): Ethnicity risk category. fh_cvd (bool): Angina or heart attack in a 1st degree relative < 60 status. rati (float): Total cholesterol/HDL cholesterol ratio. sbp (float): Systolic BP (mmHg). sbps5 (float): SD of the last two systolic BP readings (mmHg). smoke_cat (int): Smoking status category.

Returns:

float: Absolute risk of cardiovascular disease.

title = 'Probability of developing cardiovascular disease in the next 10 years'
class biomodel.models.ScoreModel

Bases: CustomModel

Predicts the absolute risk of cardiovascular disease based on the input parameters.

Args:

age (int): Age of the individual (between 20 and 100). sex (int): Gender of the individual (1 for Men, 0 for Women). cholesterol (float): Cholesterol level in mmol/L (between 2 and 10). sbp (float): Systolic blood pressure in mmHg (between 80 and 250). smoker_status (int): Smoker status score. country (str): Country of the individual.

Returns:

float: Absolute risk of cardiovascular disease.

interpretation = 'probability'
intervals = [RiskInterval(value=0.01, name='Very Low risk'), RiskInterval(value=0.02, name='Low risk'), RiskInterval(value=0.035, name='Medium risk'), RiskInterval(value=0.05, name='High risk'), RiskInterval(value=0.1, name='Very High risk')]
name = 'SCORE'
predict(age: AgeInt(id='age', minimum=20, maximum=100, name='Age'), sex: Enum(id='sex', values={1: 'Male', 2: 'Female'}, name='Sex'), cholesterol: Float(id=4224820, minimum=2, maximum=10, name='Cholesterol (mmol/L)'), sbp: Float(id=4152194, minimum=80, maximum=250, name='Systolic blood pressure (mmHg)'), smoker_status: Enum(id=1585856, values={0: 'non-smoker', 1: 'smoker'}, name='Smoker Status'), country: Enum(id=4329169, values=['Albania', 'Algeria', 'Andorra', 'Armenia', 'Austria', 'Azerbaijan', 'Belarus', 'Belgium', 'Bulgaria', 'Cyprus', 'Denmark', 'Egypt', 'FYR Macedonia', 'Finland', 'France', 'Georgia', 'Germany', 'Greece', 'Iceland', 'Ireland', 'Israel', 'Italy', 'Kazakhstan', 'Kyrgyzstan', 'Latvia', 'Luxembourg', 'Malta', 'Moldova', 'Monaco', 'Norway', 'Portugal', 'Russian Federation', 'San Marino', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'Syrian Arab Republic', 'Tajikistan', 'The Netherlands', 'Turkmenistan', 'Ukraine', 'United Kingdom', 'Uzbekistan'], name='Country')) float

Predicts the absolute risk of cardiovascular disease based on the input parameters.

Args:

age (int): Age of the individual (between 20 and 100). sex (int): Gender of the individual (1 for Men, 0 for Women). cholesterol (float): Cholesterol level in mmol/L (between 2 and 10). sbp (float): Systolic blood pressure in mmHg (between 80 and 250). smoker_status (int): Smoker status score. country (str): Country of the individual.

Returns:

float: Absolute risk of cardiovascular disease.

title = 'Probability of fatal cardiovascular disease in the next 10 years'