Handling of structured questionnaires (pages, groups, questions)
Handling questionnaires that have more of a structure beyond just "question following question".
Right now the data-structure for storing a questionnaire configuration is simply an array holding the questionIDs:
"questions": [
"st_6e67a0f5-9795-46d4-8a8b-47b2b51cc071",
"slq_a3b3d8dd-ed00-4ecb-8aa3-96c1e806b94f",
"slq_76c7350e-0f93-11eb-8494-2d77f73cdaad",
"st_1b27df55-d21c-4827-b7ad-7b7ce0b86cbb",
"slq_5e3d38ee-12bb-11eb-b903-d1ef6240fe29",
"st_ea3e65c6-3bb6-46b2-aade-ad5ce682211c",
"slq_83d500b1-12bb-11eb-96bb-d1ef6240fe29"
]
This could simply be extended to an array that contains pages. Pages again are an array that contains groups / questions. Questions are strings. Groups are an array that contains questions. Groups could be for example implemented using the HTML element <fieldset>
.
Example for a data structure working exactly like the previous example (i.e. 1st page, just questions):
"questions": [
[
"st_6e67a0f5-9795-46d4-8a8b-47b2b51cc071",
"slq_a3b3d8dd-ed00-4ecb-8aa3-96c1e806b94f",
"slq_76c7350e-0f93-11eb-8494-2d77f73cdaad",
"st_1b27df55-d21c-4827-b7ad-7b7ce0b86cbb",
"slq_5e3d38ee-12bb-11eb-b903-d1ef6240fe29",
"st_ea3e65c6-3bb6-46b2-aade-ad5ce682211c",
"slq_83d500b1-12bb-11eb-96bb-d1ef6240fe29"
]
]
Example for a data structure with two pages and a group and some lose questions (1st page with one question and one group of two questions, 2nd page with one group of three questions and one group of one question):
"questions": [
[
"st_6e67a0f5-9795-46d4-8a8b-47b2b51cc071",
[
"slq_a3b3d8dd-ed00-4ecb-8aa3-96c1e806b94f",
"slq_76c7350e-0f93-11eb-8494-2d77f73cdaad"
]
], [
[
"st_1b27df55-d21c-4827-b7ad-7b7ce0b86cbb",
"slq_5e3d38ee-12bb-11eb-b903-d1ef6240fe29",
"st_ea3e65c6-3bb6-46b2-aade-ad5ce682211c"
], [
"slq_83d500b1-12bb-11eb-96bb-d1ef6240fe29"
]
]
]
Open questions:
- Should pages/groups also be allowed to hold other data, like having a name? In such a case they should be an object instead of just an array.