Questionnaire Structure » History » Version 2
Lukas Vonlanthen, 02 Aug 2018 15:45
1 | 1 | Lukas Vonlanthen | h1. Questionnaire Structure |
---|---|---|---|
2 | |||
3 | h2. Terminology |
||
4 | |||
5 | * *Questionnaire Data* (how the data of a questionnaire is saved in the DB and submitted to the API) |
||
6 | * *Questionnaire Configuration* (how the questionnaire is built, which questions are available in which categories etc.) |
||
7 | * *Questiongroup*: A group of questions belonging together. Example: Image, Caption, Location, Name of photographer. Questiongroups can be repeated, for example if multiple Images are available. |
||
8 | |||
9 | h2. Questionnaire Data |
||
10 | |||
11 | * The entire data of a questionnaire is stored in a single JSON field in the database. |
||
12 | * The format is as flat as possible: It contains questiongroups and questions (no categories or other Questionnaire Configuration data) |
||
13 | 2 | Lukas Vonlanthen | * Sample 1: "Questionnaire Data, shortened and with comments (in Python syntax)":https://git.cde.unibe.ch/snippets/2 |
14 | * Sample 2: "Questionnaire Data, complete in JSON":https://git.cde.unibe.ch/snippets/3 |
||
15 | 1 | Lukas Vonlanthen | |
16 | h2. Questionnaire Configuration |
||
17 | |||
18 | * The configuration of a questionnaire consists of multiple levels: |
||
19 | |||
20 | 2 | Lukas Vonlanthen | * *@sections@* (actually not used anymore and excluded from extracted configuration - see sample below) |
21 | 1 | Lukas Vonlanthen | |
22 | 2 | Lukas Vonlanthen | * *@categories@* (Example: 1. General information) |
23 | 1 | Lukas Vonlanthen | |
24 | 2 | Lukas Vonlanthen | * *@subcategories@* (Example: 1.1 Name of the SLM Technology (hereafter referred to as the Technology)) |
25 | 1 | Lukas Vonlanthen | |
26 | 2 | Lukas Vonlanthen | * *@questiongroups@* (Example: Name and Locally used name) - not always directly visible in the form |
27 | 1 | Lukas Vonlanthen | |
28 | 2 | Lukas Vonlanthen | "questiongroups_repeating": Specifies if and how many times the questiongroup can be repeated. |
29 | 1 | Lukas Vonlanthen | |
30 | 2 | Lukas Vonlanthen | * *@questions@* (Example: Name) |
31 | |||
32 | "questions_type": See [[Questionnaire_Structure#Available-question-types|documentation below]] for further information |
||
33 | |||
34 | "questions_choices": The valid choices for this question, if available (e.g. radio or checkboxes) |
||
35 | |||
36 | 1 | Lukas Vonlanthen | * The structure of the Questionnaire Configuration can be extracted using a management command (under development). This might eventually become an API endpoint at one point? |
37 | 2 | Lukas Vonlanthen | * Sample: "Questionnaire Configuration of Technologies form, edition 2015":https://git.cde.unibe.ch/snippets/1 |
38 | 1 | Lukas Vonlanthen | |
39 | |||
40 | h2. API Endpoint to create Questionnaires |
||
41 | |||
42 | * Accepts data in the *Questionnaire Data* format. |
||
43 | * Validates the data, creates links to other models (e.g. users) and saves a new questionnaire. |
||
44 | 2 | Lukas Vonlanthen | * **_Needs to be created._** |
45 | |||
46 | h2. Available question types |
||
47 | |||
48 | * *@bool@* |
||
49 | |||
50 | * Form: Renders as a radio. |
||
51 | * Questionaire Data: Stores an integer (1: True/Yes, 2: False/No) |
||
52 | * Example: 1.3 - The compiler and key resource person(s) accept the conditions regarding the use of data documented through WOCAT (@qg_accept_conditions.accept_conditions@) |
||
53 | |||
54 | * *@char@* (similar to @text@) |
||
55 | |||
56 | * Form: Renders as a text input field. |
||
57 | * Questionnaire Data: Stores an object with "locale" (e.g. @{"name": {"en": "Name"}}@). |
||
58 | * Example: 1.1 - Name (@qg_name.name@) |
||
59 | |||
60 | * *@checkbox@* |
||
61 | |||
62 | * Form: Renders as a checkbox field (multiple answers possible) |
||
63 | * Questionnaire Data: Stores the predefined value keywords as a list. |
||
64 | * Example: 3.1 - Main purpose(s) of the Technology (land user's perspective) (@tech_qg_6.tech_main_purpose@) |
||
65 | |||
66 | * *@date@* |
||
67 | |||
68 | * Form: Renders a text field with a datepicker. |
||
69 | * Questionnaire Data: Stores the value as text in format MM/DD/YYYY. |
||
70 | * Example: 1.3 - When were the data compiled (in the field)? (@qg_accept_conditions.date_documentation@) |
||
71 | |||
72 | * *@file@* (similar to @image@) |
||
73 | |||
74 | * Form: Renders a file upload field. |
||
75 | * Questionnaire Data: Stores the UUID (as text) that is returned by the upload view after successful file upload. |
||
76 | * Example: 4.1 - Technical drawing (@tech_qg_185.tech_drawing@) |
||
77 | |||
78 | * *@float@* |
||
79 | |||
80 | * Form: Renders a number input field. |
||
81 | * Questionnaire Data: Stores the value as float (with 2 decimals) |
||
82 | * Example: 4.5 - Quantity (@tech_qg_36.tech_input_est_quantity@) |
||
83 | |||
84 | * *@hidden@* |
||
85 | |||
86 | * Form: Renders a hidden field (no user input expected) |
||
87 | * Questionnaire Data: - |
||
88 | * Example: - |
||
89 | |||
90 | * *@image@* (similar to @file@) |
||
91 | |||
92 | * Form: Renders a file upload field. |
||
93 | * Questionnaire Data: Stores the UUID (as text) that is returned by the upload view after successful file upload. |
||
94 | * Example: 2.3 - Image (@qg_photos.image@) |
||
95 | |||
96 | * *@image_checkbox@* |
||
97 | |||
98 | * Form: Renders a checkbox field with images as labels |
||
99 | * Questionnaire Data: Stores the predefined value keywords as a list. |
||
100 | * Example: 3.2 - Select land use type (@tech_qg_9.tech_landuse@) |
||
101 | |||
102 | * *@int@* |
||
103 | |||
104 | * Form: Renders as number input field. |
||
105 | * Questionnaire Data: Stores the value as integer |
||
106 | * Example: 2.6 - Indicate year of implementation (@tech_qg_160.tech_implementation_year@) |
||
107 | |||
108 | * *@link_id@* |
||
109 | |||
110 | * Form: Renders as searchable (AJAX) select field to search a questionnaire in the DB |
||
111 | * Questionnaire Data: Stores the ID of the other questionnaire as integer. |
||
112 | * Example: 1.5 - Reference to Questionnaire(s) on SLM Approaches (@tech_qg__approaches.link_id@) |
||
113 | |||
114 | * *@map@* |
||
115 | |||
116 | * Form: Renders an interactive map to set points. |
||
117 | * Questionnaire Data: Stores a GeoJSON as text (FeatureCollection with one or multiple Point features) |
||
118 | * Example: 2.5 - Add geo-referenced information on the map below (@qg_location_map.location_map@) |
||
119 | |||
120 | * *@measure@* |
||
121 | |||
122 | * Form: Renders a radio input field that looks like a range / measure selector |
||
123 | * Questionnaire Data: Stores the predefined value (usually an integer) |
||
124 | * Example: 5.9 - health (@tech_qg_226.tech_access_health@) |
||
125 | |||
126 | * *@radio@* |
||
127 | |||
128 | * Form: Renders a radio. |
||
129 | * Questionnaire Data: Stores the predefined value as text. |
||
130 | * Example: 1.2 - Specify the key resource person (@tech_qg_184.user_resourceperson_type@) |
||
131 | |||
132 | * *@select@* |
||
133 | |||
134 | * Form: Renders a dropdown (select) field. |
||
135 | * Questionnaire Data: Stores the predefined value as text. |
||
136 | * Example: 4.4 - Type of measure (@tech_qg_165.tech_est_type@) |
||
137 | |||
138 | * *@select_model@* |
||
139 | |||
140 | * Form: Renders as searchable (AJAX) select field to search a DB entry of a certain model |
||
141 | * Questionnaire Data: Stores the ID of the DB entry as integer |
||
142 | * Example: |
||
143 | |||
144 | * *@select_type@* |
||
145 | |||
146 | * Form: Renders a searchable dropdown (select) field. |
||
147 | * Questionnaire Data: Stores the predefined value as text. |
||
148 | * Example: 1.1 - Country (@qg_location.country@) |
||
149 | |||
150 | * *@text@* |
||
151 | |||
152 | * Form: Renders a text area. |
||
153 | * Questionnaire Data: Stores an object with "locale" (e.g. @{"name": {"en": "Name"}}@). |
||
154 | * Example: 2.1 - Definition of the Technology (@tech_qg_1.tech_definition@) |
||
155 | |||
156 | * *@user_id@* |
||
157 | |||
158 | * Form: Renders as searchable (AJAX) select field to search a user through the WOCAT API. |
||
159 | * Questionnaire Data: Stores the ID of the user (as text). |
||
160 | * Example: 1.2 - User ID (@tech_qg_184.user_id@) |