Fork me on GitHub

crowdrouter

A programmer-friendly framework for architecting tasks and workflows to the crowd.

Download View on GitHub
  • Crowdsourcing as a first-class concern

    Program your crowdsourcing tasks and workflows as inheritable classes. Organize crowd-work in no time.

  • Pipelining, User Authentication, and Crowd Statistics

    Declare sequences of Tasks in a WorkFlow, place authentication in your CrowdRouter, Tasks, or WorkFlows, and keep tabs on GET and POST task counts.

  • Web Framework-Friendly

    The CrowdRouter fits snuggly in your favorite Python web framework. Just plug and play.

The CrowdRouter enables developers to create and maintain crowdsourcing tasks and workflows using familiar constructs (classes, decorators, etc.). To get started, create a CrowdRouter class and declare its WorkFlow classes.

      class MyCrowdRouter(AbstractCrowdRouter):
          def __init__(self):
              self.workflows = [ReportWorkFlow] #Put in workflow classes here.

          @crowdrouter
          def route(self, crowd_request, workflow):
              return workflow.run(crowd_request)
      

      class ReportWorkFlow(AbstractWorkFlow):
          def __init__(self):
              tasks = [ReportTask, RankTask, MatchTask] #Put Task classes here.

          @workflow
          def run(self, task):
              return task.execute() #Execute the task normally.
      
Then, create as many WorkFlow classes as desired to accurately capture the work that you want your workers to perform.
Write out your task definitions as Task classes. Treat them like RESTful endpoints.

      class ReportTask(AbstractTask):
          @task("/task1")
          def get(self):
              return {"status": "OK", "path":"report_task.html"}

          @task("/task1")
          def post(self):
              return {"status": "OK", "path":"/"}
      

      def new(request):
        .... #Controller logic.
        r = my_crowdrouter.route("ReportWorkFlow", "ReportTask", request, request.session)
        return redirect(r.response["path"], r.response, RequestContext(request))
      
Now, plug it in to your controllers. Make sure you enabled sessions, and call the right WorkFlow and Task for the right endpoint.

Through Pip


  pip install crowdrouter
  

Or just download from GitHub.