@@ -8,11 +8,13 @@ class Plco:
88 BMI_COEFFICIENT = Decimal ('-0.0274194' )
99 BMI_CENTRED_OR_REFERENT_REF_GROUP = Decimal ('27' )
1010 COPD_ENPHYSEMA_OR_CHRONIC_BRONCHITIS_COEFFICIENT = Decimal ('0.3553063' )
11+ PERSONAL_HISTORY_OF_CANCER_COEFFICIENT = Decimal ('0.4589971' )
1112
12- def __init__ (self , age = None , bmi = None , copd_enphysema_or_chronic_bronchitis = None ):
13+ def __init__ (self , age = None , bmi = None , copd_enphysema_or_chronic_bronchitis = None , personal_history_of_cancer = None ):
1314 self .age = Decimal (str (age or 0 ))
1415 self .bmi = Decimal (str (bmi or 0 ))
1516 self .copd_enphysema_or_chronic_bronchitis = copd_enphysema_or_chronic_bronchitis
17+ self .personal_history_of_cancer = personal_history_of_cancer
1618
1719 def age_in_years_contribution_to_estimate (self ):
1820 return (self .age - self .AGE_CENTRED_OR_REFERENT_REF_GROUP ) * self .AGE_COEFFICIENT
@@ -27,5 +29,13 @@ def copd_enphysema_or_chronic_bronchitis_contribution_to_estimate(self):
2729
2830 return self .copd_enphysema_or_chronic_bronchitis * self .COPD_ENPHYSEMA_OR_CHRONIC_BRONCHITIS_COEFFICIENT
2931
32+
33+ def personal_history_of_cancer_contribution_to_estimate (self ):
34+ if self .personal_history_of_cancer is None :
35+ raise self .InvalidValueError (
36+ "personal_history_of_cancer must be true or false" )
37+
38+ return self .personal_history_of_cancer * self .PERSONAL_HISTORY_OF_CANCER_COEFFICIENT
39+
3040 class InvalidValueError (Exception ):
3141 pass
0 commit comments