Server

The opencrowd server primarily acts as an API between the developer and the opencrowd library. It also performs memory management and operations across all elements (adding/tracking/deleting projects, tasks, HITs, questions, sections). Generating

Module author: Michael Romero <michaelrom@zillowgroup.com>

class opencrowd.model.server.Opencrowd(project_ids=[])
Parameters:project_ids (list of str) – the project ids to attach to this instance of the server. For advanced usage only, otherwise leave default and run regenerate()
add_project(project)

Add a project object to opencrowd

Parameters:project (a Project object) – the project to attach to this instance of the server. For advanced usage only
Returns:the project used in param
create_project(title=None, description=None, crowdsource={'aws_access_key_id': 'nokey', 'aws_secret_access_key': 'nokey', 'endpoint': 'https://mturk-requester-sandbox.us-east-1.amazonaws.com', 'form_submission_action': 'https://workersandbox.mturk.com/mturk/externalSubmit', 'region_name': 'us-east-1', 'type': 'amt'})

The best way to generate a project. Creates a new project object and tracks it

Parameters:
  • title (str) – A title for the project
  • description (str) – A description of the project
  • crowdsource (dict) – The specification for the crowdsource
Returns:

the newly created Project object

delete_sandbox()

Delete all HITs on AMT Sandbox

static generate_response(assignment, response_type='default')

Create a Response class based on the specified assignment

Parameters:
  • assignment (Assignment) – completed assignment object
  • response_type (str) – “default” or “answers_only”
Returns:

Response

get_assignment_objects(assignment_ids=None, project_ids=None)

Return already saved assignment objects (does not run update())

Parameters:
  • assignment_ids (list of str) – optionally specify which assignments to return based on a list of ids
  • project_ids (list of str) – optionally specify which projects to scan for assignments
Returns:

list of assignment objects

list_HIT_ids(project_ids=None)

List all HIT ids

list_assignment_ids(project_ids=None)

List all assignment ids

list_project_ids(project_ids=None)

List all project ids

list_question_ids(project_ids=None)

List all question ids

list_section_ids(project_ids=None)

List all section ids

list_task_ids(project_ids=None)

List all task ids

recursive_delete()

Delete all instances, via ids, tracked on this instance

static regenerate()

Restores a default opencrowd instance and the project ids it tracks. After an Opencrowd server instance is created, it’s generally best to regenerate it unless you specified particular project ids to track.

save()

Utilize the Database class to save this object

submit_tasks()

Will recursively enter projects saved, their tasks, and their tasks’ HITs that have not been submitted yet, and have each HIT submit itself.

update()

Update this server’s projects