Skip to content

Instantly share code, notes, and snippets.

@EntilZha
Last active August 29, 2015 14:19
Show Gist options
  • Save EntilZha/03ae96dda52487f8ac1d to your computer and use it in GitHub Desktop.
Save EntilZha/03ae96dda52487f8ac1d to your computer and use it in GitHub Desktop.
Ampcrowd JS Template

AMPCrowd Template Proposal

Task API

Task Group

  • group_id
  • tasks_finished
  • callback_url
  • group_context
  • crowd_config

Task

  • task_type (Add a JS task type)
  • data: json dictionary, keys are ids into points, which represent a unit of work (eg rate this tweet)
  • create_time
  • num_assignments
  • mv_answer
  • em_answer
  • is_complete

Response

  • context: contains key "answers" which is json dictionary, keys are ids, values are responses (eg 1-5 rating of tweet)
  • assignment_id

Template Proposal

JSON based template

Template will be javascript based. The javascript template will be represnted by a JSON object containing these fields:

  • head: html/css/js content (including css/js) to be injected into the element
  • body: html/css/js content
  • The "data" field from Task is injected as a javascript value with some arbitrary name unlikely to be overwritten by third party javascript code
  • New task types can be created by submitting a json file with these fields defined
  • The only requirement is that for each task json object submission, "answers" is present and that it provides a way to submit to MTurk (just copy code from current templates).

Notes

  • Django template responsible for injecting javascript from python object
  • Django model responsible for deciding which template to use

Django Model

Create new model to represent task types, "TaskType"

  • django_template: which django template should be used
  • name: common string name of task type (eg. Image Recognition, Entity Resolution)
  • template: template stored in database which is injected into the django template (when the data is injected). The django template can either use this or ignore it. The template decides how to render the python string, so this could be json/xml/yaml/anything

Default Templates

  • Include several default templates for common use cases
  • Default templates based on ReactJS
  • New templates can be created using the template builder Eugene linked, will need to be formatted correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment