Skip to content
danielruss edited this page Oct 31, 2023 · 117 revisions

Welcome to the Quest Wiki!


QUEST – Questionnaire App – Documentation v0.6 7-23-20

Default Settings

  1. The following response codes correspond with the following options:
    a. 77 = Don’t Know
    b. 88 = NA
    c. 99 = Prefer not to answer
    The length of these response codes is increased as needed to avoid confusion with codes for other possible responses or the limits for integer responses. For example, if there are 10 other response categories, 777 = Don’t know. If age is requested as an integer and the maximum age allowed is 150, then 7777 = Don’t know.

  2. #YN following a question indicates binary, 0 = No, 1 = Yes, response options.

  3. #YNP following a question indicates 0 = No, 1 = Yes, 99 = Prefer not to answer, response options.

Syntax

Text or question

[TEXT], [TEXT#] – Brackets enclosing all upper-case text indicates the beginning of a text section (e.g. background information, directions) or a question. Numbers and underscores may be included, but there can be no spaces (e.g. A1, BQBCK_AGE_V1R0, INTRO). Text sections that are followed by response options will be read by the QUEST app as questions. Text included in the brackets will be used as the name for that question should it be referred to in other questions (i.e. for applying skip logic or piping an answer given for one question into the text of another question) and for the variable name for that question in the output. Text sections may contain spaces between paragraphs. A new text section or question will not be created until indicated as described above.

Answer required

[TEXT!], [TEXT#!] - An ! following the text between brackets indicating a question is used when that question must be answered in order for the participant to move on to the next question. Also referred to as a hard edit.

Answer prompt

[TEXT?], [TEXT#?] - A ? following the text between brackets indicating a question is used if a prompt to answer the question, should the participant skip, is wanted. Also referred to as a soft edit. The participant will still be allowed to move on to the next question even if the current question is unanswered.

Skip logic

-> TEXT – Skip logic is indicated with an arrow after the response variable to which the skip logic is applied. The text following the arrow is the name of the question displayed if the indicated response variable is selected.

Piped response

{$ID} – To pipe a response from one question (e.g. A1) into the text of another question (e.g. A2) insert the id of the first question, preceded by a $, in curly brackets (e.g. {$A1}) into the text of the other question where the response should appear. Piped response can take optional text. Just add a : after the ID (e.g. {$A1:this is optional text}. If there is no value given for the id, the optional text will appear instead.

Date Macros

#currentYear - Is replaced with the current year in a question. #currentMonth - Is replaced with a numerical representation of the current month. Jan=1 ... Dec=12 #currentMonthStr - Is replaced with a 3 letter representation of the current month. Jan, Feb, ..., Dec

Piped input response

{$u:ID} – This allows for piped variable from inputs into quest. For example: {"AGE":"55"} is the input value. To display this please use [Q1] You are {$u:AGE} years old.

Conditional text

|displayif= <condition>|text and piped reponses| - Pipe, displayif=, the condition that is required, pipe, the text that the user would like to be displayed, pipe indicates a conditional text.

Example: |displayif=equals(SEX,1)|Since you said Sex = 1, this is the example text to be displayed|

Conditional Questions

!|displayif= <condition>|text and questions|! - Pipe, displayif=, the condition that is required, pipe, the text that the user would like to be displayed, pipe indicates a conditional text or questions.

Example:

[SEX!] What was your biological sex assigned at birth? 
(1) Female
(2) Male 
(3) Intersex or other 


[SEX2] 
!|displayif=equals(SEX,1)|Please select the female body parts that you were born with. |__|id=femalebody| |!
!|displayif=equals(SEX,2)|Please select the male body parts that you were born with. |__|id=malebody| |!

Informational Pop-up

|popup|buttonText|title|popupText| - Pipe, popup, pipe, Button text, pipe, Title, pipe, Popup text, pipe to insert an informational pop-up button and associated text into a question or other text block insert the name of the button (e.g. information, definition, term to be defined) in buttonText followed by an optional title for the pop-up and the text to be included in the pop-up in brackets.

Example:

|popup|Example|Title|Here is the pop-up text|

Categorical responses

Select one

(#) - Parenthesis preceding response options indicate that only one option may be selected. This is also referred to as a radio button.

Select many

[#], [#*] – Brackets preceding response options indicate multiple options may be selected (i.e. Select All That Apply questions). The number can be followed by an asterisk (star) that mean if selected all other selections are cleared. Selecting any other option will clear the selection with an asterisk. Selection of an option will be recorded as a binary (1 = Selected, 0 = Not Selected) in the output for that question. This is also referred to as a check box.

Example:

[CONTINENTS] I have lived in the following continents
[12] North America
[13] South America
[14] Africa
[15] Asia
[16] Australia
[17] Europe
[18] Other
[19*] I prefer not to answer

In this question if the user selects I prefer not to answer, all other selected responses are de-selected.

Numeric and free text responses

Numeric

|__|__| - Pipe, underscore, underscore, pipe, underscore, underscore, pipe indicates a numeric response.
|__|__|id=VARIABLENAME| - Allows for a variable name to be entered. Variable name has to be in all capital letters.
|__|__|min=# max=#| - Allows for a minimum and maximum number range for the number input. Example: |__|__|min=0 max=100|
The min or max can take a previous Variable Name from a previous number input. Example: |__|__|min=AGE max=100| or |__|__|min=0 max=AGE|
Combined, every thing should look like |__|__|id=VARNAME min=0 max=100|

Free text

|__| - Pipe, underscore, underscore, pipe, indicates a free text response that is limited to a single line. Note, length of line is indeterminate unless otherwise specified. You can limit the length of the text using |__|minlen=5 maxlen=10|. The minlen should be less or equal to the maxlen. In the example, the value must be text with a length of 5 to 10 characters inclusively.
|___| - Pipe, underscore, underscore, underscore, pipe, indicates a free text response that may wrap around to multiple lines. Note, length of response is indeterminate unless otherwise specified. For all numeric and free text responses that are not part of a categorical response, the variable name for the response in the output is the same as the question name. Note, length of response is indeterminate unless otherwise specified.

[textbox: VARIABLE_NAME] - Bracket, the word "textbox", colon, Variable Name, bracket indicates a free texr response that may wrap around multiple lines

One or the Other (XOR)

In order to create a response that is only able to be answered one or the other, the text response input needs to have an attribute called xor and a unique ID. (e.g. |__|__|xor=Q1 id=Q1_A| and the second element |__|__|xor=Q1 id=Q1_B|)

Date

|date| - pipe, the word "date", pipe, denotes date entry. It takes an optional id (e.g. |date|id=DATE1|)
_TODAY_ is a reserved word for displayIf involving dates. It will return the current date, timezone adjusted, in the format of YYYY-MM-DD that can be used to compare against the date pope

Time

|time| - pipe, the word "time", and pipe should create an input type of time. It takes an optional id (e.g. |time|id=TIME1|)

Social Security Number

|SSN| - pipe, the letters "SSN" all caps, pipe denotes a 9 digit social security number entry. It takes a default pattern of ###-##-####, which is the default placeholder as well. To set the default pattern, set the markdown to |SSN|pattern=| to whatever pattern you would like. To set the default placeholder, set the markdown to |SSN|placeholder=| to whatever placeholder you would like.

Shortened Social Security Number

|SSNsm| - pipe, the letters "SSNsm" all caps except "sm", pipe denotes a 4 digit social security number entry. It takes a default pattern of ####. To set the default pattern, set the markdown to |SSN|pattern=| to whatever pattern you would like. To set the default placeholder, set the markdown to |SSN|placeholder=| to whatever placeholder you would like.

Phone Number

|tel| - pipe, the letters "tel", pipe denotes phone number entry. It takes a default pattern of (###)-###-####, which is the default placeholder as well. To set the default pattern, set the markdown to |tel|pattern=| to whatever pattern you would like. To set the default placeholder, set the markdown to |tel|placeholder=| to whatever placeholder you would like.

Email address

|@| - Pipe, @, pipe, indicates an email address and entries are checked for a valid email format. It takes an optional id (e.g. |email|id=EMAIL1|)

Hidden variables

|hidden|id=ID| creates hidden variable that gets set to "true" when the user see a question. If the user backs out of a question, the hidden value is cleared.

Images

|image|URL|height,width| - Pipe, image, pipe, the image URL (without https:// attached), and as an optional input of the height of the image and the width of the image and concluding with another pipe.

Confirming Social Security Numbers

|SSN|id='mySSN' confirm='confirmSSN'| -- Creates a SSN entry and compares the input value to |SSN|id="confirmSSN"|. If the second element does not exist, a warning appears in the developer panel, and no confirmation occurs.

[H1] SSN Please: |SSN|id=lala confirm=lili|

SSN again: |SSN|id=lili|

[END] The End

Looping [advanced]

The questionnaire doesn't actually loop, but rather unrolls the loop. The <loop> tag writes out the questions within the tag "max" times. The question Id are changed from QID to QID_#. A variable #loop, the loop index, is defined starting with the value of 1 for the first iteration of the loop. The displayif tag must be used in all questions within the loop to prevent questions from being displayed after the loop is completed. Typically, a question before the loop will provide the number of iterations.

<loop max = num>
[QID, displayif=function(responseId,#loop)] 
 ...
</loop>

where function = {greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, equals}

Example

[NAME] What is your name?
[FST_NAME] First name |__|
[LST_NAME] Last name |__|

[AGE] {$FST_NAME}, how old are you?
|__|__|

[OWNER] Do you own a pet?
#YN

[PETS] Select from below all the animals you think make good pets.  Select as many as apply.
[1] Dogs -> BREED
[2] Cats
[3] Fish
[4] Birds
[5] Other: Specify [text box:otherpets]

[BREED] List your favorite breed of dog
|__|

[WALK] How many times per day should a dog be walked?
(1) Once per day
(2) Two times per day
(3) Three or more times per day
(99) Prefer not to answer

Output for Sam Smith, a 38-year-old pet owner who selected Dogs, Fish, and Other, whose favorite breed of dog is a lab, and would prefer not to answer how many times per day a dog should be walked.

NAME FST_NAME LST_NAME AGE OWNER PETS 1 2 3 4 5 OtherPets BREED WALK
1 Sam Smith 38 1 1 1 0 1 0 1 rabbits lab 99

Looping Example

[NUMKIDS] Number of Children |__|__|id=numchildren|

<loop max=20>
[KIDNAME|firstquestion=#loop loopmax=numchildren|] What your {##} child's  name? |__|id=kidsname|
[KIDAGE]  What is  child # #loop's ({$KIDNAME}'s) age? |__|__|id=kidsage|
< -> _CONTINUE >
</loop>
[END] Thank you

Here is another example. Notice that there are vertical bars surrounding the loop arguments in the first loop question. Also notice that the first question allows you to ask follow up questions, but when you are finished asking the follow up questions you always go to SIBCONF. To avoid printing the SIBCONF question we need the displayif argument. Dont use <#NR -> _CONTINUE> because after continuing you will go to SIBCONF multiple times!


[NUMSIBS] How many siblings do you have |__|__|id=numsibs|
 
<loop max=20>
 
[D_814510313|firstquestion=#loop loopmax=numsibs|] Which type(s) of <b>cancer</b> Did your |displayif=#loop==1|oldest||displayif=#loop>1|{##}| sibling have? Select all that apply.
[939782495] Anal -> D_259397450
[135725957] Bladder -> D_528753070
[518416174] Brain -> D_683981980
<->SIBCONF>
 
[D_259397450?] How old was your |displayif=#loop==1|oldest||displayif=#loop>1|{##}| sibling when they were <b>first</b> told by a doctor or other health professional that they have or had <b>anal cancer</b>?<br/>
|__|__|__|xor=MOMCANC3A id=D_206625031 min=0 max=valueOrDefault("D_378988419","D_807765962",125) | Age at diagnosis
 
[D_528753070?] How old was your |displayif=#loop==1|oldest||displayif=#loop>1|{##}| sibling when they were <b>first</b> told by a doctor or other health professional that they have or had <b>bladder cancer</b>?<br/>
|__|__|__| xor=MOMCANC3B id=D_206625031 min=0 max=valueOrDefault("D_378988419","D_807765962",125)| Age at diagnosis
 
[D_683981980?] How old was your |displayif=#loop==1|oldest||displayif=#loop>1|{##}| sibling when they were <b>first</b> told by a doctor or other health professional that they have or had <b>brain cancer</b>?<br/>
|__|__|__|xor=MOMCANC3C id=D_206625031 min=0 max=valueOrDefault("D_378988419","D_807765962",125)| Age at diagnosis
 
[SIBCONF,displayif=selectionCount("D_814510313")>0] CONFIRM...
</loop>
[END] All done