|
| 1 | +--- |
| 2 | +title: Study Variables |
| 3 | +description: For study-wide dynamic configuration |
| 4 | +--- |
| 5 | + |
| 6 | +import { ImageZoom } from 'fumadocs-ui/components/image-zoom'; |
| 7 | +import { Step, Steps } from 'fumadocs-ui/components/steps'; |
| 8 | + |
| 9 | +import studyVariablesConfig1Img from './images/variable-config-1.png'; |
| 10 | +import studyVariablesConfig2Img from './images/variable-config-2.png'; |
| 11 | + |
| 12 | +## Introduction |
| 13 | + |
| 14 | + |
| 15 | +Study variables add the capability for study administrators to dynamically steer the behavior of the study system, without the need to change the study rules or questionnaires. |
| 16 | +While "participant flags" provide a way for individualized logic, study variables provide a simple way to control dynamic “global” (study specific) behavior. |
| 17 | + |
| 18 | +A study variable has a reference key (unique within the study), a value and a value type. |
| 19 | +The value type can be one of the following: |
| 20 | +- String |
| 21 | +- Number (integer or float) |
| 22 | +- Boolean |
| 23 | +- Date |
| 24 | + |
| 25 | +Each study can have its own set of study variables. The study administrator can manage them (create, edit value or configuration, delete). |
| 26 | +For improved readability, the study administrator can also assign a human-readable label and description to each study variable. |
| 27 | + |
| 28 | +<ExampleBox title="Use Cases"> |
| 29 | + |
| 30 | +- **Flag:** Set a flag to true or false to control the visibility of a question or section. |
| 31 | +- **Category:** Choose from a dropdown to change the study flow (e.g., phase1 -> phase2, with different behavior for each phase) |
| 32 | +- **Threshold:** Set a threshold for a numeric value to trigger a specific action (e.g., if study-counter reaches the threshold, send a researcher notification.) |
| 33 | +</ExampleBox> |
| 34 | + |
| 35 | +## Managing Study Variables |
| 36 | + |
| 37 | +The management of study variables is available in the **"Study Configurator"** module, under the **"Variables"** tab. |
| 38 | + |
| 39 | +<div className='block mx-auto w-fit'> |
| 40 | + |
| 41 | +</div> |
| 42 | + |
| 43 | +### Creating a Study Variable |
| 44 | + |
| 45 | +To create a new study variable, click the **"Create variable"** button. |
| 46 | + |
| 47 | +This will open a modal with the editor interface for the study variable. |
| 48 | + |
| 49 | +<Steps> |
| 50 | +<Step> |
| 51 | +Enter a unique identifier **`key`** for the study variable. This key is used to reference the study variable in other parts of the application. |
| 52 | + |
| 53 | +<ImageZoom |
| 54 | +className='p-2 bg-neutral-200 rounded-xl mx-auto' |
| 55 | +src={studyVariablesConfig1Img} |
| 56 | +width={400} |
| 57 | +height={200} |
| 58 | +alt="Study variables configuration 1" |
| 59 | +/> |
| 60 | +</Step> |
| 61 | + |
| 62 | +<Step> |
| 63 | +Select the value type of the study variable. (`string`, `integer`, `float`, `boolean`, `date`) |
| 64 | +</Step> |
| 65 | + |
| 66 | +<Step> |
| 67 | +(Optional) Enter the "UI priority" of the study variable. This is used to determine the order of the study variables in the list, where higher values are shown first. |
| 68 | +</Step> |
| 69 | + |
| 70 | +<Step> |
| 71 | +Click "Next" to open the "Configuration" tab. |
| 72 | +</Step> |
| 73 | + |
| 74 | +<Step> |
| 75 | +(Optional) Enter a "Label" for improved readability in the list, in case the key is not self-explanatory. |
| 76 | +<ImageZoom |
| 77 | +className='p-2 bg-neutral-200 rounded-xl mx-auto' |
| 78 | +src={studyVariablesConfig2Img} |
| 79 | +width={400} |
| 80 | +height={200} |
| 81 | +alt="Study variables configuration 2" |
| 82 | +/> |
| 83 | +</Step> |
| 84 | + |
| 85 | +<Step> |
| 86 | +(Optional) Enter a "Description" for even more context in the list. This will be shown below the value controller in the list. |
| 87 | +</Step> |
| 88 | + |
| 89 | +<Step> |
| 90 | +Type-specific configuration for the study variable, depending on the value type. For example, for numbers and dates you can define a minimum and maximum value. For strings, you can define if a select with options should be used or if a text input should be used. |
| 91 | +</Step> |
| 92 | + |
| 93 | +<Step> |
| 94 | +Click "Create" / "Save" to create / update the study variable. |
| 95 | +</Step> |
| 96 | +</Steps> |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +### Editing a Study Variable |
| 103 | + |
| 104 | +- To edit the "value" of a study variable, you can use the value input controller in the variable list directly. Depending on the value type, this might be a simple switch, a datepicker or a text / number input. |
| 105 | +- To edit the "configuration" of a study variable, use the three-dot menu on the right of the variable's card, and select **"Edit configs"**. |
| 106 | +- To delete a study variable, use the three-dot menu on the right of the variable's card, and select **"Delete"**. |
| 107 | + |
| 108 | +<div className='block mx-auto w-fit'> |
| 109 | + |
| 110 | +</div> |
| 111 | + |
| 112 | +## Using Study Variables |
| 113 | + |
| 114 | +Values of the study variables can be used in the following places: |
| 115 | +- **Study rules / study actions** (server-side): |
| 116 | + - expressions: retrieve and use the value of the study variable in a condition or as a parameter of an expression |
| 117 | + - actions: update the value of the study variable |
| 118 | + - available study expressions: (todo: link) |
| 119 | +- **Survey conditions** (client-side): |
| 120 | + - expressions: retrieve and use the value of the study variable in the condition |
| 121 | + - available survey expressions: (todo: link) |
| 122 | + |
| 123 | +Other applications specific usage might be available if the application supports it. |
0 commit comments