Get Started with Amazon Mechanical Turk
Use the hands-on tutorials in this section to help you get started and learn more about Amazon Mechanical Turk.
Topics
Prerequisites
Before you begin, you should familiarize yourself with the basic concepts in Amazon Mechanical Turk. For more information, see The Amazon Mechanical Turk marketplace and Amazon Mechanical Turk core concepts.
Additional, complete the steps in Set up Amazon Mechanical Turk before completing this tutorial.
Step 1: Create a task
In this step we create a task in Mechanical Turk that asks workers to describe the current weather where they live. The task interface for this will be created using the HTMLQuestion data structure and we'll make use of Crowd HTML Elements to simplify the task HTML.
Important
Completing the steps in this tutorial results in a charge of $0.60 to your account.
Question definition
The most common way to define tasks in Mechanical Turkis using the HTMLQuestion
data
structure, which is defined as XML that encapsulates the HTML that is displayed to
the worker. For this task, we use the following definition.
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd"> <HTMLContent><![CDATA[ <!DOCTYPE html> <script src="https://assets.crowd.aws/crowd-html-elements.js"></script> <crowd-form> <p>Describe the current weather where you live.</p> <p><textarea name="weather" cols="80" rows="3"></textarea></p> </crowd-form> ]]> </HTMLContent> <FrameHeight>0</FrameHeight> </HTMLQuestion>
Note that the HTML includes a reference to the crowd-html-elements.js
library which includes the crowd-form
element. We use the
crowd-form
element in place of the standard form
element because it removes the need to specify the endpoint for the form to submit
results. It also automatically appends a Submit button if one
isn't present. More information about this library can be found in Crowd HTML Elements.
We've also set the value of FrameHeight
to zero, which directs the
marketplace website to render the task interface using the full browser window.
Task attributes
Next, we can define the attributes for our task. We'll use the following attributes:
Attribute | Value |
---|---|
Title | Describe the weather |
Description | Describe the current weather where you live |
Reward | 0.1 |
MaxAssignments
|
5 |
LifetimeInSeconds
|
14,400 |
AssignmentDurationInSeconds
|
300 |
AutoApprovalDelayInSeconds
|
259,200 |
Here, we give an accurate description of our task and indicate that we will reward
each worker with 10 cents for each successful completion. In addition, we set the
MaxAssignments
to 5
to indicate that we would like to
get five responses from different workers. Finally, we set the lifetime and
assignment duration to four hours and five minutes respectively. Workers have five
minutes to complete the assignment before it expires and becomes available to other
workers. If, after four hours, we haven't yet gotten a response, the task is
automatically removed from the Mechanical Turk marketplace. We've also set the
AutoApprovalDelay
at three days which means that an assignment is
automatically approved after three days if we don't take any action to approve or
reject it before then.
For more detail on the attributes that can be specified for a HIT, visit the CreateHIT documentation.
Post the task
You can post a task using the AWS CLI or a language-specific AWS SDK. Select a tab in the following table to see an example of how you can post a task using the AWS CLI and the AWS SDK for Python (Boto3).
Step 2: Check task status
In this step, we check the status of a task we created in Mechanical Turk. We poll the API for
the status of our HIT using the HITId
from the previous step. You need to
capture that identifier and insert it in the following appropriate location to retrieve
your results.
The code block examples in this section have been spaced out for readability.
Step 3: Retrieve results
In this step, we retrieve the results of a task we created in Mechanical Turk. We use the
HITId
from that was generated in Step 1. You need to capture that
identifier and insert it in the appropriate location below to retrieve your results.
Before running the commands in this step, you should confirm the HITStatus
is Reviewable
as shown in Step 2, or you may get incomplete results.
Step 4: Approve Assignments
In this step, we approve the assignments submitted by workers so that the reward is transferred to their account. In Step 1, we set the Auto Approval Delay so that if we do nothing, workers are paid automatically after three days. However, it is always a best practice to approve work quickly if at all possible so that workers don't have to wait for the time to expire. Alternatively, if you plan to approve all of the assignments that are submitted, the Auto Approval Delay can be set to 0 and you can skip this step.
We use the same HITId
that was generated in Step 1. You will need to
capture that identifier and insert it in the appropriate location below to approve the
results.