A service to compute and export the consensus for tasks in Citizen Science Project Builder via crowdnalysis.
The service acts as an intermediary between the C3S frontend of Citizen Science Project Builder and the underlying Pybossa API. The use case is as follows:
- CS Project Builder user clicks the Export Results (in CSV or JSON format) button on the C3S frontend;
- The request is forwarded to the crowdnalysis-service;
- The service
- Calls Pybossa API to extract
task,task_runandresultdata, - Computes the consensus on tasks for each question asked to the crowd by using crowdnalysis with the given consensus model (Dawid-Skene by default),
- Creates a
CSVor aJSONfile for each consensus depending on user's request, - Sends the consensus and original result files back to the C3S in a
.zipfile;
- Calls Pybossa API to extract
- The user downloads the
.zipfile without leaving the C3S frontend in any of the above steps.
If consensus does not apply to the project (e.g., there is no classification task) or an error occurs during
consensus computation, only the result files are returned. Log messages are sent to the stderr.
The service is basically a Flask application running on a
Gunicorn WSGI server and listening on the 5000 port. After git cloning the repo,
start the service:
source bin/init.sh && bin/boot.sh First, build the docker image:
docker build --tag crowdnalysis-service .Then, run the container (in detached mode):
docker run -d -p 5000:5000 --env-file service.env crowdnalysis-serviceIf you run the service on the same host with Pybossa, use the following command instead:
docker run -d -p 5000:5000 --env-file service.env --add-host host.docker.internal:host-gateway crowdnalysis-service
- Edit the
service.envfile to configure thePORTthat the service listens on and, if you start the service as a container, set the-poption indocker runaccordingly. - To view
DEBUG-level log messages, set the related environment variable to1in the same file.
When the service is started by
docker-composewithin the Pybossa multi-container set-up, the environment variables are read from theetc/crowdnalyis-service.envfile instead.
- While building the docker image, if you experience the
'internal compiler error: Killed (program cc1plus)'error during the installation of CmdStan, increase the memory dedicated to your Docker engine, and retry building.