def __init__(self, fuchia_database): super(ReceivedArvDuringPeriod, self).__init__(fuchia_database) self.a = PreviousActiveList(self.fuchia_database) self.b = ArvStartedDuringPeriod(self.fuchia_database) self.c = ArvIncomingTransferPatientsDuringPeriod(self.fuchia_database) self.d = ArvLostBackPatients(self.fuchia_database) self.e = ArvRestartedDuringPeriod(self.fuchia_database)
def filter_patients_dataframe(self, limit_date, start_date=None, include_null_dates=False): tb_entry = TbVihPositive(self.fuchia_database) arv_started = ArvStartedDuringPeriod(self.fuchia_database) return (tb_entry & arv_started).get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates ), None
def filter_patients_dataframe(self, limit_date, start_date=None, include_null_dates=False): had_cd4_inf_200 = HadCd4Inf200DuringPeriod(self.fuchia_database) arv_started = ArvStartedDuringPeriod(self.fuchia_database) return (had_cd4_inf_200 & arv_started).get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates), None
def filter_patients_dataframe(self, limit_date, start_date=None, include_null_dates=False): cv_12_months = HadViralLoad12Inf1000(self.fuchia_database) cv_12_months_patients = cv_12_months.get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates) p_limit = limit_date - relativedelta(months=12) p_start = start_date - relativedelta(months=12) p_limit = getLastDayOfPeriod(p_limit.month, p_limit.year) p_start = getFirstDayOfPeriod(p_start.month, p_start.year) arv_started = ArvStartedDuringPeriod( self.fuchia_database).get_filtered_patients_dataframe( p_limit, start_date=p_start, include_null_dates=include_null_dates) idx = cv_12_months_patients.index.intersection(arv_started.index) return arv_started.loc[idx], None
def filter_patients_dataframe(self, limit_date, start_date=None, include_null_dates=False): active_list = ActiveList( self.fuchia_database).get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates) p_limit = limit_date - relativedelta(months=self.retention_duration) p_start = start_date - relativedelta(months=self.retention_duration) p_limit = getLastDayOfPeriod(p_limit.month, p_limit.year) p_start = getFirstDayOfPeriod(p_start.month, p_start.year) arv_started = ArvStartedDuringPeriod( self.fuchia_database).get_filtered_patients_dataframe( p_limit, start_date=p_start, include_null_dates=include_null_dates) intersection = active_list.index.intersection(arv_started.index) return active_list.loc[intersection], None
class ReceivedArvDuringPeriod(PatientIndicator): def under_arv(self): return False @classmethod def get_key(cls): return "ARV_RECEIVED" @classmethod def get_display_label(cls): return "Ayant bénéficié du TARV" def __init__(self, fuchia_database): super(ReceivedArvDuringPeriod, self).__init__(fuchia_database) self.a = PreviousActiveList(self.fuchia_database) self.b = ArvStartedDuringPeriod(self.fuchia_database) self.c = ArvIncomingTransferPatientsDuringPeriod(self.fuchia_database) self.d = ArvLostBackPatients(self.fuchia_database) self.e = ArvRestartedDuringPeriod(self.fuchia_database) def filter_patients_dataframe(self, limit_date, start_date=None, include_null_dates=False): patients = self.filter_patients_by_category( limit_date, start_date=None, include_null_dates=include_null_dates) a = self.a.get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates).index b = self.b.get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates).index c = self.c.get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates).index d = self.d.get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates).index e = self.e.get_filtered_patients_dataframe( limit_date, start_date=start_date, include_null_dates=include_null_dates).index idx = a.union(b).union(c).union(d).union(e) return patients.loc[idx], None def get_value(self, limit_date, start_date=None, gender=None, age_min=None, age_max=None, age_is_null=False, include_null_dates=False, post_filter_index=None): return (self.a + self.b + self.c + self.d + self.e).get_value( limit_date, start_date=start_date, gender=gender, age_min=age_min, age_max=age_max, age_is_null=age_is_null, include_null_dates=include_null_dates, post_filter_index=post_filter_index)