Exporting result data
Export raw result data in JSON format
Using the admin interface you can export all relevant result data from the sessions of a specific block of an experiment.
To do so, navigate to localhost:8000/admin/experiment/block and click the Export JSON
button next to the block that you want to export.
After downloading and extracting the zip file you will have 6 JSON files containing the raw data as it is stored in the database by Django :
sessions.json
- All sessions that were logged by running this block.participants.json
- All participants that started aSession
with this block.profiles.json
- All profile questions answered by the participants.results.json
- All results from the trials of this block.sections.json
- All sections (sounds, images, stimuli, etc.) used in this block.songs.json
- AllSong
objects that belong to the sections that were used in this block.
Format of the exported data
Each file contains a list of objects, which are instances of a specific Django model, containing the data.
To link these objects together we use a field with a Foreign key which relates to the Primary Key of the linked object.
The Result
model is used twice, for different purposes:
- In profiles.json
, which contains the profile (or Participant
) questions. Recognizable by:
- A foreign key value on the Participant
field.
- A null
value on the Session
field.
- In results.json
, which contains the trial (or Session
) results. Recognizable by:
- A foreign key value on the Session
field.
- A null
value on the Participant
field.
sessions.json
Contains a list of all the sessions that were logged by running this block.
Example of an object of the Session
model:
{
"model": "session.session",
"pk": 2173,
"fields": {
"block": 1,
"participant": 425,
"playlist": 2,
"started_at": "2024-07-22T10:26:50.911Z",
"finished_at": "2024-07-22T10:31:53.955Z",
"json_data": {
"group": "S1",
"phase": "FINISHED",
"choices": {
"A": "___",
"B": "___"
},
"sequence": [4, 57, 51, 57, 12, 40, 35, 51, 57, 57, 35, 40, 33, 33, 37, 51, 13, 37, 29, 44, 37, 29, 4, 51, 57, 45, 45,
44, 12, 29, 57, 51, 35, 33, 51, 40, 44, 57, 4, 51, 37, 57, 57, 33, 40, 13, 13, 51, 29, 44, 57, 12, 51, 40,
12, 51, 37, 57, 33, 45, 12, 35, 45, 45, 44, 51, 13, 51, 51, 51, 35, 51, 4, 57, 57, 4, 13, 29, 57, 57
],
"stimuli_a": "ORANGE",
"experiment": "my_experiment",
"pair_colors": "A = Orange, B = Blue",
"button_order": "neutral",
"button_colors": "Blue left, Orange right",
"assigned_group": "Same direction, Pair 1",
"training_rounds": 20,
"feedback_sequence": [
10, 43, 51, 42, 9, 74, 75, 2, 31, 58, 68, 16, 8, 56, 69, 72, 70, 40, 35, 24
]
},
"final_score": 78.0,
"current_round": 101
}
}
model
: Name of the django app followed by the name of the model (or database table).pk
: The Primary Key of this session.fields
:Block
: Foreign keyfk
relates to theBlock
object. (block.pk
)Participant
: Foreign keyfk
relates to theParticipant
object. (participant.pk
)playlist
: Foreign keyfk
relates to theplaylist
object. (playlist.pk
)started_at
: Timestamp logged on creation of thisSession
object. (Set in the timezone of the server)finished_at
: Timestamp logged on finishing theSession
. (Set in the timezone of the server) This will be set tonull
if theParticipant
hasn’t completed theSession
.json_data
:experiment
: Slug of the experiment that this block is a part of.- The rest of the data varies per
Block
type and generally contains configuration data sent by the backend, that is used while running thisBlock
of the experiment. During theSession
this data can be changed by the backend to log information on the progress of thisBlock
and/or the user’s actions. This data can then be used to dynamically alter the course of theSession
. e.g., The user can only continue to a next stage, when certain training trials have been completed successfully.
final_score
: The final score calculated upon completion of theSession
. Unfinished sessions will have a value of0,0
participants.json
Contains a list of all the participants that started a Session
with this block.
Example of an object of the Participant
model:
{
"model": "participant.participant",
"pk": 425,
"fields": {
"unique_hash": "8ebd4a37-e969-4e29-a535-482dfe1dedc4",
"country_code": "nl",
"access_info": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"participant_id_url": "test_user"
}
}
model
: Name of the django app followed by the name of the model (or database table).pk
: Primary Key of thisParticipant
object.fields
:unique_hash
: The unique hash code, for thisParticipant
.country_code
: The participant’s country code derived from the ip address.access_info
: The participant’s browser and operating system info, as provided by theUser-Agent
request header, which is logged upon creation of this object.participant_id_url
: An optional custom identifier for thisParticipant
, which is set through the URL of the experiment: e.g.,localhost:3000/my_experiment?participant_id=<custom_id>
profiles.json
A list of Result
objects containing the participant’s anwers to the profile questions in this Session
.
Example of an object of the Result
model:
{
"model": "result.result",
"pk": 7983,
"fields": {
"session": null,
"participant": 425,
"section": null,
"created_at": "2024-07-20T14:28:13.227Z",
"question_key": "dgf_generation",
"expected_response": null,
"given_response": "gen_x",
"comment": "",
"score": null,
"scoring_rule": "",
"json_data": {
"key": "dgf_generation",
"view": "RADIOS",
"style": "neutral",
"value": "gen_x",
"config": {
"auto_advance": false,
"listen_first": false,
"response_time": 5,
"continue_label": "Continue",
"show_continue_button": true
},
"choices": {
"gen_x": "1965-1980",
"gen_z": "1997 or later",
"boomer": "1946–1964",
"silent": "1945 or earlier",
"millenial": "1981–1996"
},
"submits": false,
"question": "When were you born?",
"explainer": "",
"result_id": 7983,
"min_values": 1,
"is_skippable": false,
"decision_time": 4.958999872207642
}
}
}
model
: Name of the django app followed by the name of the model (or database table).pk
: Primary Key of thisResult
object.fields
:Session
: Not used for profile (Participant
) results.participant
: Foreign keyfk
relates to theParticipant
object. (participant.pk
)Section
: Not used for profile (Participant
) results.created_at
: Timestamp logged on creation of thisResult
object. (Set in the timezone of the server)question_key
: Unique identifier for this question.expected_response
: Not used for profile (Participant
) results.given_response
: Participant’s response to the question.comment
: Optional comment, sent by the backend.score
: Not used for profile (Participant
) results.score
: The scoring rule used to calculate the score for thisResult
.json_data
:decision_time
: Logged time in seconds. Measured from presenting the question until the participant’s response.- The rest of the data varies per
Question
type and generally contains configuration data sent by the backend to render aQuestion
on the frontend.
results.json
A list of session Result
objects containing the participant’s responses to the trials in this Session
.
Example of an object of the Result
model:
{
"model": "result.result",
"pk": 8051,
"fields": {
"session": 2173,
"participant": null,
"section": 44,
"created_at": "2024-07-22T10:29:57.720Z",
"question_key": "choice",
"expected_response": "B",
"given_response": "B",
"comment": "testing",
"score": 1.0,
"scoring_rule": "CORRECTNESS",
"json_data": {
"key": "choice",
"view": "BUTTON_ARRAY",
"style": {
"neutral": true,
"invisible-text": true,
"buttons-large-gap": true,
"buttons-large-text": true
},
"value": "B",
"config": {
"auto_advance": true,
"listen_first": true,
"response_time": 5,
"continue_label": "Verder",
"time_pass_break": false,
"auto_advance_timer": 2500,
"show_continue_button": true
},
"choices": {
"A": "___",
"B": "___"
},
"submits": true,
"question": "",
"explainer": "",
"result_id": 8051,
"min_values": 1,
"is_skippable": false,
"decision_time": 0.31099987030029297,
"expected_response": "B"
}
}
}
model
: Name of the django app followed by the name of the model (or database table).pk
: Primary Key of thisResult
object.fields
:Session
: Foreign keyfk
relates to theSession
object. (session.pk
)Participant
: Not used for trialSession
results.section
: Foreign keyfk
relates to theSection
object used for this trial. (Section.pk
)created_at
: Timestamp logged on creation of thisResult
object.question_key
: Unique identifier for theQuestion
type in this trial.expected_response
: The expected/correct response to this trial.given_response
: Participant’s response to this trial.comment
: Optional comment, sent by the backend.score
: The participant’s score for this trial.scoring_rule
: The scoring rule used to calculate the score for this trialResult
.json_data
:decision_time
: Logged response time in seconds. The start time can either be set the moment the trial has been loaded, or set after the sound has stopped playing. In this examplelisten_first
is set in theconfig
of the widget, so the time is measured from the moment the sound stopped playing until the response of theParticipant
.- The rest of the data varies per trial and widget type and generally contains configuration data sent by the backend to render a trial on the frontend.
sections.json
A list of Section
objects used in the trials of this Session
.
Example of an object of the Section
model:
{
"model": "section.section",
"pk": 21,
"fields": {
"playlist": 2,
"song": 22,
"start_time": 0.0,
"duration": 1.25,
"filename": "CAT/C3FcP1A.wav",
"play_count": 31,
"tag": "1A",
"group": "CROSSED"
}
}
model
: Name of the django app followed by the name of the model (or database table).pk
: Primary Key of thisSection
object.fields
:playlist
: Foreign keyfk
relates to thePlaylist
object used for this trial. (playlist.pk
) ThePlaylist
object is not included in this export, as it’s merely used to create a collection of sections and in itself doesn’t provide additional data.song
: Foreign keyfk
relates to theSong
object of thisSection
. (song.pk
) ASong
object for a section is only created if an artist or name is provided upon creation of theSection
object.start_time
: The offset time in seconds from the beginning of the audio file at which the player starts to play thisSection
.duration
: The duration in seconds of this section. The duration of aSection
is calculated when a playlist is compiled with the compileplaylist command, or when theSection
is uploaded via the admin interface.filename
: The actual folder and filename, relative to thebackend/upload
folder, where the audio file for thisSection
is stored.play_count
: How many times thisSection
has been played.tag
: A tag that can be used by the backend to identify sections for different purposes. e.g., This section is the right or wrong response to a certain trial.group
: A tag that can be used by the backend to groupSection
s for different purposes. e.g., ThisSection
belongs to the group of deprecated sections.
songs.json
A list of Song
objects that belong to the sections of the trials used for this Session
.
Example of an object of the Section
model:
{
"model": "section.song",
"pk": 52,
"fields": {
"artist": "P1 Training B-150Hz(4.6k)-220Hz(4.1k)-290Hz(3.6k)-360Hz(3.1k)-430Hz(2.6k).wav",
"name": "C0T1B"
}
}
model
: Name of the django app followed by the name of the model (or database table).pk
: Primary Key of thisSong
object.fields
:artist
: The artist’s name of thisSong
.name
: The name of thisSong
.
Export selected result data in CSV format
Using the admin interface you can export selected result data from the sessions from a specific block of an experiment as a CSV
file.
To do so, navigate to localhost:8000/admin/experiment/block and click the Export CSV
button next to the block that you want to export.
You will be presented with a screen that lets you choose the fields that you want to export, as well as the lay-out for the data in the CSV file:
- Choose the
Session
and relatedParticipant
fields that you want to export.- Click here for a description of the raw
Session
data. - Click here for a description of the raw
Participant
data.
- Click here for a description of the raw
- Choose which fields of the
Result
object you want to export.- Click here for a description of the raw profile
Result
data. - Click here for a description of the raw trial
Result
data.
- Click here for a description of the raw profile
- Select options to adjust the format of the exported CSV file.
- Select to include the session’s
json_data
field. - Select to convert the session’s
json_data
field to seperate columns. The data in this field will vary in size per block type. Therefore converting this data to columns can in some situations cause the CSV file to become unreadable. - Select to include the trial result’s
json_data
field. - Select to convert the trial result’s
json_data
field to seperate columns. The data in this field will vary in size per trial type. Therefore converting this data to columns can in some situations cause the CSV file to become unreadable. - Choose a format for the CSV file:
- Long format: (default)
- Each result is a row.
- Wide format:
- Each session is a row, each result is a column.
- Long format: (default)
- Select a settings template here.
- We have included a few templates of export settings for typical scenarios.
- Click to load the selected template. The selected options on the left will change. You can still select or deselect options before you hit the export button. (11)
- The export button! Click this button to download the CSV file from the server.
- Go back to the
Block
overview page.