Пример #1
0
 def filter_function(case):
     registration_date = get_date(case, "start_date")
     if registration_date is None:
         return False
     first_tuesday = self.get_first_tuesday(registration_date)
     last_tuesday = first_tuesday + timedelta(days=49)
     return first_tuesday <= survey_report_date <= last_tuesday
Пример #2
0
 def filter_function(case):
     registration_date = get_date(case, "start_date")
     if registration_date is None:
         return False
     first_tuesday = self.get_first_tuesday(registration_date)
     end_date = first_tuesday + timedelta(days=56)
     return end_date >= local_date
Пример #3
0
 def rows(self):
     participants = self.get_participants()
     result = []
     for case in participants:
         pid = case.get_case_property("pid")
         study_arm = case.get_case_property("study_arm")
         registration_date = get_date(case, "start_date")
         first_name = case.get_case_property("first_name") or ""
         if registration_date is None:
             continue
         first_survey_date = self.get_first_tuesday(registration_date)
         row = [
             self._fmt(pid),
             self._fmt(first_name),
             self._fmt(study_arm),
         ]
         for i in range(8):
             next_survey_date = first_survey_date + timedelta(days=7*i)
             response = self.get_first_survey_response(case, next_survey_date)
             if response == RESPONSE_NOT_APPLICABLE:
                 row.append(self._fmt("-"))
             elif response == NO_RESPONSE:
                 row.append(self._fmt(_("No Response")))
             else:
                 response_timestamp = ServerTime(response.date).user_time(self.timezone).done()
                 row.append(self._fmt_timestamp(response_timestamp))
         result.append(row)
     return result
Пример #4
0
 def rows(self):
     participants = self.get_participants()
     result = []
     for case in participants:
         pid = case.get_case_property("pid")
         study_arm = case.get_case_property("study_arm")
         registration_date = get_date(case, "start_date")
         if registration_date is None:
             continue
         first_survey_date = self.get_first_tuesday(registration_date)
         row = [
             self._fmt(pid),
             self._fmt(case.name),
             self._fmt(study_arm),
         ]
         for i in range(8):
             next_survey_date = first_survey_date + timedelta(days=7*i)
             response = self.get_first_survey_response(case, next_survey_date)
             if response == RESPONSE_NOT_APPLICABLE:
                 row.append(self._fmt("-"))
             elif response == NO_RESPONSE:
                 row.append(self._fmt(_("No Response")))
             else:
                 response_timestamp = tz_utils.adjust_datetime_to_timezone(
                     response.date, pytz.utc.zone, self.domain_obj.default_timezone)
                 row.append(self._fmt_timestamp(response_timestamp))
         result.append(row)
     return result