caqe.views module

URL route handlers

caqe.views.admin_stats(*args, **kwargs)[source]
caqe.views.anonymous(*args, **kwargs)[source]

This is the entry point for an anonymous participant (i.e. no external id is available)

Returns:
Return type:flask.Response
caqe.views.audio(*args, **kwargs)[source]

Return audio from audio file URL in audio_file_key

Parameters:audio_file_key (str) – The encrypted key that contains a dictionary that included an item keyed by ‘path’ which is the location of the audio file
Returns:
Return type:flask.Response
caqe.views.begin(*args, **kwargs)[source]

Render a page with a button on it that directs them to the assign conditions. We don’t direct them initially to the evaluation page since some workers accept many HITs at a time. We need to make sure that they don’t get assigned the same conditions and that their session data is valid.

Parameters:
  • platform (str) –
  • crowd_worker_id (str) –
Returns:

Return type:

flask.Response

caqe.views.bonus(*args, **kwargs)[source]
caqe.views.consent(*args, **kwargs)[source]

Display consent page (if GET) and store results (if POST)

Returns:
Return type:flask.Response
caqe.views.create_participant(*args, **kwargs)[source]

Get or create participant from crowd_worker_id. Save variables to session.

Parameters:
  • participant_type (str) – The type of participant, e.g. ANONYMOUS, M_TURK, LAB, etc.
  • crowd_worker_id (str) – An external identifier
Returns:

Return type:

flask.Response

caqe.views.end(*args, **kwargs)[source]

Render a thank you page with a button on it that directs submits their task or simply closes the window (depending on the platform)

Parameters:platform (str) –
Returns:
Return type:flask.Response
caqe.views.evaluation(*args, **kwargs)[source]

Renders the listening test (if GET) and saves the results (if POST)

Returns:
Return type:flask.Response
caqe.views.get_current_participant(current_session, allow_none=False)[source]

Get the participant based on the participant_id in the current session.

Parameters:
  • current_session (flask.Session) –
  • allow_none (bool, optional) – If allow_none`==False, then if `participant_id is not defined or the id is invalid, then raise an exception, otherwise return None. Default is False.
Returns:

participant

Return type:

caqe.models.Participant

caqe.views.hearing_response_estimation(*args, **kwargs)[source]

Perform in-situ hearing response estimation (if GET) and store results (if POST)

Returns:
Return type:flask.Response
caqe.views.hearing_test(*args, **kwargs)[source]

Determines if the user is eligible to take the hearing test (i.e. has not exceeded MAX_HEARING_TEST_ATTEMPTS, and then renders the hearing test, which consists of the assessor counting the tones in two audio files.

If caqe.settings.HEARING_TEST_REJECTION_ENABLED is set to False, then pass them through after they had their 2 attempts.

Returns:
Return type:flask.Response
caqe.views.hearing_test_audio(*args, **kwargs)[source]

Retrieve audio for hearing test

Parameters:example_num (str) – The index of the example audio (1 or 2)
Returns:
Return type:flask.Response
caqe.views.internal_server_error(e)[source]

500 Internal Server Error page

Parameters:e (Exception) –
Returns:
Return type:flask.Response
caqe.views.mturk(*args, **kwargs)[source]

This is the entry point for an Amazon Turker.

Returns:
Return type:flask.Response
caqe.views.mturk_debug(*args, **kwargs)[source]

This just a view for previewing what the page would look like on Mechanical Turk

Returns:
Return type:flask.Response
caqe.views.nocache(view)[source]

No cache decorator. Puts no cache directives in header to avoid caching of endpoint.

Parameters:view (flask view function) –
caqe.views.page_not_found(e)[source]

404 Page Not Found page

Parameters:e (Exception) –
Returns:
Return type:flask.Response
caqe.views.post_evaluation_tasks(*args, **kwargs)[source]

Control overall flow of post-evaluation tasks. * Present hearing response estimation if required * Present post-test survey if required * Present thank you page and submit task if required

Returns:
Return type:flask.Response
caqe.views.post_test_survey(*args, **kwargs)[source]

Display post-test survey (if GET) and store results (if POST)

Returns:
Return type:flask.Response
caqe.views.pre_evaluation_tasks()[source]

Control overall flow of pre-evaluation tasks. * Assign conditions * Obtain consent if required * Present hearing screening if required * Present pre-test survey if required

Returns:
Return type:flask.Response
caqe.views.pre_test_survey(*args, **kwargs)[source]

Display pre-test survey (if GET) and store results (if POST)

Returns:
Return type:flask.Response
caqe.views.strip_query_from_url(url)[source]

Return the a URL without the query, which may be simply used for cache busting.

Parameters:url (str) –
Returns:stripped_url – URL stripped of query strings
Return type:str