Adding tasks to the application
How to create tasks for our application
In the previous task, we have modified the name of the application, the short name (or slug) and its description. Now, we can learn how we can create several tasks for the application getting image URLs from from Flickr.
The Flickr Person Finder application gets the most recent published photos in Flickr and creates a task per published photo. Flickr provides the following information for every published photo:
- Link: http://www.flickr.com/photos/teleyinex/2945647308/
- URL of the photo medium size: http://farm4.staticflickr.com/3208/2945647308_f048cc1633_m.jpg
The link points towards the Flickr page that hosts the photo, while the URL is the direct link to the photo medium size (the _m substring tells us the medium size, if you change it by _b you get a bigger image).
The goal of our application is to ask the users: do you see a human in this photo?, so the task should include only the URL of the photo. As we learnt in the previous task, we have to use the JSON format to define the task parameters, and this could be done in the following way:
{ 'link': 'http://www.flickr.com/photos/teleyinex/2945647308/', 'url_m': 'http://farm4.staticflickr.com/3208/2945647308_f048cc1633_m.jpg', 'url_b': 'http://farm4.staticflickr.com/3208/2945647308_f048cc1633_b.jpg' }
As you can see, we are using the {} braces to enclose the fields of the task, and we use the ' single quote to name the fields, in this case link, url_m and url_b for medium and big size of the images.
Flickr publishes the most recent photos as a list of items in JSON format (a vector), so thanks to the power of Python we will iterate over each photo and get the relevant information to create one JSON object per task for our application.
The createTasks.py script will use the application ID (which is unique in PyBossa) to add those tasks to the application, so when a user request a task for an application, PyBossa will deliver the right one.
Up to now, we know how we can create an application, and how we add some tasks to that application, however in the tasks we have not defined at all the "question" that we want to ask to the users. In the previous task, we created an application with an associated task presenter, as all the tasks for the given application will use the same layout. The question presented to the users is saved in the description field.
Therefore, the goal of this task is to change the question for the tasks. Choose a question that will help to classify dogs, cats, houses, coins, whatever you like. Then, run the createTask.py script so you will create the application with 20 tasks, and publish here your application URL.