def scheduled_for_date(self, date_val):
        """
        For a given date, return the array of pact_ids that are scheduled for visiting.  This will check the activate date by using the internal interval tree.
        Parameter:  datetime value
        Returns: array of pact_ids
        """
        day_of_week = date_val.isoweekday() % 7
        if not self.intervals.has_key(day_of_week):
            return []
        else:
            pass
        day_tree = self.intervals[day_of_week]
        results = []
        day_tree.intersect(get_seconds(date_val) - .1, get_seconds(date_val),
                           lambda x: results.append(x.other))
        return results
dataset/ETHPy150Open dimagi/commcare-hq/custom/_legacy/pact/reports/chw_schedule.py/CHWPatientSchedule.scheduled_for_date/original