Within the survey JSON, you can configure survey scoring. The scores are calculated, exported with survey data, and optionally displayed to sites.
Overview
- You can define scores for answers to survey questions in the survey JSON.
- Scoring is available in preview mode, allowing you to review and/or test your scoring configuration.
- Once the survey is submitted, the score is calculated.
- Site users have scoring visibility immediately after submission.
- Scoring data is included in the Survey Data extract.
- Editing a survey with scoring configured:
- May result in differences in score calculations between the previously approved version and this version.
- May require new translations in each supported language.
Defining Scores
The following Component Types can be used for scoring:
- Single Choice: Uses the score parameter on each answer. For example, selecting “Occasionally” below would result in a score of 10 for this question.
"answers": [ { "answer": "Occasionally", "name": "1", "score": 10, }, ]
- Multiple Choice: Uses the score parameter on each answer. All selected values are added together. For example, selecting both “Walk” and “Run” below would result in a score of 15 for this question.
"answers": [ { "answer": "Walk", "name": "walk", "score": 5, }, { "answer": "Run", "name": "run", "score": 10, }, ]
- Number Entry: Scoring is based on the numeric answer response.
- Numeric Rating Scale: Scoring is based on the numeric answer response.
- Visual Analog Scale: Scoring is based on the numeric answer response.
- *Optional answers: Eligible for scoring if used within one of the above component types. Uses the score parameter on each optional answer. For example, selecting the optional answer “I do not take any medications” below would result in a score of 0 for this question.
"optionalAnswers": [ { "answer": "I do not take any medications", "name": "na", "score": 0, }, ]
Configuration Parameters for Scores
The following parameters will be within an array of scores at the highest level in the survey JSON. See example below to see where the scores array belongs:
{
"name": "Survey Name",
"description": "Survey Description",
"licenseText": "© License Text",
"sections": [
"..."
],
"conditions": [
"..."
],
"scores" :
[
{
"scores": "score",
"..."
}
]
}
Parameter | JSON Code Example | Description | Requiredness |
---|---|---|---|
The name of the score | "score": "score" |
|
Required |
The label of the score | "label": "Survey Result" |
The display label of the score for site users and in data extracts | Required |
The calculation occurring within the score | "function": "score.q1 + score.q3 + score.q5 + score.q7" |
|
Required |
The site user visibility setting | "display": true |
The visibility setting for site users | Required |
The result of the score if it is necessary to derive a value from the numerical score |
“result”: [
|
|
Optional |
Example Survey Scoring JSON Configuration
The following JSON snippet illustrates the scoring question parameters described above. The configuration below is not reviewed or licensed for use in collections.
"scores": [
{
"name": "score",
"label": "Surve
y Result",
"function": "score.q1 + score.q3 + score.q5 + score.q7",
"display": true,
"result": [
{
"condition": " <= 7",
"value": " (Normal)"
},
{
"condition": "And( > 7, <= 10)",
"value": " (Borderline Abnormal)"
},
{
"condition": > 10,
"value": " (Abnormal)"
}
] }
],
Function and Result Condition Supported Operations
The following operations are supported in survey scoring:
Type | Name | Operator | Function |
---|---|---|---|
Math | Add | + | Sum() |
Subtract | - | Not applicable | |
Divide | / | Not applicable | |
Multiply | * | Not applicable | |
Remainder | % | Not applicable | |
Parenthesis | () | Not applicable | |
Minimum Number | Not applicable | min() | |
Maximum Number | Not applicable | max() | |
Average | Not applicable | average() | |
Ceiling | Not applicable | ceiling() | |
Floor | Not applicable | floor() | |
Comparison | Equal | = | Not applicable |
Does Not Equal | != | Not applicable | |
Less Than | < | Not applicable | |
Less Than or Equal To | <= | Not applicable | |
Greater Than | > | Not applicable | |
Greater Than or Equal To | >= | Not applicable | |
Logical | And (All Conditions True) | && | and() |
Or (At Least One Condition True) | || | or() | |
If Statement | Not applicable | if() | |
Text | Concatenation | & | concat() |
Convert Number to Text | Not applicable | Text(number, 'format') |
For more information and examples for each of these supported operations, visit the full reference guide.