(self, form_config)
return start_datetime, stop_datetime
Returns a start datetime for the Visit and the Encounter, and a
        stop_datetime for the Visit
Returns a start datetime for the Visit and the Encounter, and a
        stop_datetime for the Visit
Returns a start datetime for the Visit and the Encounter and a stop_datetime for the Visit
def _get_start_stop_datetime(self, form_config):
        """
        Returns a start datetime for the Visit and the Encounter, and a
        stop_datetime for the Visit
        """
        if form_config.openmrs_start_datetime:
            value_source = as_value_source(form_config.openmrs_start_datetime)
            if value_source.can_export:
                cc_start_datetime_str = value_source.get_commcare_value(self.info)
                if cc_start_datetime_str is None:
                    raise ConfigurationError(
                        'A form config for form XMLNS "{}" uses "openmrs_start_datetime" to get the start of '
                        'the visit but no value was found in the form.'.format(form_config.xmlns)
                    )
                try:
                    cc_start_datetime = string_to_utc_datetime(cc_start_datetime_str)
                except ValueError:
                    raise ConfigurationError(
                        'A form config for form XMLNS "{}" uses "openmrs_start_datetime" to get the start of '
                        'the visit but an invalid value was found in the form.'.format(form_config.xmlns)
                    )
                cc_stop_datetime = cc_start_datetime + timedelta(days=1) - timedelta(seconds=1)
                # We need to serialize both values with the data type of
                # openmrs_start_datetime because they could be either
                # OpenMRS datetimes or OpenMRS dates, and their data
                # types must match.
                start_datetime = value_source.serialize(cc_start_datetime)
                stop_datetime = value_source.serialize(cc_stop_datetime)
                return start_datetime, stop_datetime
        cc_start_datetime = string_to_utc_datetime(self.form_json['form']['meta']['timeEnd'])
        cc_stop_datetime = cc_start_datetime + timedelta(days=1) - timedelta(seconds=1)
        start_datetime = to_omrs_datetime(cc_start_datetime)
        stop_datetime = to_omrs_datetime(cc_stop_datetime)
        return start_datetime, stop_datetime
def _get_start_stop_datetime ( self , form_config ) : if form_config . openmrs_start_datetime : value_source = as_value_source ( form_config . openmrs_start_datetime ) if value_source . can_export : cc_start_datetime_str = value_source . get_commcare_value ( self . info ) if cc_start_datetime_str is None : raise ConfigurationError ( 'A form config for form XMLNS "{}" uses "openmrs_start_datetime" to get the start of ' 'the visit but no value was found in the form.' . format ( form_config . xmlns ) ) try : cc_start_datetime = string_to_utc_datetime ( cc_start_datetime_str ) except ValueError : raise ConfigurationError ( 'A form config for form XMLNS "{}" uses "openmrs_start_datetime" to get the start of ' 'the visit but an invalid value was found in the form.' . format ( form_config . xmlns ) ) cc_stop_datetime = cc_start_datetime + timedelta ( days = 1 ) - timedelta ( seconds = 1 ) # We need to serialize both values with the data type of # openmrs_start_datetime because they could be either # OpenMRS datetimes or OpenMRS dates, and their data # types must match. start_datetime = value_source . serialize ( cc_start_datetime ) stop_datetime = value_source . serialize ( cc_stop_datetime ) return start_datetime , stop_datetime cc_start_datetime = string_to_utc_datetime ( self . form_json [ 'form' ] [ 'meta' ] [ 'timeEnd' ] ) cc_stop_datetime = cc_start_datetime + timedelta ( days = 1 ) - timedelta ( seconds = 1 ) start_datetime = to_omrs_datetime ( cc_start_datetime ) stop_datetime = to_omrs_datetime ( cc_stop_datetime ) return start_datetime , stop_datetime