示例#1
0
def get_timestamp(clinical_data):
    if not clinical_data:
        return None
    if not clinical_data.data:
        return None

    return parse_iso_datetime(clinical_data.data.get("timestamp", None))
示例#2
0
 def _get_date_of_birth(self, questionnaire_value):
     from rdrf.helpers.utils import parse_iso_datetime
     try:
         # the time field was causing a problem
         return parse_iso_datetime(questionnaire_value).date()
     except ValueError:
         raise ValueError("Invalid date of birth: %s" % questionnaire_value)
示例#3
0
def get_timestamp(clinical_data):
    from rdrf.helpers.utils import parse_iso_datetime
    if not clinical_data:
        return None
    if not clinical_data.data:
        return None

    return parse_iso_datetime(clinical_data.data.get("timestamp", None))
示例#4
0
    def _calculate_form_currency(self, form_model, dynamic_data):
        from datetime import timedelta, datetime
        form_timestamp_key = "%s_timestamp" % form_model.name
        one_year_ago = datetime.now() - timedelta(weeks=52)

        if dynamic_data is None:
            return False

        if form_timestamp_key in dynamic_data:
            timestamp = parse_iso_datetime(dynamic_data[form_timestamp_key])
            if timestamp >= one_year_ago:
                return True

        return False
示例#5
0
def get_date(datetime_string):
    dt = parse_iso_datetime(datetime_string)
    return dt.date()