Create new items
Now that we have a basic structure for this new activity, let us start adding some items.
Let's first start with the item for writing
# Type this in a terminal window
mkdir activities/EHI/items
touch activities/EHI/items/writing.jsonld
The content for items starts like the ones we have seen so far but
"reproschema:Field"
for the @type
field.
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@type": "reproschema:Field",
"@id": "writing.jsonld",
"prefLabel": "writing",
"description": "writing item of the EHI",
"schemaVersion": "1.0.0-rc1",
"version": "0.0.1"
}
|
We can now add:
- the question for this item
- the
inputType
for for the user interface that will decide how this item will displayed to the user.
- the response options
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@type": "reproschema:Field",
"@id": "writing.jsonld",
"prefLabel": "writing",
"description": "writing item of the EHI",
"schemaVersion": "1.0.0-rc1",
"version": "0.0.1",
"question": "Writing",
"ui": {
"inputType": "radio"
},
"responseOptions": {
"valueType": "xsd:integer",
"minValue": -100,
"maxValue": 100,
"multipleChoice": false,
"choices": [
{
"name": "Always right",
"value": 100
},
{
"name": "Usually right",
"value": 50
},
{
"name": "Both equally",
"value": 0
},
{
"name": "Usually left",
"value": -50
},
{
"name": "Always left",
"value": -100
}
]
}
}
|
For next step you can create on your own the throwing
item of the questionnaire.
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@type": "reproschema:Activity",
"@id": "edinburgh_handedness_inventory_short.jsonld",
"prefLabel": "Edinburgh handedness inventory - short form",
"description": "Short version of the Edinburgh handedness inventory",
"schemaVersion": "1.0.0-rc1",
"version": "0.0.1",
"citation": "10.1080/1357650X.2013.783045",
"preamble": "Please indicate your preferences in the use of hands in the following activities or objects:",
"ui": {
"order": ["items/writing.jsonld", "items/throwing.jsonld"],
"shuffle": false,
"addProperties": [
{
"variableName": "writing",jsonld
"isAbout": "items/writing.jsonld",
"isVis": true
},
{
"variableName": "throwing",
"isAbout": "items/throwing.jsonld",
"isVis": true
}
]
}
}
|
# Type this in a terminal window
touch activities/EHI/items/EHI_results.jsonld
Add the following content to it.
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@type": "reproschema:Field",
"@id": "EHI_results.jsonld",
"prefLabel": "EHI results",
"description": "Edinburgh handedness inventory",
"schemaVersion": "1.0.0-rc1",
"version": "0.0.1",
"ui": {
"inputType": "number",
"readonlyValue": true
},
"responseOptions": {
"valueType": "xsd:integer",
"minValue": -100,
"maxValue": 100
}
}
|
Add it to the activity.
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@type": "reproschema:Activity",
"@id": "edinburgh_handedness_inventory_short.jsonld",
"prefLabel": "Edinburgh handedness inventory - short form",
"description": "Short version of the Edinburgh handedness inventory",
"schemaVersion": "1.0.0-rc1",
"version": "0.0.1",
"citation": "10.1080/1357650X.2013.783045",
"preamble": "Please indicate your preferences in the use of hands in the following activities or objects:",
"ui": {
"order": [
"items/writing.jsonld",
"items/throwing.jsonld",
"items/EHI_results.jsonld"
],
"shuffle": false,
"addProperties": [
{
"variableName": "writing",
"isAbout": "items/writing.jsonld",
"valueRequired": true,
"isVis": true
},
{
"variableName": "throwing",
"isAbout": "items/throwing.jsonld",
"valueRequired": true,
"isVis": true
},
{
"isAbout": "items/EHI_results.jsonld",
"variableName": "EHI_results",
"isVis": true
}
]
},
"compute": [
{
"variableName": "EHI_results",
"jsExpression": "( writing + throwing ) / 2"
}
]
}
|
If you have to create several items that always have the same set of response options,
then it might be easier to create a separate file with those response options and point each item to that file instead.
This way, if you need to change the characteristics of one response,
you only have to change things in one file rather than in many.
For example, you could create response set file to constrains the possible answers
on the questions of the Edinburgh Handedness Inventory we have been working on by organizing things this way.
activities
├── edinburgh_handedness_inventory_short.jsonld
├── leftRightValueConstraints.jsonld
└── items
├── writing.jsonld
├ ...
...
The content of the leftRightValueConstraints.jsonld
file would look like this:
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@id": "leftRightValueConstraints.jsonld",
"@type": "reproschema:ResponseOption",
"valueType": "xsd:integer",
"minValue": -100,
"maxValue": 100,
"multipleChoice": false,
"choices": [
{
"name": "Always right",
"value": 100
},
{
"name": "Usually right",
"value": 50
},
{
"name": "Both equally",
"value": 0
},
{
"name": "Usually left",
"value": -50
},
{
"name": "Always left",
"value": -100
}
]
}
|
And you can point each item to it by referring to the local file in the responseOptions
field.
| {
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0-rc1/contexts/generic",
"@type": "reproschema:Field",
"@id": "writing",
"prefLabel": "writing",
"description": "writing item of the EHI",
"schemaVersion": "1.0.0-rc1",
"version": "0.0.1",
"question": "Writing",
"ui": { "inputType": "radio" },
"responseOptions": "../leftRightValueConstraints.jsonld"
}
|