Skip to content

PYBOSSA webhook server to analyze your own project in real-time

License

Notifications You must be signed in to change notification settings

Scifabric/webhooks

Repository files navigation

Build Status Coverage Status

Analyzing your PyBossa project in real-time

This very simple web module shows how you can easily analyze your PyBossa project in real-time.

PyBossa supports webhooks, notifying via an HTTP POST request the task that has been completed by the volunteers or users. The POST sends basically the following data:


{'fired_at':,
 'project_short_name': 'project-slug',
 'project_id': 1,
 'task_id': 1,
 'result_id': 1,
 'event': 'task_completed'} 

The PyBossa server sends all the required information to analyze the results of the contributions of the volunteers for a given task using Enki.

While the main purpose of this project is to do the analysis of the results, you can customize and fork this project to do many more things like:

  • Post to Twitter that your project has completed a task.
  • Upload the results to your DropBox folder by writing the results in a file.
  • etc.

In this specific version, the analysis module only shows how you can easily get the most voted option for an image pattern recognition project.

Installation

To install the project all you need is run the following command (we recommend you to use a virtual environment):

pip install -r requirements.txt

Now, copy the settings.py.template file to: settings.py and fill in the information. Once you are done with this file, you'll be ready to run the server.

NOTE: Be sure to have a PyBossa API-KEY as the analysis will be stored in the PyBossa results table.

NOTE: It requires a PyBossa server >= 1.2.0.

Running the server

Now that you've the required libraries installed, running the server is as simple as this:

python app.py

Configuring background jobs

By default, this project has disabled the creation of queues in your system. If you expect to have lots of contributions in your project, we recommend you to enable them.

To support queues you will need to install in your machine a Redis server. Then, change the flag: enable_background_jobs to True in your settings.py file, and restart the server.

Note: if you are already running a Redis server and queues, you can customize the name of your queue in the settings file. Check out the config variable: queue_name.

Running the background jobs

Now that you have the project running background jobs, you need to process them. This is very simple, in another terminal run the following command:

rqworker mywebhooks

NOTE: If you've changed the name of the queue, please, update the previous command with your new queue name. That's all! Enjoy!!!

LICENSE / Copyright

Copyright (C) 2015 SciFabric LTD.

See COPYING file.