def meets_general_criteria(self): t_a = self.count_booleans(Icd10Schizophrenia.A_NAMES) u_a = self.n_incomplete(Icd10Schizophrenia.A_NAMES) t_b = self.count_booleans(Icd10Schizophrenia.B_NAMES) + \ self.count_booleans(Icd10Schizophrenia.C_NAMES) u_b = self.n_incomplete(Icd10Schizophrenia.B_NAMES) + \ self.n_incomplete(Icd10Schizophrenia.C_NAMES) if t_a + u_a < 1 and t_b + u_b < 2: return False if self.present_one_month is not None and not self.present_one_month: return False if ((self.also_manic or self.also_depressive) and is_false(self.if_mood_psychosis_first)): return False if is_false(self.not_organic_or_substance): return False if ((t_a >= 1 or t_b >= 2) and self.present_one_month and ( (is_false(self.also_manic) and is_false(self.also_depressive)) or self.if_mood_psychosis_first ) and self.not_organic_or_substance): return True return None
def meets_criteria_none(self): h = self.meets_criteria_hypomania() m = self.meets_criteria_mania_ignoring_psychosis() if h or m: return False if is_false(h) and is_false(m): return True return None
def meets_criteria_mania_ignoring_psychosis(self): # When can we say "definitely not"? if is_false(self.mood_elevated) and is_false(self.mood_irritable): return False if is_false(self.sustained7days) and is_false(self.admission_required): return False t = self.count_booleans(Icd10Manic.HYPOMANIA_MANIA_NAMES) + \ self.count_booleans(Icd10Manic.MANIA_NAMES) u = self.n_incomplete(Icd10Manic.HYPOMANIA_MANIA_NAMES) + \ self.n_incomplete(Icd10Manic.MANIA_NAMES) if self.mood_elevated and (t + u < 3): # With elevated mood, need at least 3 symptoms return False if is_false(self.mood_elevated) and (t + u < 4): # With only irritable mood, need at least 4 symptoms return False if is_false(self.severe_interference_functioning): return False # OK. When can we say "yes"? if ((self.mood_elevated or self.mood_irritable) and (self.sustained7days or self.admission_required) and ((self.mood_elevated and t >= 3) or (self.mood_irritable and t >= 4)) and self.severe_interference_functioning): return True return None
def meets_criteria_hypomania(self): # When can we say "definitely not"? if self.meets_criteria_mania_ignoring_psychosis(): return False # silly to call it hypomania if it's mania if is_false(self.mood_elevated) and is_false(self.mood_irritable): return False if is_false(self.sustained4days): return False t = self.count_booleans(Icd10Manic.HYPOMANIA_MANIA_NAMES) u = self.n_incomplete(Icd10Manic.HYPOMANIA_MANIA_NAMES) if t + u < 3: # Need at least 3 symptoms return False if is_false(self.some_interference_functioning): return False # OK. When can we say "yes"? if ((self.mood_elevated or self.mood_irritable) and self.sustained4days and t >= 3 and self.some_interference_functioning): return True return None
def isPDExcluded(self): return ( is_false(self.g1) or is_false(self.g2) or is_false(self.g3) or is_false(self.g4) or is_false(self.g5) or is_false(self.g6) or ( self.are_all_fields_complete( repeat_fieldname("g1_", 1, Icd10SpecPD.N_GENERAL_1)) and self.count_booleans( repeat_fieldname("g1_", 1, Icd10SpecPD.N_GENERAL_1)) <= 1 ) )