Ejemplo n.º 1
0
 def filter_patients_dataframe(self,
                               limit_date,
                               start_date=None,
                               include_null_dates=False):
     n_limit = limit_date - relativedelta(months=1)
     n_start = start_date - relativedelta(months=1)
     return super(PreviousActiveList, self).filter_patients_dataframe(
         getLastDayOfPeriod(n_limit.month, n_limit.year),
         start_date=getFirstDayOfPeriod(n_start.month, n_start.year),
         include_null_dates=include_null_dates)
Ejemplo n.º 2
0
 def filter_patients_dataframe(self,
                               limit_date,
                               start_date=None,
                               include_null_dates=False):
     stopped_prev = ArvStopped(self.fuchia_database)
     n_limit = limit_date - relativedelta(months=1)
     n_start = start_date - relativedelta(months=1)
     stopped_prev_patients = stopped_prev.get_filtered_patients_dataframe(
         getLastDayOfPeriod(n_limit.month, n_limit.year),
         start_date=getFirstDayOfPeriod(n_start.month, n_start.year),
         include_null_dates=include_null_dates)
     al = ActiveList(self.fuchia_database)
     active_list = al.get_filtered_patients_dataframe(
         limit_date,
         start_date=start_date,
         include_null_dates=include_null_dates)
     idx = stopped_prev_patients.index.intersection(active_list.index)
     return active_list.loc[idx], None
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
    def filter_patients_dataframe(self, limit_date, start_date=None,
                                  include_null_dates=False):
        lost_prev = LostPatients(self.fuchia_database)
        arv_started = ArvStartedPatients(self.fuchia_database)
        n_limit = limit_date - relativedelta(months=1)
        n_start = start_date - relativedelta(months=1)
        i = (lost_prev & arv_started)
        prev_lost_patients = i.get_filtered_patients_dataframe(
            getLastDayOfPeriod(n_limit.month, n_limit.year),
            start_date=getFirstDayOfPeriod(n_start.month, n_start.year),
            include_null_dates=include_null_dates
        )
        visits = self.filter_visits_by_category(
            limit_date,
            start_date=None,
            include_null_dates=include_null_dates
        )
        c1 = (visits['visit_date'] >= start_date)
        c2 = (visits['visit_date'] <= limit_date)
        visits = visits[c1 & c2]
        seen_id = pd.Index(visits['patient_id'].unique())
        # Arv dead during the period must be re-included
        arv_dead = ArvDeadPatientsDuringPeriod(self.fuchia_database)
        dead = arv_dead.get_filtered_patients_dataframe(
            limit_date,
            start_date=start_date,
            include_null_dates=include_null_dates
        )
        seen_id = seen_id.union(dead.index)
        # Transferred during the period must be re-included
        arv_trans = ArvTransferredPatientsDuringPeriod(self.fuchia_database)
        trans = arv_trans.get_filtered_patients_dataframe(
            limit_date,
            start_date=start_date,
            include_null_dates=include_null_dates
        )

        seen_id = seen_id.union(trans.index)
        n_index = prev_lost_patients.index.intersection(seen_id)
        return prev_lost_patients.loc[n_index], None