def _find_case_ids_without_mother_name(self):
    start_date = (date.today() - timedelta(days=100))
    reindex_accessor = CaseReindexAccessor(domain=DOMAIN, case_type=CASE_TYPE, limit_db_aliases=[self.db_alias], start_date=start_date)
    filename = ('cases_without_mother_name_part_%s_%s.csv' % (self.db_alias, datetime.utcnow()))
    cases_with_no_mother_name_filename = ('cases_with_no_mother_name_part_%s_%s.csv' % (self.db_alias, datetime.utcnow()))
    with open(filename, 'w') as output:
        with open(cases_with_no_mother_name_filename, 'w') as no_mother_name_file:
            cases_iterated = 0
            writer = csv.writer(output)
            writer.writerow(CSV_HEADERS)
            no_mother_name_writer = csv.writer(no_mother_name_file)
            no_mother_name_writer.writerow(['Case ID'])
            if self.log_progress:
                print('iterating now')
            for case in iter_all_rows(reindex_accessor):
                if (self.log_progress and ((cases_iterated % CASE_ITERATION_COUNT) == 0)):
                    print(('cases iterated: %s' % cases_iterated))
                cases_iterated += 1
                if self._case_needs_to_be_updated(case):
                    (mother_case_id, mother_name) = self._find_mother_case_id_and_name(case)
                    if (mother_case_id and mother_name):
                        writer.writerow([case.case_id, mother_case_id, mother_name])
                    else:
                        no_mother_name_writer.writerow([case.case_id])
    return filename
def _find_case_ids_without_mother_name(self):
    start_date = (date.today() - timedelta(days=100))
    reindex_accessor = CaseReindexAccessor(domain=DOMAIN, case_type=CASE_TYPE, limit_db_aliases=[self.db_alias], start_date=start_date)
    filename = ('cases_without_mother_name_part_%s_%s.csv' % (self.db_alias, datetime.utcnow()))
    cases_with_no_mother_name_filename = ('cases_with_no_mother_name_part_%s_%s.csv' % (self.db_alias, datetime.utcnow()))
    with open(filename, 'w') as output:
        with open(cases_with_no_mother_name_filename, 'w') as no_mother_name_file:
            cases_iterated = 0
            writer = csv.writer(output)
            writer.writerow(CSV_HEADERS)
            no_mother_name_writer = csv.writer(no_mother_name_file)
            no_mother_name_writer.writerow(['Case ID'])
            if self.log_progress:
                print('iterating now')
            for case in iter_all_rows(reindex_accessor):
                if (self.log_progress and ((cases_iterated % CASE_ITERATION_COUNT) == 0)):
                    print(('cases iterated: %s' % cases_iterated))
                cases_iterated += 1
                if self._case_needs_to_be_updated(case):
                    (mother_case_id, mother_name) = self._find_mother_case_id_and_name(case)
                    if (mother_case_id and mother_name):
                        writer.writerow([case.case_id, mother_case_id, mother_name])
                    else:
                        no_mother_name_writer.writerow([case.case_id])
    return filename