kgjamieson / NEXT-psych

Apache License 2.0
3 stars 2 forks source link

When downloading participant data, participant ID is not clearly presented #15

Closed stsievert closed 9 years ago

stsievert commented 9 years ago

When downloading the participant data with this button:

screen shot 2015-10-18 at 8 46 42 pm

the CSV looks something like

Participant ID,Timestamp,Center,Left,Right,Answer,Alg Label
<exp_uid>_<participant_id>,2015-10-19 01:41:29.663701,2015-10-19_Screen Shot 2015-09-26 at 8.26.31 PM.png,2015-10-19_default_instance_type.png,2015-10-19_._Screen Shot 2015-09-26 at 8.26.31 PM.png,2015-10-19_default_instance_type.png,Test

We want this CSV to be formatted like so -- just remove the underscore

Exp ID,Participant ID,Timestamp,Center,Left,Right,Answer,Alg Label
<exp_uid>,<participant_id>,2015-10-19 01:41:29.663701,2015-10-19_Screen Shot 2015-09-26 at 8.26.31 PM.png,2015-10-19_default_instance_type.png,2015-10-19_._Screen Shot 2015-09-26 at 8.26.31 PM.png,2015-10-19_default_instance_type.png,Test
stsievert commented 9 years ago

Also, when I download under DuelingBandits or Tuple, I get an error. Apparently this issue was seen beforehand... in DuelingBanditsPureExploration.py.

for index in response['target_indices']:
    targets[index['label']] = index
    # Check for the index winner in this response
    # Shouldn't there be a target_winner? This is weird.
    if 'index_winner' in response.keys() and response["index_winner"] == index['index']:
            target_winner = index

Because this throws an error, this means that the participant data cannot be downloaded

stsievert commented 9 years ago

Getting the participant response data fails for both DuelingBandits and Tuple in the code snippet above, 'index_winner' is not always in response.keys().

That is, when I run Tuple or DuelingBandits I essentially have done the following:

>>> # Tuple
>>> print ['index_winner' in res.keys() for res in response_list]
[True, True, True, True, True, True, True, True, False, False, False, True, False]
>>> 
>>> # DuelingBandits
>>> print ['index_winner' in res.keys() for res in response_list]
>>> [False, True, True, True, True, True, False, True, False, False, False, False, True, False, False, False, True, True, True, False, True, True, False, False, False, True, True, True, False, False, True, False, False, False, False, False, True, False, False, False, True, False, False, False, True, False, False, True, True, False, True, True, False, False, False, False, False, False, True, True, True, False, True, False, True, False, True, True, True, False, False, True, True, True, False, False, True, True, False, True, False, True, False, True, True, False, True, True, True, False, True, True, True, True, True, True, True, True, True, True]

When the function tries to append the index winner the variable target_winner is undefined. Specifically, it uses this line:

line.append(target_winner['target']['target_id'])

which throws an error because target_winner is undefined. The user sees that no participant data is downloaded and an error page.

This is a part of a response from the backend. I can get around this issue to allow the participant data to be downloaded, but we should address why we're getting this response from the backend.

lalitkumarj commented 9 years ago

It's fine if there is no target_winner. This is due to the fact that some queries may not get answered. You need to only return queries that did get answered.

stsievert commented 9 years ago

aab105b8f1f0222466b0b9de00a90562637ce242 only closes this issue for DuelingBandits. This commit makes identical changes to both DuelingBandits.py and TupleBanditsPureExploration.py but I'm not going to touch the tuple anymore; we have more time-sensitive issues on the table.

This commit does the following: