zooniverse / panoptes

Zooniverse API to support user defined volunteer research projects
Apache License 2.0
103 stars 41 forks source link

Generic task types #505

Closed alianos- closed 9 years ago

alianos- commented 9 years ago

One thing that I assume you have in mind is that there is no task to accept new values (they seem to be single or multiple choice etc, but not arbitrary input). I think you should really implement this, as it covers a wide range of scenarios. For our case it is a number between 1 and 100, but someone might want to group up different things and have a weird outcome, so a generic "free input" task would be great.

I had bumped on the same problem with my platform, and I ended up "allowing" any kind of type, so the "user" (i.e. myself) could create his own encoding of using things. So for example I was able instead of the predefined "single", so say "hoolahoop" or "potato". When I was retrieving a workflow and the first task was "potato", I -beeing the same person that put it there- knew how to handle it properly. I made all the parameters optional (such as answers), and allowed adding arbitrary parameters, so users could store what they needed to later present the questions appropriately.

Having done that, I then used my own generic API to cut some predefined cases, like single, multiple, etc. Since Panoptes is will go out in the public you could consider generalizing it in this way, but in any case I think you should allow the "input" type asap, as it to me it seems very basic.

alianos- commented 9 years ago

Actually now that I typed about it I am wondering (and I know I am getting ahead of myself cause I havent looked it up yet), will I be able to store whatever I want in the annotations of the classification, or it needs to be one of the answers of the task?

camallen commented 9 years ago

Yep - as long as you can interpret them independant of your workflow.

We've got a couple of projects that will use Panoptes with "empty" workflows and custom front end workflows that submit custom annotations. Which sounds very similar to what your thinking. We will get a basic annotation workflow task built in. I'm not sure when this will be though.

alianos- commented 9 years ago

Can you help me with how this works then?

I am trying to import this

{"classifications":{
    "annotations":[{
        "2003":{
            "water":"70",
            "forest":"30"},
        "2015":{
            "water":"80",
            "forest":"20"},
        "other":{
            "bridgeLoss":"true"}
        }],
    "links":{
        "subjects":[2],
        "workflow":1,
        "project":1}
    }
}

But I am getting the following error

{"errors":[{
    "message":"found unpermitted parameters: 2003, 2013, other"}
]}
camallen commented 9 years ago

Make sure you have the latest code checked out. Also you need the more params, see http://docs.panoptes.apiary.io/#reference/classification/classification-collection/create-a-classification

alianos- commented 9 years ago

I am looking at it

Create a classification by providing a JSON-API formatted object that must include annotations and a links hash with a set_member_subject, a project, and a workflow. Optionally may include the complete field, which will be set to true by default.

Assuming the set_member_subject is wrong and should be just subject (like the sample code), I don't see what I missed.

This is the sample code

    'classifications': {
        'completed': false,
        'metadata': {
            'started_at': '2014-08-24T22:20:21Z',
            'finished_at': '2014-08-24T22:24:31Z',
            'user_agent': 'cURL',
            'user_language': 'es_MX',
            'workflow_version': '11.12'
        },
        'annotations': [
            {'workflow-1': [10.4, 12.4, 13.2]},
        ],
        'links': {
            'subjects': ['11'],
            'workflow': '81',
            'project': '2'
        }
    }
camallen commented 9 years ago

Subjects is correct:

Have a look at these for valid params: https://github.com/zooniverse/Panoptes/blob/b554b6042ee886f1a809fd22d4d31692537b15b4/spec/controllers/api/v1/classifications_controller_spec.rb#L22

alianos- commented 9 years ago

I still don't see what I missed

classifications: {
        completed: true,
        metadata: metadata_values,
        annotations: annotation_values,
        links: {
          project: project_id,
          workflow: workflow_id
        }
      }

completed is optional, metadata is also optional. I have the other 3. I tried with the optional values as well though and the error is still the same.

{"errors":[{
    "message":"found unpermitted parameters: 2003, 2013, other"}
]}

My code is roughly a week old. I will try updating and let you know.

camallen commented 9 years ago

Confirming this is a bug via #508

camallen commented 9 years ago

@alianos- I've updated the docs in a separate PR so they won't be ready till tomorrow / next week.

Grab the latest code from master branch and you should now be able to specify your annotations as

{"classifications":{
   "metadata": { YOU NEED TO ADD THIS IN },
    "annotations":[
        { "task": "2003",
          "value": { 
            "water":"70",
            "forest":"30" }
        },
       { "task": "2015",
          "value": { 
            "water":"80",
            "forest":"20" }
        },
       { "task": "other",
         "value": { "bridgeLoss":"true" }
        }
     ],
    "links":{
        "subjects":[2],
        "workflow":1,
        "project":1}
    }
}
alianos- commented 9 years ago

I am now getting

Completed 500 Internal Server Error in 95ms
Java::JavaNet::ConnectException (Connection refused):

so I assume we got past the annotations issue.

Have a look at my response in #506 if you missed it. Thanks.

camallen commented 9 years ago

Yeah this is most likely related to panotpes and cellect in #511.