caqe.models module

SQLAlchemy database models

class caqe.models.Condition(data, test_id=None, group_id=None)[source]

Bases: flask_sqlalchemy.Model

An experimental condition, i.e. the variable conditions of a trial

id

int – Primary key

test_id

int, optional – Foreign key to the Test the condition belongs to

group_id

int, optional

data

str – JSON-enconded string of formatted condition variables

class caqe.models.Participant(platform, crowd_worker_id=None, ip_address=None)[source]

Bases: flask_sqlalchemy.Model

A participant in an experiment

id

int – Primary key

ip_address

str – The IP address of the participant

crowd_worker_id

str – The crowdsourcing site ID, e.g. Amazon MTurk’s workerId

platform

str – The platform the participant came from, e.g. ANONYMOUS, M_TURK, etc.

passed_hearing_test

bool – The user has passed the hearing test

bool – Participant agreed to the consent form.

hearing_test_attempts

int – The number of hearing_test_attempts

hearing_test_last_attempt

DateTime – The DateTime of the last hearing test attempt (pass or fail)

pre_test_survey

str – Pre-test survey data in JSON

post_test_survey

str – Post-test survey data in JSON

hearing_response_estimation

str – Hearing response estimation data in JSON

has_passed_hearing_test_recently()[source]

Check to see if participant has passed the hearing test recently (as defined in settings.py)

Returns:
Return type:bool
set_passed_hearing_test(passed_hearing_test)[source]

Mark them as having passed the hearing test

Parameters:passed_hearing_test (bool) –
Returns:
Return type:None
class caqe.models.Test(data)[source]

Bases: flask_sqlalchemy.Model

An experimental test. Many conditions may share these properties.

id

int – Primary key

data

str – JSON-encoded string of formatted test variables

class caqe.models.Trial(participant_id, condition_id, data, crowd_data=None, participant_passed_hearing_test=None)[source]

Bases: flask_sqlalchemy.Model

A trial in an experiment

id

int – Primary key

participant_id

int – Foreign key to the Participant of the trial

condition_id

int – Foreign key to the Condition of the trial

crowd_data

str – JSON-encoded string of data from the crowdsourcing site (e.g. workerId, assignmentId, HITId, etc. from MTurk)

data

str – JSON-enconded string formatted trial data dictionary

participant_passed_hearing_test

bool – Participant passed hearing test at time of trial