@@ -9,12 +9,18 @@ class Plco:
99 BMI_CENTRED_OR_REFERENT_REF_GROUP = Decimal ('27' )
1010 COPD_ENPHYSEMA_OR_CHRONIC_BRONCHITIS_COEFFICIENT = Decimal ('0.3553063' )
1111 PERSONAL_HISTORY_OF_CANCER_COEFFICIENT = Decimal ('0.4589971' )
12+ FAMILY_HISTORY_OF_CANCER_COEFFICIENT = Decimal ('0.587185' )
1213
13- def __init__ (self , age = None , bmi = None , copd_enphysema_or_chronic_bronchitis = None , personal_history_of_cancer = None ):
14+ def __init__ (self ,
15+ age = None ,
16+ bmi = None ,
17+ copd_enphysema_or_chronic_bronchitis = None ,
18+ personal_history_of_cancer = None , family_history_of_cancer = None ):
1419 self .age = Decimal (str (age or 0 ))
1520 self .bmi = Decimal (str (bmi or 0 ))
1621 self .copd_enphysema_or_chronic_bronchitis = copd_enphysema_or_chronic_bronchitis
1722 self .personal_history_of_cancer = personal_history_of_cancer
23+ self .family_history_of_cancer = family_history_of_cancer
1824
1925 def age_in_years_contribution_to_estimate (self ):
2026 return (self .age - self .AGE_CENTRED_OR_REFERENT_REF_GROUP ) * self .AGE_COEFFICIENT
@@ -37,5 +43,12 @@ def personal_history_of_cancer_contribution_to_estimate(self):
3743
3844 return self .personal_history_of_cancer * self .PERSONAL_HISTORY_OF_CANCER_COEFFICIENT
3945
46+ def family_history_of_cancer_contribution_to_estimate (self ):
47+ if self .family_history_of_cancer is None :
48+ raise self .InvalidValueError (
49+ "family_history_of_cancer must be true or false" )
50+
51+ return self .family_history_of_cancer * self .FAMILY_HISTORY_OF_CANCER_COEFFICIENT
52+
4053 class InvalidValueError (Exception ):
4154 pass
0 commit comments