ex_cogmint v0.0.5 ExCogmint
Documentation for ExCogmint.
Link to this section Summary
Functions
Add a new task to an existing project.
Gets information on a task ("worktask"). Returns the task, including associated submissions as a list of strings.
Link to this section Functions
add_task!(project_uuid, map)
Add a new task to an existing project.
Project_uuid is the project's ID for which you wish to add a new microtask.
The second argument is a map of substitutions you wish to make to the default project task template in order to create the task.
For example, suppose you have a project asking users to determine if a city is a capital city or not. This project likely has a template that looks something like:
"Is [[city]] a capital city?"
For this project template, we can provide a map replacing the variable city
with a value
by passing in a map like
%{"city" => "Washington, D.C."}
Resulting in a task created for a worker like:
"Is Washington, D.C. a capital city?"
Examples
ExCogmint.add_task!("1234-12345-1234-12345", %{"city" => "Brasilia"})
ExCogmint.add_task!("abc-123-abc", %{"variable_name_to_replace" => "string inserted"})
Potential Responses:
{:ok,
%{
data: %{
prompt: "Hotdog or not hotdog?",
task_uuid: "1234-1234-1234",
reward: 4,
callback_url: "https://yoururl.com/callbackyouspecify",
required_submissions: 3,
submission_count: 3,
checked_out_at: <datetime>,
allowed_completion_time_seconds: 3600,
external_image_url: "https://www.imagehostingurl.com/maybehotdog.png",
submissions: []
}
}
}
or
{:error, "helpful message"}
get_task!(uuid)
Gets information on a task ("worktask"). Returns the task, including associated submissions as a list of strings.
Example response:
%{
data: %{
prompt: "Hotdog or not hotdog?",
task_uuid: "1234-1234-1234",
reward: 4,
callback_url: "https://yoururl.com/callbackyouspecify",
required_submissions: 3,
submission_count: 3,
checked_out_at: <datetime>,
allowed_completion_time_seconds: 3600,
external_image_url: "https://www.imagehostingurl.com/maybehotdog.png",
submissions: ["yes", "yes", "yes"]
}
}