Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable import of demographics from excel #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 21 additions & 16 deletions OSARI.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,30 @@
#---------------------------------------------------
# The participant information GUI (expInfo)
#---------------------------------------------------
expInfo = {
'Participant ID': '0000',
'Age (Years)': '00',
'Gender': ['Female', 'Male', 'Transgender', 'Non-binary', 'Other', 'Prefer not to say'],
'Gender (other)': 'Please state if other selected',
'Default Parameters?': True
}
demographic_file = data.importConditions('demographics.xlsx')
expInfo = {}
expInfo['Participant ID'] = '0000'

tips = {}

for field in demographic_file:
if type(field['Default']) == str:
if ',' in field['Default']:
# check if the value provided is a list and if so convert string to list
expInfo[field['Name']] = field['Default'].split(',')
else:
expInfo[field['Name']] = field['Default']
tips[field['Name']] = field['Tip']

expInfo['Default Parameters?'] = True
tips['Default parameters?'] = 'This will run the task with no additional options'

# Dictionary for the participant information GUI (expInfo)
dlg = gui.DlgFromDict(
dictionary=expInfo,
sortKeys = False, title= 'Participant Information',
tip={
'Participant ID': 'Participant identifier',
'Age (Years)': 'Your age in years',
'Gender': 'The gender you identify as',
'Gender (other)': 'The gender you identify as if none of the dropdown options above are applicable',
'Default Parameters?': 'This will run the task with no additional options'
})
dictionary=expInfo,
sortKeys = False, title= 'Participant Information',
tip=tips,
order= expInfo.keys())

if not dlg.OK: core.quit()
expInfo['date'] = data.getDateStr()
Expand Down
Binary file removed conditionFiles/~$instructions.xlsx
Binary file not shown.
Binary file added demographics.xlsx
Binary file not shown.